Repository navigation
ci(release): keep the publish job's write token out of the checkout - #7502
Merged
Merged
Conversation
The publish job's checkout persisted its contents:write token in .git/config, where every later step, including the package install and build, could read it. Check out without persisting credentials and give the token only to "Create release tag", the one step that pushes. It authenticates its own git calls through step-scoped GIT_CONFIG_* env and masks the encoded value. The gh steps keep their own GH_TOKEN. The workflow test now covers the checkout flag, which steps may receive the token and under what name, the auth header the tag push actually carries, and that nothing is written to .git/config. — Rames Jusso Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 0 important · 0 nits · head 40dae2e
No findings. With persist-credentials: false, the write token is no longer stored in .git/config. The only step that reaches the remote with git is Create release tag, and it gets the same extraheader that checkout would have written, scoped to that step through GIT_CONFIG_*.
Scope
- Read all of
publish.ymlat head. Every other git call in the publish job is local:git rev-parsein the verify step,git branch -r --containsinvalidate-release-channel.mjs, which is skipped onpull_request, andshow/ls-tree/cat-file/archiveinpackage-agent-plugin.mjs. Theghsteps carry their ownGH_TOKEN. The prerelease tag-push path never pushes. - Ran
node --test scripts/publish-workflow.test.mjslocally at head: 8/8 pass. - All Actions runs on the head are green. The
BLOCKEDmerge state is the review gate. - Not exercised: a real release push (as stated in the PR body).
— Genesis
Merged
3 of 4 tasks
3 of 5 tasks
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
The publish job's checkout no longer stores the job's write token in
.git/config. "Create release tag", the only step that pushes, now receivesGITHUB_TOKENin its own step env and authenticates its own git calls.Why
actions/checkoutpersists the job token by default, so every later step in the publish job could read acontents: writetoken from.git/config. That includesbun installandbun run build, which run dependency code. #7495 moved the Lambda zip build out of this job but noted that the npm package build still runs here with that stored token. This PR removes the stored token. The job's permissions themselves don't change.Related work
Refs #7495, #7485
How
persist-credentials: false.GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}in its own step env and fails fast if the token is empty.http.https://github.com/.extraheaderbasic-auth header thatactions/checkoutuses. The header goes throughGIT_CONFIG_COUNT/GIT_CONFIG_KEY_0/GIT_CONFIG_VALUE_0, so it applies only to that step's git commands, never touches.git/config, and stays out of process args. The encoded value is masked with::add-mask::.ls-remote, fetch, tag, push, retry verification) is unchanged.validate-release-channel.mjsandpackage-agent-plugin.mjsonly read local refs, whichfetch-depth: 0already provides. Everyghstep already passesGH_TOKENin its own env.Test plan
scripts/publish-workflow.test.mjspasses 8/8:persist-credentials: falseand that the job-level env has no secrets. It also checks thatsecrets.GITHUB_TOKENis passed only asGITHUB_TOKENto "Create release tag" and only asGH_TOKENto any other step.pre-pushhook. It checks that the push carries the expected basic-auth header for a fake token, that the masked value is printed, and that.git/confighas noextraheaderafterwards. Retry and mismatch behavior are covered as before.persist-credentials: falsefails the new test. Removing the header export fails both tag tests.actionlintonpublish.ymlreports no errors.Create release tagstep pushes the tag.— Rames Jusso
🤖 Generated with Claude Code