Skip to content

Commit 653f38e

Browse files
committed
GH Actions: do not persist credentials
> 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
1 parent 11cacba commit 653f38e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

.github/workflows/php-qa.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
steps:
2121
- name: Checkout code
2222
uses: actions/checkout@v6
23+
with:
24+
persist-credentials: false
2325

2426
- name: Setup PHP
2527
uses: shivammathur/setup-php@v2
@@ -58,6 +60,8 @@ jobs:
5860
steps:
5961
- name: Checkout code
6062
uses: actions/checkout@v6
63+
with:
64+
persist-credentials: false
6165

6266
- name: Setup PHP
6367
uses: shivammathur/setup-php@v2
@@ -99,6 +103,8 @@ jobs:
99103
steps:
100104
- name: Checkout code
101105
uses: actions/checkout@v6
106+
with:
107+
persist-credentials: false
102108

103109
- name: Setup PHP
104110
uses: shivammathur/setup-php@v2

0 commit comments

Comments
 (0)