Repository navigation
Give the bootstrap provisioning key the scopes integrators need - #202
Merged
Merged
Conversation
The team-provisioning key registered at bootstrap now also has teams:manage, teams:keys and usage:read, so an integrator can update, archive and re-key the teams it provisions and read their usage. Bootstrap reconciles the stored scopes of the key it registered under the same name, so existing installs pick up the new scopes on restart instead of failing. Any other scope mismatch still fails closed.
s3rot0n1n
approved these changes
Nov 15, 2026
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.
Why
The team-provisioning key that bootstrap registers from
BOOTSTRAP_TEAM_PROVISIONING_API_KEYhad onlyorganization:read,teams:provisionandteams:read. An integrator such as CourseLit also needs to manage the teams it creates. Updating a team's quota and sender (PATCH), suspending, resuming and archiving it needteams:manage; re-keying needsteams:keys; reading usage needsusage:read. On installs set up through bootstrap, those calls returned 403.What changes
teams:manage,teams:keysandusage:read.registerConfiguredOrganizationApiKeytakes an opt-inreconcileScopes. Bootstrap passes it, so a key it registered earlier under the same name gets its stored scopes updated on restart, instead of startup failing withconfigured_organization_api_key_scope_mismatch.Tests
apikey/queries.test.ts: upgrading and narrowing a configured key's scopes; a revoked key isn't reconciled; a scope change without opt-in still fails; a generated key can't be reconciled even under the bootstrap name. 9 pass.bootstrap.test.ts: the new scope list and the opt-in. 6 pass when run with--no-env-file;apps/api/.envbreaks two of these tests onmaintoo.bun run typecheckis clean.