1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-01 08:26:03 +00:00

fix(console): a serial console token works only in its user's session

socketiod refused a request without a signed-in session, but took a
token from anyone's session: a token read from a log or a URL opened
another user's serial console for 120 s. As novncd does, the session
must be the token's user's; the refusal is the page's "not allowed".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
catborise 2026-11-08 17:55:31 +03:00
parent b6752f6370
commit fe553a2d65
3 changed files with 34 additions and 12 deletions

View file

@ -70,6 +70,9 @@ def connect(sid, environ, auth):
raise refused(environ, refusals.TURNED_OFF)
try:
instance, user = authorize((auth or {}).get("token"), "pty")
# a token read from a log or a URL is no use without its user's session (as in novncd)
if session_user_id(environ.get("HTTP_COOKIE")) != str(user.pk):
raise PermissionError("The console page was opened in another session")
except PermissionError:
raise refused(environ, refusals.NOT_ALLOWED)
finally: