Skip to content

GH Actions: do not persist credentials#18

Merged
jrfnl merged 1 commit intomasterfrom
feature/ghactions-do-not-persist-credentials
Jan 26, 2026
Merged

GH Actions: do not persist credentials#18
jrfnl merged 1 commit intomasterfrom
feature/ghactions-do-not-persist-credentials

Conversation

@jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Oct 18, 2025

By default, using actions/checkout causes a credential to be persisted in the checked-out repo's .git/config, so that subsequent git operations can be authenticated.

Subsequent steps may accidentally publicly persist .git/config, e.g. by including it in a publicly accessible artifact via actions/upload-artifact.

However, even without this, persisting the credential in the .git/config is non-ideal unless actually needed.

Remediation

Unless needed for git operations, actions/checkout should be used with persist-credentials: false.

If the persisted credential is needed, it should be made explicit with persist-credentials: true.

This has now been addressed in all workflows.

Refs:

@jrfnl jrfnl added this to the 2.x Next milestone Oct 18, 2025
@jrfnl jrfnl requested a review from grogy October 18, 2025 11:58
@jrfnl jrfnl force-pushed the feature/ghactions-do-not-persist-credentials branch from 9dd8d01 to 74313f3 Compare December 8, 2025 18:59
@jrfnl
Copy link
Collaborator Author

jrfnl commented Dec 8, 2025

Rebased without changes to get passed imaginary merge conflict.

> By default, using `actions/checkout` causes a credential to be persisted in the checked-out repo's `.git/config`, so that subsequent `git` operations can be authenticated.
>
> Subsequent steps may accidentally publicly persist `.git/config`, e.g. by including it in a publicly accessible artifact via `actions/upload-artifact`.
>
> However, even without this, persisting the credential in the `.git/config` is non-ideal unless actually needed.
>
> **Remediation**
>
> Unless needed for `git` operations, `actions/checkout` should be used with `persist-credentials: false`.
>
> If the persisted credential is needed, it should be made explicit with `persist-credentials: true`.

This has now been addressed in all workflows.

Refs:
* https://unit42.paloaltonetworks.com/github-repo-artifacts-leak-tokens/
* https://docs.zizmor.sh/audits/#artipacked
@jrfnl jrfnl force-pushed the feature/ghactions-do-not-persist-credentials branch from 74313f3 to ee4f498 Compare January 26, 2026 23:08
@jrfnl
Copy link
Collaborator Author

jrfnl commented Jan 26, 2026

Rebased without changes to fix imaginary merge conflict.

I'm going to take the unilateral decision to merge this PR now.

@jrfnl jrfnl merged commit d30a62c into master Jan 26, 2026
1 check passed
@jrfnl jrfnl deleted the feature/ghactions-do-not-persist-credentials branch January 26, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant