ci: set persist-credentials: false on checkout steps#33
Merged
Conversation
3a5fe79 to
3423275
Compare
actions/checkout persists the job token into the workspace .git/config by default. These jobs never push or fetch with it, so persisting it only lets a later compromised step in the same job read the token from disk. Setting persist-credentials: false keeps it out of the checkout.
3423275 to
6da9fdb
Compare
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
Set
persist-credentials: falseon everyactions/checkoutstep across the CI and release workflows.Why
By default
actions/checkoutwrites the job token into the workspace.git/configas an auth header. Persisting it only widens the attack surface: any later step in the same job (a compromised action, or a malicious transitive dependency pulled in during install) could read the token from disk. Settingpersist-credentials: falsekeeps it out of the checkout and shrinks the blast radius.Scope
Now includes the release changelog workflow. That job pushes its branch via
create-pull-request, which authenticates with thetokenit is given as an input rather than the credentials persisted by checkout, sopersist-credentials: falseis the recommended setup there (it also ensures the action's own token, not the one baked into git config by checkout, is used for the push).