Set persist-credentials: false on checkout steps (PM_GH_REPO_036) - #17
Open
anish-sujanani wants to merge 1 commit into
Open
anish-sujanani wants to merge 1 commit into
anish-sujanani wants to merge 1 commit into
Conversation
actions/checkout persists the GITHUB_TOKEN in .git/config by default. Setting persist-credentials: false removes it, as defence in depth against a later step exposing it via an artifact, a log, or a dependency script. See PM_GH_REPO_036.
There was a problem hiding this comment.
Adds persist-credentials: false to five actions/checkout steps across four workflows. YAML indentation is consistent with each surrounding block, and none of the touched jobs appear to need the persisted token for later git network operations. No actionable findings.
Review Scope
- Mode: Full pull request
- Range:
Full pull request through cd9d1bd2891090e21dbfa128d21e5e79a31567f6 - Current range coverage: Complete
- Cumulative pull request coverage: Complete
This review is complete for the current scope. Addressing all critical and warning findings above satisfies the review; suggestions are optional. Request another review only if subsequent changes introduce new behavior or materially expand the pull request's scope.
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.
Set
persist-credentials: falseon checkout stepsAddresses PM_GH_REPO_036 —
actions/checkoutmust not persist credentials.By default
actions/checkoutwrites the job'sGITHUB_TOKENinto the local git config as anhttp.https://github.com/.extraheaderentry and leaves it there for the rest of the job. Anylater step running in the workspace can read it — a dependency
postinstall, a test helper,an uploaded artifact, a verbose log.
persist-credentials: falsemakes checkout remove itonce the clone is done.
This sets the key on 5 steps.
Why this does not break the checkout itself
actions/checkoutauthenticates, clones, and then scrubs:configureAuth()runsunconditionally and the removal happens in a
finallyblock after the fetch. Checkout's ownnetwork access is unaffected, including on private repositories and with
fetch-depth: 0.Each job here was checked for anything that consumes the credential afterwards: every
run:command, every script and
npm/maketarget those commands invoke, and everyuses:actionresolved at its pinned ref with both
src/anddist/read, recursing through composites.Jobs that reach the network with
gitwere excluded rather than changed.ghis unaffected — it readsGH_TOKEN/GITHUB_TOKENfrom the environment and uses the RESTAPI. Only a
gitsubprocess doing network I/O from inside the workspace is affected.Verification
with:andpersist-credentials: falselines and deletes nothing.checked per file.
actionlintreports the same findings before and after.Break risk
Low. If a job here turns out to run
gitagainst the network in a way I missed, the symptomis an authentication failure on that one command — loud, immediate, and fixed by reverting
the key on that step.