Set persist-credentials: false on checkout steps#225
Open
williammartin wants to merge 1 commit into
Open
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Merged
persist-credentials: false on checkout steps
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.
Summary
Sets
persist-credentials: falseon everyactions/checkoutstep across our workflows. By default,actions/checkoutpersists theGITHUB_TOKENon disk so that subsequent git operations are authenticated; when downstream steps don't need that, opting out removes an unnecessary credential-leak surface. This is theartipackedaudit in zizmor.Where the token actually lives (FYI)
actions/checkout@v4(what we use today): the token is written into the repo's.git/configas anhttp.https://github.com/.extraheaderbasic-auth value. So if any later step uploads the workspace (including.git/) as an artifact, the token rides along.actions/checkout@v5+ /v6(#2286 "Persist creds to a separate file"): the auth header is written to$RUNNER_TEMP/git-credentials-<uuid>.configand.git/configonly contains anincludeIf.gitdir:<repo>.path = <that file>pointer. The credential is no longer captured by a.git/-inclusive artifact upload, but it still persists on disk inRUNNER_TEMPuntil the post-job cleanup removes it.persist-credentials: falseskips writing the credential anywhere in either version.Changes
.github/workflows/codeql-analysis.yml.github/workflows/lint.yml.github/workflows/test.ymlSafety
None of the affected workflows perform authenticated git operations after checkout:
codeql-analysis.ymlgithub/codeql-action/init+analyzelint.ymlsetup-go,go mod tidy,git diff --exit-code go.mod,golangci-lint-actiongit diffis purely local; all module deps are public (noGOPRIVATE)test.ymlsetup-go,go test -v ./...No
git push, no submodules, no private module fetches, noghcalls that rely on the persisted git credential.Verification
zizmorreports clean after the change: