fix(server): single source of truth for RPC authorization scopes - #220
Merged
Conversation
ws.ts kept a parallel RPC_REQUIRED_SCOPE Map while RpcAuthorization.ts owned the typed RPC_REQUIRED_SCOPES table. Identity methods were added only to the typed table, so production failed with "has no declared authorization scope" for identity.getSessionClaim. Route observeRpc* through requiredScopeForRpcMethod and drop the Map.
patroza
added a commit
that referenced
this pull request
Jul 30, 2026
ws.ts kept a parallel RPC_REQUIRED_SCOPE Map while RpcAuthorization.ts owned the typed RPC_REQUIRED_SCOPES table. Identity methods were added only to the typed table, so production failed with "has no declared authorization scope" for identity.getSessionClaim. Route observeRpc* through requiredScopeForRpcMethod and drop the Map. Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza
added a commit
that referenced
this pull request
Jul 30, 2026
ws.ts kept a parallel RPC_REQUIRED_SCOPE Map while RpcAuthorization.ts owned the typed RPC_REQUIRED_SCOPES table. Identity methods were added only to the typed table, so production failed with "has no declared authorization scope" for identity.getSessionClaim. Route observeRpc* through requiredScopeForRpcMethod and drop the Map. Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza
added a commit
that referenced
this pull request
Jul 30, 2026
ws.ts kept a parallel RPC_REQUIRED_SCOPE Map while RpcAuthorization.ts owned the typed RPC_REQUIRED_SCOPES table. Identity methods were added only to the typed table, so production failed with "has no declared authorization scope" for identity.getSessionClaim. Route observeRpc* through requiredScopeForRpcMethod and drop the Map. Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza
added a commit
that referenced
this pull request
Jul 31, 2026
ws.ts kept a parallel RPC_REQUIRED_SCOPE Map while RpcAuthorization.ts owned the typed RPC_REQUIRED_SCOPES table. Identity methods were added only to the typed table, so production failed with "has no declared authorization scope" for identity.getSessionClaim. Route observeRpc* through requiredScopeForRpcMethod and drop the Map. Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RPC_REQUIRED_SCOPEMap inws.ts) while the typed single source of truth lives inauth/RpcAuthorization.ts(RPC_REQUIRED_SCOPES/requiredScopeForRpcMethod).identity.getSessionClaim, etc.) were registered only in the typed table, so clients failed with: Could not load identity — RPC method identity.getSessionClaim has no declared authorization scope.cloudGetRelayClientStatuswasAuthRelayWriteScopein the Map vsAuthRelayReadScopein the typed table).observeRpc*authorization throughrequiredScopeForRpcMethod. Add a test that everyWsRpcGroupmethod resolves via that helper.Why this was easy to re-break
Identity overlay already imported
requiredScopeForRpcMethodbut never used it — the runtime path stayed on the stale Map.Deploy note
After merge into
fork/changes, Compose should auto-rebasefork/identity(which already has identity scopes inRPC_REQUIRED_SCOPES). Once integration picks up the rebased tip, the identity claim UI error goes away.Test plan
vp test run apps/server/src/auth/RpcAuthorization.test.tsvp checkopened by Patrick Roza in chat thread Discord · 🔀 Add Thread Source Attribution Filters · T3