File tree Expand file tree Collapse file tree 4 files changed +38
-5
lines changed Expand file tree Collapse file tree 4 files changed +38
-5
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,15 @@ We strongly recommend that you upgrade pip to version 9+ of pip before upgrading
22
22
``pip --version ``.
23
23
24
24
25
+ .. _release-6.1.5 :
26
+
27
+ 6.1.5
28
+ -----
29
+
30
+ 6.1.5 is a security release, fixing one vulnerability:
31
+
32
+ - Fix open redirect vulnerability GHSA-c7vm-f5p4-8fqh (CVE to be assigned)
33
+
25
34
.. _release-6.1.4 :
26
35
27
36
6.1.4
Original file line number Diff line number Diff line change @@ -853,13 +853,18 @@ def get(self):
853
853
854
854
class TrailingSlashHandler (web .RequestHandler ):
855
855
"""Simple redirect handler that strips trailing slashes
856
-
856
+
857
857
This should be the first, highest priority handler.
858
858
"""
859
-
859
+
860
860
def get (self ):
861
- self .redirect (self .request .uri .rstrip ('/' ))
862
-
861
+ path , * rest = self .request .uri .partition ("?" )
862
+ # trim trailing *and* leading /
863
+ # to avoid misinterpreting repeated '//'
864
+ path = "/" + path .strip ("/" )
865
+ new_uri = "" .join ([path , * rest ])
866
+ self .redirect (new_uri )
867
+
863
868
post = put = get
864
869
865
870
@@ -910,6 +915,7 @@ def get(self):
910
915
url = sep .join ([self ._url , self .request .query ])
911
916
self .redirect (url , permanent = self ._permanent )
912
917
918
+
913
919
class PrometheusMetricsHandler (IPythonHandler ):
914
920
"""
915
921
Return prometheus metrics for this notebook server
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ define(function(){
33
33
34
34
jprop ( 'utils' , 'base/js/utils' )
35
35
jprop ( 'mathjaxutils' , 'base/js/mathjaxutils' ) ;
36
-
36
+
37
37
//Jupyter.load_extensions = Jupyter.utils.load_extensions;
38
38
//
39
39
jprop ( 'security' , 'base/js/security' ) ;
Original file line number Diff line number Diff line change 2
2
import re
3
3
4
4
from notebook .base .handlers import path_regex
5
+ from notebook .utils import url_path_join
6
+ from .launchnotebook import NotebookTestBase
5
7
6
8
# build regexps that tornado uses:
7
9
path_pat = re .compile ('^' + '/x%s' % path_regex + '$' )
8
10
11
+
9
12
def test_path_regex ():
10
13
for path in (
11
14
'/x' ,
@@ -29,3 +32,18 @@ def test_path_regex_bad():
29
32
'/y/x/foo' ,
30
33
):
31
34
assert not re .match (path_pat , path )
35
+
36
+
37
+ class RedirectTestCase (NotebookTestBase ):
38
+ def test_trailing_slash (self ):
39
+ for uri , expected in (
40
+ ("/notebooks/mynotebook/" , "/notebooks/mynotebook" ),
41
+ ("////foo///" , "/foo" ),
42
+ ("//example.com/" , "/example.com" ),
43
+ ("/has/param/?hasparam=true" , "/has/param?hasparam=true" ),
44
+ ):
45
+ r = self .request ("GET" , uri , allow_redirects = False )
46
+ print (uri , expected )
47
+ assert r .status_code == 302
48
+ assert "Location" in r .headers
49
+ assert r .headers ["Location" ] == url_path_join (self .url_prefix , expected )
You can’t perform that action at this time.
0 commit comments