File tree Expand file tree Collapse file tree 3 files changed +37
-4
lines changed Expand file tree Collapse file tree 3 files changed +37
-4
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 @@ -854,13 +854,18 @@ def get(self):
854
854
855
855
class TrailingSlashHandler (web .RequestHandler ):
856
856
"""Simple redirect handler that strips trailing slashes
857
-
857
+
858
858
This should be the first, highest priority handler.
859
859
"""
860
-
860
+
861
861
def get (self ):
862
- self .redirect (self .request .uri .rstrip ('/' ))
863
-
862
+ path , * rest = self .request .uri .partition ("?" )
863
+ # trim trailing *and* leading /
864
+ # to avoid misinterpreting repeated '//'
865
+ path = "/" + path .strip ("/" )
866
+ new_uri = "" .join ([path , * rest ])
867
+ self .redirect (new_uri )
868
+
864
869
post = put = get
865
870
866
871
@@ -911,6 +916,7 @@ def get(self):
911
916
url = sep .join ([self ._url , self .request .query ])
912
917
self .redirect (url , permanent = self ._permanent )
913
918
919
+
914
920
class PrometheusMetricsHandler (IPythonHandler ):
915
921
"""
916
922
Return prometheus metrics for this notebook server
Original file line number Diff line number Diff line change 3
3
from nose .tools import assert_regex , assert_not_regex
4
4
5
5
from notebook .base .handlers import path_regex
6
+ from notebook .utils import url_path_join
7
+ from .launchnotebook import NotebookTestBase
6
8
7
9
# build regexps that tornado uses:
8
10
path_pat = re .compile ('^' + '/x%s' % path_regex + '$' )
9
11
12
+
10
13
def test_path_regex ():
11
14
for path in (
12
15
'/x' ,
@@ -30,3 +33,18 @@ def test_path_regex_bad():
30
33
'/y/x/foo' ,
31
34
):
32
35
assert_not_regex (path , path_pat )
36
+
37
+
38
+ class RedirectTestCase (NotebookTestBase ):
39
+ def test_trailing_slash (self ):
40
+ for uri , expected in (
41
+ ("/notebooks/mynotebook/" , "/notebooks/mynotebook" ),
42
+ ("////foo///" , "/foo" ),
43
+ ("//example.com/" , "/example.com" ),
44
+ ("/has/param/?hasparam=true" , "/has/param?hasparam=true" ),
45
+ ):
46
+ r = self .request ("GET" , uri , allow_redirects = False )
47
+ print (uri , expected )
48
+ assert r .status_code == 302
49
+ assert "Location" in r .headers
50
+ assert r .headers ["Location" ] == url_path_join (self .url_prefix , expected )
You can’t perform that action at this time.
0 commit comments