feat: add gateway token scopes#81792
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 3, 2026, 11:51 PM ET / 03:51 UTC. Summary PR surface: Source +246, Tests +172, Docs +53, Generated 0, Other +6. Total +477 across 28 files. Reproducibility: yes. at source level: current main lacks Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Rebase against current main, remove unrelated/release-owned drift, add redacted real Gateway WebSocket proof, and merge only after Gateway/security owners approve the static token-scope trust boundary and upgrade behavior. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main lacks Is this the best way to solve the issue? Unclear as a merge-ready solution: static configured scopes are a plausible safer path than trusting client-supplied Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9d68f877ac3e. Label changesLabel justifications:
Evidence reviewedPR surface: Source +246, Tests +172, Docs +53, Generated 0, Other +6. Total +477 across 28 files. View PR surface stats
Security concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Summary
Fixes #80836
Fixes #81775
Verification
Real behavior proof
Behavior addressed: Trusted headless shared-token WebSocket clients can receive configured static operator scopes such as operator.read without self-granting via params.scopes.
Real environment tested: Local Vitest gateway/config/security suites plus config docs check and Blacksmith Testbox changed gate.
Exact steps or command run after this patch: pnpm test src/security/audit-gateway-exposure.test.ts src/gateway/auth.test.ts src/gateway/server-methods/config.shared-auth.test.ts src/gateway/server.auth.default-token.test.ts src/gateway/server.auth.control-ui.test.ts src/gateway/server/ws-connection/message-handler.post-connect-health.test.ts src/gateway/server-runtime-config.test.ts src/config/config-misc.test.ts -- --reporter=verbose; pnpm config:docs:check; git diff --check; pnpm check:changed.
Evidence after fix: Device-less token tests connect with requested admin/read scopes but receive only operator.read from gateway.auth.tokenScopes, then sessions.messages.subscribe succeeds; local insecure Control UI token clients are similarly bounded; privileged scopes are rejected on non-loopback binds without opt-in.
Observed result after fix: Focused tests passed; config docs check passed; diff check passed; check:changed passed on Blacksmith Testbox tbx_01krk2r04beeam6bbw06sd6gx2.
What was not tested: Full end-to-end third-party client against a deployed Gateway; covered by in-process Gateway WebSocket tests.