Skip to content

Commit 55023b0

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 9b5a164 commit 55023b0

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

.github/workflows/cs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
steps:
2323
- name: Checkout code
2424
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
25+
with:
26+
persist-credentials: false
2527

2628
- name: Install PHP
2729
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # 2.35.5
@@ -118,6 +120,8 @@ jobs:
118120
steps:
119121
- name: Checkout code
120122
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
123+
with:
124+
persist-credentials: false
121125

122126
# Updating the lists can fail intermittently, typically after Microsoft has released a new package.
123127
# This should not be blocking for this job, so ignore any errors from this step.

.github/workflows/quicktest.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
steps:
3030
- name: Checkout code
3131
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
32+
with:
33+
persist-credentials: false
3234

3335
# Updating the lists can fail intermittently, typically after Microsoft has released a new package.
3436
# This should not be blocking for this job, so ignore any errors from this step.
@@ -122,6 +124,8 @@ jobs:
122124
steps:
123125
- name: Checkout code
124126
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
127+
with:
128+
persist-credentials: false
125129

126130
# On stable PHPCS versions, allow for PHP deprecation notices.
127131
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
steps:
3333
- name: Checkout code
3434
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
35+
with:
36+
persist-credentials: false
3537

3638
# Updating the lists can fail intermittently, typically after Microsoft has released a new package.
3739
# This should not be blocking for this job, so ignore any errors from this step.
@@ -177,6 +179,8 @@ jobs:
177179
steps:
178180
- name: Checkout code
179181
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
182+
with:
183+
persist-credentials: false
180184

181185
- name: Setup ini config
182186
id: set_ini

.github/workflows/update-website.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
5252
with:
5353
ref: ${{ steps.base_branch.outputs.BRANCH }}
54+
persist-credentials: false
5455

5556
- name: Install PHP
5657
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # 2.35.5

0 commit comments

Comments
 (0)