1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +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".
This commit is contained in:
catborise 2026-11-08 17:55:31 +03:00
parent 0f151f14b3
commit 0596338469
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: