Skip to content

fix(gateway): validate user authorization before auto-resume - #47761

Closed
ygd58 wants to merge 1 commit into
NousResearch:mainfrom
ygd58:fix/auto-resume-auth-check-v2
Closed

fix(gateway): validate user authorization before auto-resume#47761
ygd58 wants to merge 1 commit into
NousResearch:mainfrom
ygd58:fix/auto-resume-auth-check-v2

Conversation

@ygd58

@ygd58 ygd58 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Clean rebase of #23800 onto current main (egilewski flagged a merge conflict in gateway/run.py on the old branch).

Problem

Auto-resume of restart-interrupted sessions bypassed auth checks. The session owner was never validated against TELEGRAM_ALLOWED_USERS before the synthetic resume event was dispatched (issue #23778).

Fix

Check _is_user_authorized() for the session owner before scheduling auto-resume. Unauthorized sessions are skipped with a warning log.

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)
@alt-glitch alt-glitch added type/security Security vulnerability or hardening comp/gateway Gateway runner, session dispatch, delivery area/auth Authentication, OAuth, credential pools P1 High — major feature broken, no workaround labels Jun 17, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Resubmission of closed #23800 — clean rebase onto current main (the old branch had a merge conflict in gateway/run.py). This is the active version of that auth-bypass fix. Confirmed still live on main: _schedule_resume_pending_sessions dispatches synthetic resume events without calling _is_user_authorized() on the session owner, while the cold path (_handle_message) does check it. Related: #23778 (issue).

@egilewski

Copy link
Copy Markdown
Contributor

obsolete

The issue this PR closes appears to be resolved already. Please reopen with a fresh target if this still covers a distinct gap.

Signed: GPT-5.5-low in Codex

@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users labels Jun 21, 2026
@teknium1

teknium1 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Merged via #56347 (rebase-merge, your fix commit authorship preserved in git log): #56347

Cherry-picked onto current main at the current _schedule_resume_pending_sessions site (the method moved since your branch) and covered with two tests — unauthorized owner skipped without claiming a slot, and fail-closed on a raising auth check. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools comp/gateway Gateway runner, session dispatch, delivery P1 High — major feature broken, no workaround sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/security Security vulnerability or hardening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Gateway auth bypass — unauthorized user messages processed despite "Unauthorized" log

4 participants