Skip to content

GH Actions: do not persist credentials#198

Open
jrfnl wants to merge 1 commit into
stablefrom
feature/ghactions-do-not-persist-credentials
Open

GH Actions: do not persist credentials#198
jrfnl wants to merge 1 commit into
stablefrom
feature/ghactions-do-not-persist-credentials

Conversation

@jrfnl

@jrfnl jrfnl commented Sep 17, 2025

Copy link
Copy Markdown
Member

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 1.x Next milestone Sep 17, 2025
@jrfnl

jrfnl commented Sep 17, 2025

Copy link
Copy Markdown
Member Author

Leaving this open until the next release. This may break the update-website.yml workflow. So better to merge & check this when a release is being done (and revert that part if needed).

@jrfnl

This comment was marked as outdated.

@jrfnl jrfnl force-pushed the feature/ghactions-do-not-persist-credentials branch from c1d1e1a to 55023b0 Compare November 19, 2025 01:25
@jrfnl

This comment was marked as outdated.

@jrfnl

This comment was marked as outdated.

@jrfnl jrfnl force-pushed the feature/ghactions-do-not-persist-credentials branch from 5860fbe to 84b1769 Compare December 8, 2025 12:40
@jrfnl jrfnl force-pushed the feature/ghactions-do-not-persist-credentials branch from 84b1769 to 4024f23 Compare March 5, 2026 04:12
@jrfnl

jrfnl commented Mar 5, 2026

Copy link
Copy Markdown
Member Author

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 4024f23 to ec64c2d Compare March 5, 2026 23:27
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