harden(auto-release): scope release token out of npm test#60
Merged
Conversation
The checkout persisted GITHUB_TOKEN (contents:write + actions:write) into .git/config, where `npm ci && npm test` then ran with it available — a compromised devDependency or test could read and reuse it. Set persist-credentials: false and push the tag with an explicit in-URL token, matching publish.yml's OIDC posture and marketplace-watch's push pattern.
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.
What
Harden
auto-release.ymlso the release token is never exposed to the test step.Why
auto-release.ymlwas the only workflow whosecheckoutomittedpersist-credentials: false. Because the job needscontents: write+actions: writeto push the tag and dispatchpublish.yml, the default checkout left thatGITHUB_TOKENin.git/config— andnpm ci && npm testthen ran with it sitting there. A compromised devDependency or test script could read.git/configand reuse the token to push tomasteror dispatch workflows.This is a post-merge (trusted) context so severity is low, but it's a real blast-radius gap and it was inconsistent with the repo's own patterns:
publish.yml(the other release-path workflow) already runspersist-credentials: false+ OIDC.marketplace-watch.ymlalready pushes with an explicit in-URL token.Change
checkoutnow setspersist-credentials: false.https://x-access-token:${GITHUB_TOKEN}@github.com/...), scoped to that step's env only, so the token never lives in.git/configduring the install+test step.gh release createandgh workflow runalready useGH_TOKENenv (not git config), so they are unaffected. No behavior change to the release/publish flow.