Skip to content

Commit 782230e

Browse files
authored
Merge pull request #345 from jupyter/1.0.x
Apply security advisory fix to master
2 parents e3de58b + 37eac44 commit 782230e

File tree

5 files changed

+52
-5
lines changed

5 files changed

+52
-5
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.0.6] - 2020-11-18
11+
12+
1.0.6 is a security release, fixing one vulnerability:
13+
14+
### Changed
15+
16+
- Fix open redirect vulnerability GHSA-grfj-wjv9-4f9v (CVE-2020-26232)
17+
18+
1019
## [1.0] - 2020-9-18
1120

1221
### Added.

docs/source/other/changelog.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ We strongly recommend that you upgrade to version 9+ of pip before upgrading ``j
2121
Use ``pip install pip --upgrade`` to upgrade pip. Check pip version with
2222
``pip --version``.
2323

24+
.. _release-1.0.6:
25+
26+
1.0.6
27+
-----
28+
29+
1.0.6 is a security release, fixing one vulnerability:
30+
31+
- Fix open redirect vulnerability GHSA-grfj-wjv9-4f9v (CVE-2020-26232)
32+
2433
.. _release-1.0.0:
2534

2635
1.0.0

jupyter_server/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99

1010
# Next beta/alpha/rc release: The version number for beta is X.Y.ZbN **without dots**.
1111

12-
version_info = (1, 0, 5, '')
12+
version_info = (1, 0, 6, '')
1313
__version__ = '.'.join(map(str, version_info[:3])) + ''.join(version_info[3:])

jupyter_server/base/handlers.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -776,9 +776,12 @@ class TrailingSlashHandler(web.RequestHandler):
776776
"""
777777

778778
def get(self):
779-
uri = self.request.path.rstrip("/")
780-
if uri:
781-
self.redirect('?'.join((uri, self.request.query)))
779+
path, *rest = self.request.uri.partition("?")
780+
# trim trailing *and* leading /
781+
# to avoid misinterpreting repeated '//'
782+
path = "/" + path.strip("/")
783+
new_uri = "".join([path, *rest])
784+
self.redirect(new_uri)
782785

783786
post = put = get
784787

tests/test_paths.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import re
2-
2+
import pytest
3+
import tornado
34
from jupyter_server.base.handlers import path_regex
45

56

@@ -29,3 +30,28 @@ def test_path_regex_bad():
2930
'/y/x/foo',
3031
):
3132
assert re.match(path_pat, path) is None
33+
34+
35+
@pytest.mark.parametrize(
36+
'uri,expected',
37+
[
38+
("/notebooks/mynotebook/", "/notebooks/mynotebook"),
39+
("////foo///", "/foo"),
40+
("//example.com/", "/example.com"),
41+
("/has/param/?hasparam=true", "/has/param?hasparam=true"),
42+
]
43+
)
44+
async def test_trailing_slash(uri, expected, http_server_client, auth_header, base_url):
45+
# http_server_client raises an exception when follow_redirects=False
46+
with pytest.raises(tornado.httpclient.HTTPClientError) as err:
47+
await http_server_client.fetch(
48+
uri,
49+
headers=auth_header,
50+
request_timeout=20,
51+
follow_redirects=False
52+
)
53+
# Capture the response from the raised exception value.
54+
response = err.value.response
55+
assert response.code == 302
56+
assert "Location" in response.headers
57+
assert response.headers["Location"] == expected

0 commit comments

Comments
 (0)