feat: add allow_list to resource-scoped API tokens#19964
Merged
ThomasK33 merged 1 commit intoOct 9, 2025
Conversation
This was referenced Sep 25, 2025
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
4522801 to
5050f89
Compare
01e4d20 to
84dc70d
Compare
5050f89 to
6451b31
Compare
26fbd88 to
d90697e
Compare
30352b6 to
5e9b41c
Compare
d90697e to
e6d4c8c
Compare
5e9b41c to
30352b6
Compare
e6d4c8c to
d90697e
Compare
30352b6 to
deba62d
Compare
d90697e to
2463c7f
Compare
deba62d to
ff0d568
Compare
2547799 to
71ff7de
Compare
ff0d568 to
4ec061d
Compare
6fd539f to
ebe16f4
Compare
ff05d77 to
79126ab
Compare
8e7e58c to
b40c4d4
Compare
542f60b to
430cc79
Compare
430cc79 to
f7561f3
Compare
This was referenced Sep 30, 2025
Emyrk
requested changes
Oct 1, 2025
Emyrk
reviewed
Oct 2, 2025
Emyrk
reviewed
Oct 2, 2025
Emyrk
reviewed
Oct 2, 2025
Emyrk
reviewed
Oct 3, 2025
Emyrk
reviewed
Oct 3, 2025
Emyrk
reviewed
Oct 3, 2025
Emyrk
reviewed
Oct 3, 2025
Emyrk
reviewed
Oct 3, 2025
Emyrk
reviewed
Oct 3, 2025
Emyrk
reviewed
Oct 3, 2025
Emyrk
reviewed
Oct 6, 2025
Member
Emyrk
left a comment
There was a problem hiding this comment.
Minor comments, will approve after this round 👍
Emyrk
reviewed
Oct 7, 2025
Member
Emyrk
left a comment
There was a problem hiding this comment.
Last changes, then let's merge 👍
Expose allow_list targets on CreateTokenRequest and persist them in the database so API keys can be scoped to resources. Introduce codersdk and rbac helpers to parse, validate, and normalize allow lists to enforce consistent wildcard handling. Regenerate OpenAPI documentation, API typing outputs, and TypeScript bindings with stable serialization ordering for generated files.
Emyrk
approved these changes
Oct 7, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

Add API key allow_list for resource-scoped tokens
This PR adds support for API key allow lists, enabling tokens to be scoped to specific resources. The implementation:
allow_listfield to theCreateTokenRequeststruct, allowing clients to specify resource-specific scopes when creating API tokensAPIAllowListTargettype to represent resource targets in the format<type>:<id>with support for wildcardsAPIKeyEffectiveScopethat merges API key scopes with allow list restrictionsThis feature enables creating tokens that are limited to specific resources (like workspaces or templates) by ID, making it possible to create more granular API tokens with limited access.