-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: add oauth2 scope columns and single-use delete queries #28007
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7efa327
50f3466
6f5e057
e3ca40d
5ca9beb
3375487
08f2c9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| ALTER TABLE oauth2_provider_app_codes DROP COLUMN scope; | ||
|
|
||
| ALTER TABLE oauth2_provider_app_tokens DROP COLUMN scope; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| -- The scope negotiated at /oauth2/authorize travels with the grant itself: | ||
| -- recorded on the code when it is issued, then carried onto the token it is | ||
| -- exchanged for, so a refresh can be narrowed against what was actually | ||
| -- granted rather than against the app's current allowlist. | ||
| -- | ||
| -- Existing rows are unrestricted in fact rather than by omission, since | ||
| -- apikey.Generate mints every OAuth2 access key with the coder:all scope. | ||
| -- The backfill writes that down. Both columns are then NOT NULL with no | ||
| -- default, so a grant's authority is always stated explicitly and a caller | ||
| -- that omits the column fails instead of silently issuing full access. | ||
|
|
||
| ALTER TABLE oauth2_provider_app_codes ADD COLUMN scope text; | ||
|
BobbyHo marked this conversation as resolved.
BobbyHo marked this conversation as resolved.
|
||
|
|
||
| ALTER TABLE oauth2_provider_app_tokens ADD COLUMN scope text; | ||
|
BobbyHo marked this conversation as resolved.
|
||
|
|
||
| UPDATE oauth2_provider_app_codes SET scope = 'coder:all' WHERE scope IS NULL; | ||
|
|
||
| UPDATE oauth2_provider_app_tokens SET scope = 'coder:all' WHERE scope IS NULL; | ||
|
|
||
| ALTER TABLE oauth2_provider_app_codes | ||
| ALTER COLUMN scope SET NOT NULL, | ||
| ADD CONSTRAINT oauth2_provider_app_codes_scope_not_empty CHECK (scope <> ''); | ||
|
|
||
| ALTER TABLE oauth2_provider_app_tokens | ||
| ALTER COLUMN scope SET NOT NULL, | ||
| ADD CONSTRAINT oauth2_provider_app_tokens_scope_not_empty CHECK (scope <> ''); | ||
|
|
||
| COMMENT ON COLUMN oauth2_provider_app_codes.scope IS 'Space-separated scope negotiated at authorization time, drawn from the api_key_scope vocabulary. Always set; coder:all records an unrestricted grant.'; | ||
|
|
||
| COMMENT ON COLUMN oauth2_provider_app_tokens.scope IS 'Space-separated scope granted to this token, drawn from the api_key_scope vocabulary. Always set; coder:all records an unrestricted grant. Later phases will narrow this on refresh and never widen it.'; | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.