Skip to content

Commit fc9ce02

Browse files
committed
Deny gracefully instead of crashing on non-numeric socket channel id
Clients occasionally join a socketio room before a case is selected (e.g. "case-null"), producing a non-numeric id. That's a premature join, not an authorization bypass attempt, so it should be denied gracefully rather than raising and killing the event-handler thread.
1 parent 211789a commit fc9ce02

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

source/app/blueprints/access_controls.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,17 @@ def wrap(*args, **kwargs):
413413
return redirect(not_authenticated_redirection_url(request.full_path))
414414

415415
chan_id = args[0].get('channel')
416-
if chan_id:
416+
if not chan_id:
417+
return _ac_return_access_denied(caseid=0)
418+
419+
# Clients occasionally join a room before a case is selected
420+
# (e.g. `case-null`), producing a non-numeric id. That's not an
421+
# authorization bypass attempt, just a premature join - deny
422+
# gracefully instead of raising and killing the socketio
423+
# event-handler thread.
424+
try:
417425
case_id = int(chan_id.replace('case-', '').split('-')[0])
418-
else:
426+
except ValueError:
419427
return _ac_return_access_denied(caseid=0)
420428

421429
access = ac_fast_check_user_has_case_access(iris_current_user.id, case_id, access_level)

0 commit comments

Comments
 (0)