Skip to content

Commit b39f15e

Browse files
committed
subprotocol token may be url-encoded
1 parent aef6348 commit b39f15e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

jupyter_server/auth/identity.py

+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import uuid
1818
from dataclasses import asdict, dataclass
1919
from http.cookies import Morsel
20+
from urllib.parse import unquote
2021

2122
from tornado import escape, httputil, web
2223
from tornado.websocket import WebSocketHandler
@@ -435,6 +436,12 @@ def get_token(self, handler: web.RequestHandler) -> str | None:
435436
for subprotocol in subprotocols:
436437
if subprotocol.startswith(_TOKEN_SUBPROTOCOL + "."):
437438
user_token = subprotocol[len(_TOKEN_SUBPROTOCOL) + 1 :]
439+
try:
440+
user_token = unquote(user_token)
441+
except ValueError:
442+
# leave tokens that fail to decode
443+
# these won't be accepted, but proceed with validation
444+
pass
438445
break
439446

440447
return user_token

0 commit comments

Comments
 (0)