Repository navigation
fix(api): hold a person's search to the types its token's scopes cover - #3546
Merged
Merged
Conversation
…ay call A person's token is meant to reach what a Console session of theirs reaches, but handleAccessToken read userBoundSessionOperations, a list kept for anonymous cookies, and five operations that take both a session cookie and a bearer were missing from it: listInvitations, getInvitation, cancelInvitation, getApplicationRevision and evaluatePolicy. They join it, the two invitation reads join projectReads, and a test now holds the list to the spec. createInvitation stays off it by a decision the test names: its answer is a link that gives a role, and a person's token reaches no operation that answers with a credential. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
The exception kept a person's token off createInvitation because its answer is a link that gives a role. The credential and its scopes decide what a caller may do, so the exception goes: a person's token reaches every operation that takes both a session cookie and a bearer, and the test holds the list to the spec without exceptions. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
…s token A person's token on the management API has not been released, and its pending changeset already says the token reaches the operations a Console session may call (.changeset/README.md). It now also says project.read reads a project's invitations. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
A review found that a token with only project.read read each inviter's user ID and email through expand=inviter on the invitation list, now that the list takes a person's token. An inviter is a user, and a token's scopes are a ceiling the person's grants do not lift, so the expand asks for user.read as the other expands ask for their scope. ADR 092 also counted three reads under project.read where there are five. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
The invitation operations named project.write, the scope that renames a project. Once a person's token reached them, a client a project administrator had allowed to change a project could create an admin invitation, whose link anyone signed in redeems, while createGrant on the same token is refused without grant.create. An invitation ends in a grant and its gate asks what creating a grant asks, so createInvitation names grant.create, the two reads grant.read and cancelInvitation grant.delete. A project secret is unaffected: its project.write covers every scope. This answers the permission catalog's open question on project invitations. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
…ations' into claude/search-token-scopes # Conflicts: # apps/api/internal/api/integration_test/access_token_test.go
search names one scope, the project's, and checked no other. A token issued for a person with project.read alone found users by name or identifier, teams, schemas, flow definitions and identity providers, whatever the token was consented to. Each type search is to find now asks of such a token the read scope that type's own list names, and a token without it is refused with auth.scope_insufficient, naming the scope, before anything is read. A session and a project secret have no such ceiling and search as before. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
🦋 Changeset detectedLatest commit: c957b67 The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Picks up #3545, which the PR stacked on this branch (#3546) already holds, so that PR's diff shows only its own change. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
…-scopes Takes the base's merge of main, so this PR's diff against its base is its own change. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
createInvitation with replaces_invitation_id deletes the original, and one that sends no metadata answers with the original's. A person's token issued with grant.create alone could so cancel an invitation that cancelInvitation refuses it, and read a name getInvitation refuses it. A replace now asks grant.delete of such a token, and grant.read when it carries the metadata over. A Console session and a project secret are unaffected. The contract test's open note on invitation reads named the catalog's old home for invitations; it now names the grant scopes. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
…-scopes Takes the base's fix for an invitation replace; the changeset keeps both branches' sentences. ADR 092 §8 also says that the tool list shows search to a token with project.read alone, and that a call for a type the token does not cover is refused with the scope it lacks. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
Base automatically changed from
claude/person-token-session-operations
to
main
December 2, 2026 05:33
Picks up #3537, which landed on main first. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
#3538 landed on main as one commit. This branch already holds its changes through the old base branch, so the merge takes nothing from it: it only records main as an ancestor, so that the pull request shows its own change. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
fforootd
enabled auto-merge
December 2, 2026 05:36
fforootd
pushed a commit
that referenced
this pull request
Dec 2, 2026
The base branch had main merged in before it landed; this takes those merges, so that main's squash of #3538 is an ancestor here too. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
fforootd
pushed a commit
that referenced
this pull request
Dec 2, 2026
…cope Picks up what landed on main in between: #3541, #3539, #3543 and #3542. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
fforootd
pushed a commit
that referenced
this pull request
Dec 2, 2026
#3546 landed on main as one commit. This branch already holds its changes through the old base branch, so the merge takes nothing from it: it only records main as an ancestor, so that the pull request shows its own change. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
fforootd
pushed a commit
that referenced
this pull request
Dec 2, 2026
Picks up #3546 and #3547, which landed after #3542. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
This branch was successfully deployed
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.
Context
searchwithproject.read.project.readis "View projects".Summary
The gap:
searchnames one scope, the project's, and checked no other. A token issued for a person withproject.readalone found users by name or identifier, teams, schemas, flow definitions and identity providers, whatever the person had consented the client to. ADR 092 §8 says a token's scopes are a ceiling the person's grants do not lift;searchdid not hold to it.The fix: each type
searchis to find asks of such a token the read scope that type's own list names:useruser.readteamteam.readschemaschema.readflow_definitionflow_definition.readidpidp.readRefused, not left out: a token without the scope gets
403 auth.scope_insufficient, which names the scope it lacks, before anything is read. Leaving the type out would let an agent read an empty result as "there is none".A type without a scope is refused to a person's token, so a new result type is never searched before it has one.
Who is unaffected: a Console session and a project secret have no such ceiling and search as before.
searchalready listsauth.scope_insufficientamong its errors, so the contract's error list does not change.Docs: the operation's description, ADR 092 §8 and the pending changeset say it.
Validation
go test ./internal/api/ ./internal/mcp/passes, with two new tests:TestSearch_APersonsTokenSearchesTheTypesItsScopesCover: a token withproject.readalone is refused users; a session is not.TestSearchReadScopesAreTheListsOwn: every result type in the spec has a scope, and it is the one its list names.go test -tags sqlite_integration ./internal/api/integration_test/passes, with a newTestAccessTokenSearchesWithinItsScopesagainst the real API with real tokens. It fails onmainwithout the fix (the first call answers200).turbo run generatefor@zitadel/serverand@zitadel/api,pnpm run check-openapi-rules, the toolchain'sgofmt,go vetwith and without the integration tag,scripts/go-lint.mjsandscripts/check-pr-title.mjspass.Release notes / changeset
.changeset/api-person-token.md(@zitadel/server,@zitadel/api, minor), as.changeset/README.mdasks for a fix to a change that has not been released: a person's token on the management API is unreleased.Notes
searchtool is shown to a token withproject.read. An agent that asks for a type its token does not cover now reads which scope to ask the person for.project.readreads the project and its members and nothing else, which is what the consent screen's "View projects" says.https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
Generated by Claude Code