Repository navigation
[M2.3e1] Project-bound API tokens - #120
Merged
Merged
Conversation
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 changed
M2.3e1: API tokens can be bound to one project.
20261105150000_project_api_tokens:api_tokens.organization_idandproject_id, set together (CHECK);projects(organization_id, id)with ON DELETE CASCADE: the project owns the token's lifetime;scopesWithinProject(scopes, project): every scope must have the same organization and project (an environment is optional). It never allowsprofile.read.ApiTokenCommands.create. Accepts an optionalproject:invalid_api_token_scopes;member.manageon the project, because binding credentials to a project is project administration;projectId.ApiTokenAuthentication. Every use of a project token refuses targets outside its project (403api_token_permission_denied). A stored project token whose scopes left the project is treated as corrupt (401).POST /api-tokensaccepts an optionalproject, andApiTokenDtoreturnsproject(null for account-wide tokens). The contract and client are regenerated, and the fixtures are updated.Design choices
member.manageat the project scope (owner, organization admin, project admin). Recorded in the SPEC.How it was tested
resource-tokens.integration.spec.tscase:projectId;Security considerations
The change only narrows authority: an extra per-use restriction and a creation-time check. There is no new credential exposure path.