Skip to content

Commit 08c4c89

Browse files
committed
protect against chrome mishandling backslash as slash in URLs
1 parent d65328d commit 08c4c89

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

notebook/auth/login.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ def _redirect_safe(self, url, default=None):
3939
"""
4040
if default is None:
4141
default = self.base_url
42+
# protect chrome users from mishandling unescaped backslashes.
43+
# \ is not valid in urls, but some browsers treat it as /
44+
# instead of %5C, causing `\\` to behave as `//`
45+
url = url.replace("\\", "%5C")
4246
parsed = urlparse(url)
4347
if parsed.netloc or not (parsed.path + '/').startswith(self.base_url):
4448
# require that next_url be absolute path within our path

0 commit comments

Comments
 (0)