fix(gateway): validate user authorization before auto-resume - #23800
fix(gateway): validate user authorization before auto-resume#23800ygd58 wants to merge 1 commit into
Conversation
Auto-resume of restart-interrupted sessions bypassed auth checks — the session owner's user_id was never validated against TELEGRAM_ALLOWED_USERS before the synthetic resume event was dispatched. An attacker who had an active session before TELEGRAM_ALLOWED_USERS was configured could receive a full agent response on gateway restart (issue NousResearch#23778). Fix: check _is_callback_user_authorized() for the session owner before scheduling auto-resume. Sessions whose owner is no longer in the allowlist are skipped with a warning log. Fixes NousResearch#23778 (partial - auto-resume auth bypass)
egilewski
left a comment
There was a problem hiding this comment.
Recommendation: request changes
I reviewed this in security mode against current GitHub main f9c8d95e43662d754eb296551695e0be554bc58e, PR base 64145a1996554e4e81b694e9737421f34f44e212, and PR head 3bfe5b8b038c51e34dc514024f092149d0968691.
Validation:
gh api repos/NousResearch/hermes-agent/pulls/23800: GitHub currently reportsmergeable=falseandmergeable_state=dirty.git fetch --no-write-fetch-head --no-tags upstream main:refs/remotes/upstream/main +pull/23800/head:refs/remotes/upstream/pr/23800: fetched current main and the PR head.git rev-list --left-right --count refs/remotes/upstream/main...refs/remotes/upstream/pr/23800: the branch is3472 1relative to current main.git merge-tree --write-tree refs/remotes/upstream/main refs/remotes/upstream/pr/23800: fails with a content conflict ingateway/run.py.gh pr checks 23800 --repo NousResearch/hermes-agent: shows stale PR-head failures from May 11, 2026, while current main check runs are successful; the merge conflict is the first decisive blocker.
Finding:
This PR cannot be reviewed or merged as-is because it no longer applies cleanly to current main. Please rebase or otherwise port the gateway auto-resume authorization change onto current main, then rerun focused gateway authorization coverage for the resumed-session path.
Signed: GPT-5.5-xhigh in Codex
|
Opened #47761 as a clean rebase onto current main, fixing the merge conflict noted in review. Same fix — validate user authorization before auto-resuming restart-interrupted sessions. |
Auto-resume of restart-interrupted sessions bypassed auth checks. The session owner was never validated against TELEGRAM_ALLOWED_USERS (or equivalent) before the synthetic resume event was dispatched. An attacker with an active session before the allowlist was configured could receive a full agent response on gateway restart (issue #23778). Clean rebase of #23800 onto current main (egilewski flagged a merge conflict in gateway/run.py on the old branch). Fix: check _is_user_authorized() for the session owner before scheduling auto-resume. Unauthorized sessions are skipped with a warning log instead of silently resuming. Fixes #23778 (partial - auto-resume auth bypass)
Auto-resume of restart-interrupted sessions bypassed auth checks. The session owner was never validated against TELEGRAM_ALLOWED_USERS (or equivalent) before the synthetic resume event was dispatched. An attacker with an active session before the allowlist was configured could receive a full agent response on gateway restart (issue NousResearch#23778). Clean rebase of NousResearch#23800 onto current main (egilewski flagged a merge conflict in gateway/run.py on the old branch). Fix: check _is_user_authorized() for the session owner before scheduling auto-resume. Unauthorized sessions are skipped with a warning log instead of silently resuming. Fixes NousResearch#23778 (partial - auto-resume auth bypass)
Auto-resume of restart-interrupted sessions bypassed auth checks. The session owner was never validated against TELEGRAM_ALLOWED_USERS (or equivalent) before the synthetic resume event was dispatched. An attacker with an active session before the allowlist was configured could receive a full agent response on gateway restart (issue NousResearch#23778). Clean rebase of NousResearch#23800 onto current main (egilewski flagged a merge conflict in gateway/run.py on the old branch). Fix: check _is_user_authorized() for the session owner before scheduling auto-resume. Unauthorized sessions are skipped with a warning log instead of silently resuming. Fixes NousResearch#23778 (partial - auto-resume auth bypass)
Auto-resume of restart-interrupted sessions bypassed auth checks. The session owner was never validated against TELEGRAM_ALLOWED_USERS (or equivalent) before the synthetic resume event was dispatched. An attacker with an active session before the allowlist was configured could receive a full agent response on gateway restart (issue NousResearch#23778). Clean rebase of NousResearch#23800 onto current main (egilewski flagged a merge conflict in gateway/run.py on the old branch). Fix: check _is_user_authorized() for the session owner before scheduling auto-resume. Unauthorized sessions are skipped with a warning log instead of silently resuming. Fixes NousResearch#23778 (partial - auto-resume auth bypass)
Auto-resume of restart-interrupted sessions bypassed auth checks. The session owner was never validated against TELEGRAM_ALLOWED_USERS (or equivalent) before the synthetic resume event was dispatched. An attacker with an active session before the allowlist was configured could receive a full agent response on gateway restart (issue NousResearch#23778). Clean rebase of NousResearch#23800 onto current main (egilewski flagged a merge conflict in gateway/run.py on the old branch). Fix: check _is_user_authorized() for the session owner before scheduling auto-resume. Unauthorized sessions are skipped with a warning log instead of silently resuming. Fixes NousResearch#23778 (partial - auto-resume auth bypass)
Auto-resume of restart-interrupted sessions bypassed auth checks. The session owner was never validated against TELEGRAM_ALLOWED_USERS (or equivalent) before the synthetic resume event was dispatched. An attacker with an active session before the allowlist was configured could receive a full agent response on gateway restart (issue NousResearch#23778). Clean rebase of NousResearch#23800 onto current main (egilewski flagged a merge conflict in gateway/run.py on the old branch). Fix: check _is_user_authorized() for the session owner before scheduling auto-resume. Unauthorized sessions are skipped with a warning log instead of silently resuming. Fixes NousResearch#23778 (partial - auto-resume auth bypass)
Auto-resume of restart-interrupted sessions bypassed auth checks. The session owner was never validated against TELEGRAM_ALLOWED_USERS (or equivalent) before the synthetic resume event was dispatched. An attacker with an active session before the allowlist was configured could receive a full agent response on gateway restart (issue NousResearch#23778). Clean rebase of NousResearch#23800 onto current main (egilewski flagged a merge conflict in gateway/run.py on the old branch). Fix: check _is_user_authorized() for the session owner before scheduling auto-resume. Unauthorized sessions are skipped with a warning log instead of silently resuming. Fixes NousResearch#23778 (partial - auto-resume auth bypass)
Problem
Auto-resume of restart-interrupted sessions bypassed auth checks. The session owner was never validated against
TELEGRAM_ALLOWED_USERSbefore the synthetic resume event was dispatched. An attacker with an active session before the allowlist was configured could receive a full agent response on gateway restart.Fix
Check
_is_callback_user_authorized()for the session owner before scheduling auto-resume. Unauthorized sessions are skipped with a warning log.Follows up on #23795 (inbound message auth bypass).
Fixes #23778 (partial - auto-resume auth bypass)