Skip to content

Set persist-credentials: false on actions/checkout - #10

Open
anish-sujanani wants to merge 1 commit into
mainfrom
pmsec/persist-credentials
Open

Set persist-credentials: false on actions/checkout#10
anish-sujanani wants to merge 1 commit into
mainfrom
pmsec/persist-credentials

Conversation

@anish-sujanani

@anish-sujanani anish-sujanani commented Sep 7, 2026

Copy link
Copy Markdown

Set persist-credentials: false on actions/checkout

actions/checkout writes a credential for the GITHUB_TOKEN into .git/config and leaves it
there for the rest of the job. Nothing in this repository is leaking it today — this change removes
the material that a later mistake would expose: an artifact upload whose path includes the
repository root, a debug step that prints git config, a broad Docker build context, or a
dependency's install script reading the workspace.

What changed

1 actions/checkout step across 1 workflow file. One or two
added lines per step; nothing else moves.

  • postman.yamlpostman

Why this is safe here

The job(s) changed here perform no git or gh operation against the origin — nothing reads the credential from .git/config — so behaviour is unchanged.

A job only depends on the persisted credential if it runs git push or git tag against the
origin. Where a token is passed explicitly — via env: or as an action input — it is unaffected by
this change, because gh and actions read it from the environment rather than from git's config.

Verification

The edit was checked three ways before raising: the parsed YAML is identical once the added keys
are stripped, the number of added lines matches the number of actions/checkout steps in each
file, and actionlint reports no new issues.

If this breaks something

Say so and I will revert it — a defence-in-depth change is not worth a broken pipeline. If a job
turns out to need the credential, the fix is to authenticate explicitly rather than ambiently
(git push "https://x-access-token:$GH_TOKEN@github.com/$GITHUB_REPOSITORY.git" ...) and I am
happy to make that change instead.

Raised as part of a CI/CD security posture review (control PM_GH_REPO_036).

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant