Repository navigation
ci: codify the least scope of the release's cross-repo tokens; gate their use (#1602) - #1630
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
scttfrdmn
marked this pull request as ready for review
November 14, 2026 20:22
scttfrdmn
force-pushed
the
hardening/token-scope
branch
from
November 14, 2026 20:22
3014972 to
f744bff
Compare
scttfrdmn
force-pushed
the
hardening/token-scope
branch
from
November 14, 2026 21:02
f744bff to
5f7fc5e
Compare
Merged
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.
Fixes #1602
GitHub won't show a secret's token type or scope, so this PR writes down the expected scope of each token, gates how the workflows use the tokens, and leaves the live comparison to you, as described below.
Added
infra/github-tokens/tokens.jsonsets the expected scope of the three cross-repo tokens the release holds. Each must be a fine-grained token on a single repository, neverspore-host/spawn, with Contents: write and Metadata: read only:HOMEBREW_TAP_GITHUB_TOKENspore-host/homebrew-tapSCOOP_BUCKET_GITHUB_TOKENspore-host/scoop-bucketDOCS_SYNC_TOKENspore-host/spore-host; Contents: write is whatPOST /dispatchesrequiresEach entry also records the workflow step that reads it, why, and a proposed replacement.
github_tokens_test.gofails in five cases:GITHUB_TOKEN, that isn't listed;env:/with:of its listed steps, which includes job- and workflow-levelenv:;I watched it fail on a classic
kind, spawn added to a token's repositories, a token in a job-levelenv:, and a token read by an unlisted step.infra/github-tokens/README.mdsays what to compare live, and proposes the replacements.docs/release-tap-token.mdnow asks for one token per tap, and says these are org secrets. It used to suggest a single token for both, and said the secrets were on spawn.What you must verify live
docs/release-tap-token.mdsays the tap tokens were re-set to a classicrepotoken after spawn#280, so expect to find one. If it's owned by a spawn admin, it would also bypass a tag ruleset.curl -sIagainst the API: anx-oauth-scopesheader means the token is classic.Proposed replacements (not done here)
DOCS_SYNC_TOKEN: delete it, and have the umbrella'ssync-cli-docspoll for new releases using its ownGITHUB_TOKEN.actions/create-github-app-token. That would also have prevented the expiry in spawn#280.GITHUB_TOKENcan't replace any of the three.Checks
internal/tests pass under the hermetic wrapper.