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
2222 ``pip --version ``.
2323
2424
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+
2534.. _release-6.1.4 :
2635
27366.1.4
Original file line number Diff line number Diff line change @@ -853,13 +853,18 @@ def get(self):
853853
854854class TrailingSlashHandler (web .RequestHandler ):
855855 """Simple redirect handler that strips trailing slashes
856-
856+
857857 This should be the first, highest priority handler.
858858 """
859-
859+
860860 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+
863868 post = put = get
864869
865870
@@ -910,6 +915,7 @@ def get(self):
910915 url = sep .join ([self ._url , self .request .query ])
911916 self .redirect (url , permanent = self ._permanent )
912917
918+
913919class PrometheusMetricsHandler (IPythonHandler ):
914920 """
915921 Return prometheus metrics for this notebook server
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ define(function(){
3333
3434 jprop ( 'utils' , 'base/js/utils' )
3535 jprop ( 'mathjaxutils' , 'base/js/mathjaxutils' ) ;
36-
36+
3737 //Jupyter.load_extensions = Jupyter.utils.load_extensions;
3838 //
3939 jprop ( 'security' , 'base/js/security' ) ;
Original file line number Diff line number Diff line change 22import re
33
44from notebook .base .handlers import path_regex
5+ from notebook .utils import url_path_join
6+ from .launchnotebook import NotebookTestBase
57
68# build regexps that tornado uses:
79path_pat = re .compile ('^' + '/x%s' % path_regex + '$' )
810
11+
912def test_path_regex ():
1013 for path in (
1114 '/x' ,
@@ -29,3 +32,18 @@ def test_path_regex_bad():
2932 '/y/x/foo' ,
3033 ):
3134 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