You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
REST and WebSocket auth disagree about CODEFRAME_AUTH_REQUIRED=false (the documented local no-auth opt-out). When auth is disabled, the REST API works without credentials but the terminal and session-chat WebSockets still demand a JWT and close the connection, so the sessions UI and embedded terminal are partially unusable in no-auth mode.
Surfaced during the #643 review (codex). Deferred from PR #675 as a pre-existing inconsistency out of scope for the secret-validation fix.
Evidence
codeframe/auth/dependencies.py — require_auth() returns a synthetic local principal when auth_required() is false:
So every REST router admits unauthenticated requests in no-auth mode.
codeframe/ui/routers/terminal_ws.py — _authenticate_websocket() closes with 4001 on a missing token unconditionally; it never consults auth_required().
codeframe/ui/routers/session_chat_ws.py — same: _authenticate_websocket() closes with 1008 on a missing token, no auth_required() check.
Note: this fails closed (WS denies rather than over-admits), so it is a usability/consistency bug, not an auth-bypass vulnerability. The secure default path (CODEFRAME_ALLOW_INSECURE_SECRET=1, which keeps auth ON) already works for WS; #675 updated the docs to steer local users toward it.
Fix options
Honor auth_required() in the WS auth helpers (preferred): when auth is disabled, skip the token requirement and attach the same synthetic local principal REST uses (e.g. user_id=None / a local-admin id), keeping behavior symmetric with require_auth(). Factor the no-auth decision into one shared helper so REST and WS can't drift again.
With CODEFRAME_AUTH_REQUIRED=false, a terminal WS and a session-chat WS connect without a token and operate (matching REST behavior), OR the no-auth opt-out is clearly scoped in docs as REST-only with the recommended alternative.
REST and WS share a single source of truth for the no-auth decision (no duplicated auth_required() logic that can drift).
Tests: WS connects in no-auth mode (or is documented as intentionally rejecting), and still rejects a missing/invalid token when auth is enabled.
Problem
REST and WebSocket auth disagree about
CODEFRAME_AUTH_REQUIRED=false(the documented local no-auth opt-out). When auth is disabled, the REST API works without credentials but the terminal and session-chat WebSockets still demand a JWT and close the connection, so the sessions UI and embedded terminal are partially unusable in no-auth mode.Surfaced during the #643 review (codex). Deferred from PR #675 as a pre-existing inconsistency out of scope for the secret-validation fix.
Evidence
codeframe/auth/dependencies.py—require_auth()returns a synthetic local principal whenauth_required()is false:codeframe/ui/routers/terminal_ws.py—_authenticate_websocket()closes with4001on a missing token unconditionally; it never consultsauth_required().codeframe/ui/routers/session_chat_ws.py— same:_authenticate_websocket()closes with1008on a missing token, noauth_required()check.Net effect:
CODEFRAME_AUTH_REQUIRED=false→ REST 200, WS connections rejected → sessions chat + terminal don't work.Note: this fails closed (WS denies rather than over-admits), so it is a usability/consistency bug, not an auth-bypass vulnerability. The secure default path (
CODEFRAME_ALLOW_INSECURE_SECRET=1, which keeps auth ON) already works for WS; #675 updated the docs to steer local users toward it.Fix options
auth_required()in the WS auth helpers (preferred): when auth is disabled, skip the token requirement and attach the same synthetic local principal REST uses (e.g.user_id=None/ a local-admin id), keeping behavior symmetric withrequire_auth(). Factor the no-auth decision into one shared helper so REST and WS can't drift again.CODEFRAME_AUTH_REQUIRED=falsedoes not disable WebSocket auth and is not a full local-dev mode (partly done in QUICKSTART by fix(security): hard-fail on default AUTH_SECRET whenever auth is enabled (#643) #675), and point users toCODEFRAME_ALLOW_INSECURE_SECRET=1instead.Acceptance criteria
CODEFRAME_AUTH_REQUIRED=false, a terminal WS and a session-chat WS connect without a token and operate (matching REST behavior), OR the no-auth opt-out is clearly scoped in docs as REST-only with the recommended alternative.auth_required()logic that can drift).Source: #643 / PR #675 cross-family review (codex), 2026-06-14.