fix(auth): resolve API-key tenants with the key's pinned roles#244
Closed
Makisuo wants to merge 1 commit into
Closed
fix(auth): resolve API-key tenants with the key's pinned roles#244Makisuo wants to merge 1 commit into
Makisuo wants to merge 1 commit into
Conversation
PR #242 pinned creator roles onto MCP keys and added tests asserting a member key cannot create standard keys or revoke other users' keys, but the authorization layers still stamped every resolved API key with the default (root) roles, so those restrictions never applied and the tests fail on main (200 instead of 403). Plumb resolved.roles through the v1 and v2 authorization layers and the MCP tenant resolver, falling back to the defaults for keys without pinned roles. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Your Pullfrog Router balance is exhausted. You have a card on file but auto-reload is disabled, so runs paused once your balance went past the overdraft buffer. Top up balance → · Enable auto-reload →
|
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.

What
Main CI is red: 3 tests in
apps/api/src/routes/v2/api-keys.http.test.tsfail withexpected 200 to be 403.#242 pinned creator roles onto MCP keys and added tests asserting a member key cannot create standard API keys or revoke other users' keys — but the authorization layers still stamp every resolved API key with the default (root) roles, so the restrictions never apply.
This plumbs
resolved.rolesthrough:ApiAuthorizationLayer(v1)ApiAuthorizationV2Layer(v2)resolveMcpTenantContext(MCP)falling back to
apiKeyDefaultRolesfor keys without pinned roles (unchanged behavior for existing standard keys).Verification
On a clean checkout of main:
api-keys.http.test.tsfails 3/16 → with this change 16/16 pass, and the fullapps/apisuite passes (948 tests; the one failing file locally,AiTriageWorkflow.run.test.ts, is only a missing localeffect-sdkdist build — CI builds it).🤖 Generated with Claude Code
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.