Skip to content

Commit bbd329c

Browse files
fix(ci): Don't persist checkout credentials in jobs that don't need them (#131833)
By default `actions/checkout` leaves the job's GitHub token on disk so that later `git` commands can authenticate. This adds `persist-credentials: false` to the 43 checkouts in jobs that never push, fetch, commit, or use an action that does (CI, lint, test, docs, and diff jobs across 16 workflows). Jobs that need the persisted token are left alone. These are jobs that use `getsentry/action-github-commit`, craft, `action-fast-revert`, `action-migrations`, or `action-build-and-push-images`, or that run `git push`, `git ls-remote`, or the product-owners commit script. In files: `backend.yml` (`requirements`, `api-url-typescript`, `typing`), `migrations.yml` (`sql`), `openapi.yml` (`release-api-package`), `pre-commit.yml`, `release.yml`, `bump-*.yml`, `fast-revert.yml`, `react-to-product-owners-yml-changes.yml`, `self-hosted.yml`, and `update-baseline.yml`. This fixes 43 of zizmor's 59 `artipacked` findings (see #131822). <!-- junior-request-attribution:start --> via @evanpurkhiser. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3ACTJL7358X%3A1795107431.493489 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3ACTJL7358X%3A1795107431.493489) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3ACTJL7358X%3A1795107431.493489/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Evan Purkhiser <1421724+evanpurkhiser@users.noreply.github.com>
1 parent 697f7c0 commit bbd329c

16 files changed

Lines changed: 76 additions & 0 deletions

‎.github/workflows/acceptance.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ jobs:
5959
skip_selective_testing: "${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Trigger: Override Selective Testing') }}"
6060
steps:
6161
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
62+
with:
63+
persist-credentials: false
6264

6365
- name: Check for backend file changes
6466
uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2
@@ -89,6 +91,8 @@ jobs:
8991
shard-indices: ${{ steps.select.outputs.shard-indices }}
9092
steps:
9193
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
94+
with:
95+
persist-credentials: false
9296

9397
- name: Get changed files
9498
id: changed
@@ -170,6 +174,8 @@ jobs:
170174
steps:
171175
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
172176
name: Checkout sentry
177+
with:
178+
persist-credentials: false
173179

174180
- name: Start resource monitor
175181
run: python3 .github/workflows/scripts/monitor-resources.py --start
@@ -394,6 +400,8 @@ jobs:
394400
COVERAGE_VERSION: '7.6.4'
395401
steps:
396402
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
403+
with:
404+
persist-credentials: false
397405

398406
- name: Download shard coverage
399407
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0

‎.github/workflows/backend.yml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ jobs:
4747
skip_selective_testing: "${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Trigger: Override Selective Testing') }}"
4848
steps:
4949
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
50+
with:
51+
persist-credentials: false
5052

5153
- name: Check for backend file changes
5254
uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2
@@ -64,6 +66,8 @@ jobs:
6466
DEVSERVICES_TIMEOUT: '10'
6567
steps:
6668
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
69+
with:
70+
persist-credentials: false
6771

6872
- name: Setup sentry python env
6973
uses: $/.github/actions/setup-sentry
@@ -119,6 +123,8 @@ jobs:
119123
SENTRY_API_TARBALL: ${{ github.workspace }}/.artifacts/sentry-api.tgz
120124
steps:
121125
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
126+
with:
127+
persist-credentials: false
122128

123129
- name: Setup sentry python env
124130
uses: $/.github/actions/setup-sentry
@@ -188,6 +194,8 @@ jobs:
188194
test-item-count: ${{ steps.compute-tests.outputs.test-item-count }}
189195
steps:
190196
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
197+
with:
198+
persist-credentials: false
191199

192200
- name: Get changed files
193201
id: changed
@@ -277,6 +285,8 @@ jobs:
277285
278286
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
279287
if: needs.select-tests.outputs.has-selected-tests == 'true'
288+
with:
289+
persist-credentials: false
280290

281291
- name: Download selected tests artifact
282292
if: needs.select-tests.outputs.has-selected-tests == 'true'
@@ -328,6 +338,8 @@ jobs:
328338

329339
steps:
330340
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
341+
with:
342+
persist-credentials: false
331343

332344
- name: Start resource monitor
333345
run: python3 .github/workflows/scripts/monitor-resources.py --start
@@ -537,6 +549,8 @@ jobs:
537549

538550
steps:
539551
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
552+
with:
553+
persist-credentials: false
540554

541555
- name: Setup sentry env
542556
uses: $/.github/actions/setup-sentry
@@ -599,6 +613,8 @@ jobs:
599613
timeout-minutes: 10
600614
steps:
601615
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
616+
with:
617+
persist-credentials: false
602618

603619
- name: Setup sentry env
604620
uses: $/.github/actions/setup-sentry
@@ -705,6 +721,8 @@ jobs:
705721
steps:
706722
- name: Checkout sentry
707723
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
724+
with:
725+
persist-credentials: false
708726

709727
- name: Setup sentry env
710728
uses: $/.github/actions/setup-sentry
@@ -739,6 +757,8 @@ jobs:
739757
pull-requests: write
740758
steps:
741759
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
760+
with:
761+
persist-credentials: false
742762

743763
- name: Setup sentry env
744764
uses: $/.github/actions/setup-sentry

‎.github/workflows/codeowners-coverage.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525

2626
steps:
2727
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
28+
with:
29+
persist-credentials: false
2830

2931
- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
3032
with:

‎.github/workflows/codeql.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ jobs:
3737
steps:
3838
- name: Checkout repository
3939
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
40+
with:
41+
persist-credentials: false
4042

4143
# Initializes the CodeQL tools for scanning.
4244
- name: Initialize CodeQL

‎.github/workflows/development-environment.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jobs:
3838
timeout-minutes: 5
3939
steps:
4040
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
41+
with:
42+
persist-credentials: false
4143

4244
- uses: $/.github/actions/setup-node-pnpm
4345

@@ -63,6 +65,8 @@ jobs:
6365
timeout-minutes: 10
6466
steps:
6567
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
68+
with:
69+
persist-credentials: false
6670

6771
- uses: astral-sh/setup-uv@884ad927a57e558e7a70b92f2bccf9198a4be546 # v6
6872
with:

‎.github/workflows/frontend-snapshots.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
# Explicitly need to do this to avoid cases where the merge commit is used instead of the PR head,
3636
# which can introduce diffs that aren't explicitly caused by the PR changes.
3737
ref: ${{ github.event.pull_request.head.sha || github.sha }}
38+
persist-credentials: false
3839

3940
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
4041
with:

‎.github/workflows/frontend.yml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
4444
with:
4545
fetch-depth: 1
46+
persist-credentials: false
4647

4748
- name: Check for frontend file changes
4849
uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2
@@ -59,6 +60,8 @@ jobs:
5960
runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-26.04-arm' || 'ubuntu-24.04' }}
6061
steps:
6162
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
63+
with:
64+
persist-credentials: false
6265

6366
- uses: $/.github/actions/setup-node-pnpm
6467

@@ -87,6 +90,7 @@ jobs:
8790
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
8891
with:
8992
fetch-depth: ${{ github.event_name == 'pull_request' && '100' || '1' }}
93+
persist-credentials: false
9094

9195
- uses: $/.github/actions/setup-node-pnpm
9296

@@ -167,6 +171,8 @@ jobs:
167171
command: [knip, 'knip:prod', 'knip:cycles']
168172
steps:
169173
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
174+
with:
175+
persist-credentials: false
170176

171177
- uses: $/.github/actions/setup-node-pnpm
172178

@@ -187,6 +193,7 @@ jobs:
187193
with:
188194
# PRs need history for git merge-base to find the fork point.
189195
fetch-depth: ${{ github.event_name == 'pull_request' && '100' || '1' }}
196+
persist-credentials: false
190197

191198
- uses: $/.github/actions/setup-node-pnpm
192199

@@ -238,6 +245,8 @@ jobs:
238245
steps:
239246
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
240247
name: Checkout sentry
248+
with:
249+
persist-credentials: false
241250

242251
# Must run before the parallel group: it parses $GITHUB_EVENT_PATH, which the
243252
# runner truncates whenever a step starts (getsentry/sentry#127566). It is also
@@ -296,6 +305,8 @@ jobs:
296305
runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-26.04-arm' || 'ubuntu-24.04' }}
297306
steps:
298307
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
308+
with:
309+
persist-credentials: false
299310

300311
- uses: $/.github/actions/setup-node-pnpm
301312

@@ -321,6 +332,8 @@ jobs:
321332
runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-26.04-arm' || 'ubuntu-24.04' }}
322333
steps:
323334
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
335+
with:
336+
persist-credentials: false
324337

325338
- uses: $/.github/actions/setup-node-pnpm
326339

‎.github/workflows/jest-balance.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
1919
name: Checkout sentry
20+
with:
21+
persist-credentials: false
2022

2123
- uses: $/.github/actions/setup-node-pnpm
2224

@@ -52,6 +54,8 @@ jobs:
5254
steps:
5355
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
5456
name: Checkout sentry
57+
with:
58+
persist-credentials: false
5559

5660
- uses: $/.github/actions/setup-node-pnpm
5761

@@ -96,6 +100,8 @@ jobs:
96100
runs-on: ubuntu-24.04
97101
steps:
98102
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
103+
with:
104+
persist-credentials: false
99105

100106
- uses: $/.github/actions/setup-node-pnpm
101107

‎.github/workflows/meta-deploys-detect-change-type.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
checks: write
1717
steps:
1818
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
19+
with:
20+
persist-credentials: false
1921

2022
- name: Check for file changes
2123
uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2

‎.github/workflows/migrations-drift.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
3535
with:
3636
ref: master
37+
persist-credentials: false
3738

3839
- name: Setup sentry env
3940
uses: $/.github/actions/setup-sentry
@@ -52,6 +53,7 @@ jobs:
5253
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
5354
with:
5455
clean: false
56+
persist-credentials: false
5557

5658
- name: Apply migrations (again)
5759
env:

0 commit comments

Comments
 (0)