Skip to content

Commit c1d1e1a

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 e692881 commit c1d1e1a

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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
25+
with:
26+
persist-credentials: false
2527

2628
- name: Install PHP
2729
uses: shivammathur/setup-php@ec406be512d7077f68eed36e63f4d91bc006edc4 # master
@@ -119,6 +121,8 @@ jobs:
119121
steps:
120122
- name: Checkout code
121123
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
124+
with:
125+
persist-credentials: false
122126

123127
# Updating the lists can fail intermittently, typically after Microsoft has released a new package.
124128
# 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
@@ -28,6 +28,8 @@ jobs:
2828
steps:
2929
- name: Checkout code
3030
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
31+
with:
32+
persist-credentials: false
3133

3234
# Updating the lists can fail intermittently, typically after Microsoft has released a new package.
3335
# This should not be blocking for this job, so ignore any errors from this step.
@@ -121,6 +123,8 @@ jobs:
121123
steps:
122124
- name: Checkout code
123125
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
126+
with:
127+
persist-credentials: false
124128

125129
# On stable PHPCS versions, allow for PHP deprecation notices.
126130
# 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
@@ -31,6 +31,8 @@ jobs:
3131
steps:
3232
- name: Checkout code
3333
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
34+
with:
35+
persist-credentials: false
3436

3537
# Updating the lists can fail intermittently, typically after Microsoft has released a new package.
3638
# This should not be blocking for this job, so ignore any errors from this step.
@@ -175,6 +177,8 @@ jobs:
175177
steps:
176178
- name: Checkout code
177179
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
180+
with:
181+
persist-credentials: false
178182

179183
- name: Setup ini config
180184
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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5252
with:
5353
ref: ${{ steps.base_branch.outputs.BRANCH }}
54+
persist-credentials: false
5455

5556
- name: Install PHP
5657
uses: shivammathur/setup-php@ec406be512d7077f68eed36e63f4d91bc006edc4 # master

0 commit comments

Comments
 (0)