- Notifications
You must be signed in to change notification settings - Fork1k
feat: add allow list to API keys#19972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:thomask33/09-25-feat_add_allow_list_field_api_keys
Are you sure you want to change the base?
feat: add allow list to API keys#19972
Conversation
ThomasK33 commentedSep 25, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stackon Graphite.
This stack of pull requests is managed byGraphite. Learn more aboutstacking. |
05cdebd
to5442fcd
Compare1fea0d8
to8013625
Compareda32dec
tof2fbea4
Compare8013625
to4382587
Comparef2fbea4
to847f52e
Compare4382587
tofb2440e
Compare847f52e
to1361b86
Comparefb2440e
toce693c0
Compare1361b86
to581bc52
Compare581bc52
to6d17ef1
Comparece693c0
tof1a4e56
Comparef1a4e56
toa591e0a
Compare6d17ef1
to6fa5fe1
Comparec8a7549
toc50a0ac
CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
276874b
to662f3fa
Compare56cd860
tod38ed5b
Compare5dd3400
to5a6e8cc
Compared38ed5b
to5cb53f7
Compare5a6e8cc
to73a65fa
Compare5cb53f7
to6248fff
Compare7d422aa
tod590c1d
Compare6248fff
to67ed32b
Compared590c1d
to49af2b4
Compare4beef99
to86f7de9
Compare49af2b4
tofa53285
Compare86f7de9
to854efb0
Comparefa53285
tod7df2aa
Compare87fb51c
to3bdb267
ComparefuncAPIAllowListTarget(entry rbac.AllowListElement) codersdk.APIAllowListTarget { | ||
target:=codersdk.AllowAllTarget() | ||
ifentry.Type!="" { | ||
target.Type=codersdk.RBACResource(entry.Type) | ||
} | ||
ifentry.ID!="" { | ||
target.ID=entry.ID | ||
} | ||
returntarget | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I know we have to figure out the semantics of an empty string for theid
, but it should not be treated as a wildcard imo.
I think we should just pass the rbac entry to the SDK as is. Do not do:target := codersdk.AllowAllTarget()
as the default.
allowList:=db2sdk.List(k.AllowList,db2sdk.APIAllowListTarget) | ||
iflen(allowList)==0 { | ||
allowList=append(allowList,codersdk.AllowAllTarget()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I still think we should never have an empty allow list. The db migration handles this iirc, so defaulting toall
if the list is empty feels like it's hiding some other issue.
Add allow_list field to API key data structures and ensure properJSON serialization across backend and frontend. Initialize with default wildcard entry (*:*) for backward compatibility withexisting API keys that don't have explicit resource restrictions.Fixes#19854
d7df2aa
toa1346f5
Compare3bdb267
toc41112a
Compare
Uh oh!
There was an error while loading.Please reload this page.
Add API key allow list to the SDK
This PR adds an allow list to API keys in the SDK. The allow list is a list of targets that the API key is allowed to access. If the allow list is empty, a default allow list with a single entry that allows access to all resources is created.
The changes include:
Fixes#19854