Skip to content

Commit a5aac72

Browse files
committed
defi.yml + abi.yml: contents:read perms, persist-credentials false (security/LOW)
- Both workflows now declare `permissions: contents: read` at the workflow level. defi.yml is read-mostly CI; abi.yml uses the env-scoped NPM_TOKEN_ORIGIN_DEFI for the publish step (not GITHUB_TOKEN). - Every actions/checkout step in both workflows now `with: { persist-credentials: false }` so the runner-side token isn't left in .git/config for later steps to read. No behavior change — none of the jobs push to the repo.
1 parent bc28ce6 commit a5aac72

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

.github/workflows/abi.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,21 @@ concurrency:
88
cancel-in-progress: true
99
group: ${{ github.ref_name }}
1010

11+
# security/LOW: scope GITHUB_TOKEN to read-only. Publishes use
12+
# NPM_TOKEN_ORIGIN_DEFI (env-scoped to `master` environment), not
13+
# GITHUB_TOKEN.
14+
permissions:
15+
contents: read
16+
1117
jobs:
1218
abi-gen:
1319
name: "Generate and publish ABI"
1420
runs-on: ubuntu-latest
1521
environment: master
1622
steps:
1723
- uses: actions/checkout@v4
24+
with:
25+
persist-credentials: false
1826

1927
- name: Install pnpm
2028
uses: pnpm/action-setup@v4

.github/workflows/defi.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,19 @@ concurrency:
1313
cancel-in-progress: true
1414
group: ${{ github.ref_name }}
1515

16+
# security/LOW: scope GITHUB_TOKEN to read-only. None of the jobs in
17+
# this workflow push to the repo or comment on PRs.
18+
permissions:
19+
contents: read
20+
1621
jobs:
1722
contracts-lint:
1823
name: "Contracts Linter"
1924
runs-on: ubuntu-latest
2025
steps:
2126
- uses: actions/checkout@v4
27+
with:
28+
persist-credentials: false
2229

2330
- name: Install pnpm
2431
uses: pnpm/action-setup@v4
@@ -57,6 +64,8 @@ jobs:
5764
runs-on: ubuntu-latest
5865
steps:
5966
- uses: actions/checkout@v4
67+
with:
68+
persist-credentials: false
6069

6170
- name: Install pnpm
6271
uses: pnpm/action-setup@v4
@@ -95,6 +104,8 @@ jobs:
95104
runs-on: ubuntu-latest
96105
steps:
97106
- uses: actions/checkout@v4
107+
with:
108+
persist-credentials: false
98109

99110
- name: Install pnpm
100111
uses: pnpm/action-setup@v4
@@ -135,6 +146,8 @@ jobs:
135146
runs-on: ubuntu-latest
136147
steps:
137148
- uses: actions/checkout@v4
149+
with:
150+
persist-credentials: false
138151

139152
- name: Install pnpm
140153
uses: pnpm/action-setup@v4
@@ -189,6 +202,8 @@ jobs:
189202
--health-retries 10
190203
steps:
191204
- uses: actions/checkout@v4
205+
with:
206+
persist-credentials: false
192207

193208
- name: Install pnpm
194209
uses: pnpm/action-setup@v4
@@ -236,6 +251,8 @@ jobs:
236251
MAX_CHUNKS: "4"
237252
steps:
238253
- uses: actions/checkout@v4
254+
with:
255+
persist-credentials: false
239256

240257
- name: Install pnpm
241258
uses: pnpm/action-setup@v4
@@ -286,6 +303,8 @@ jobs:
286303
ARBITRUM_PROVIDER_URL: ${{ secrets.ARBITRUM_PROVIDER_URL }}
287304
steps:
288305
- uses: actions/checkout@v4
306+
with:
307+
persist-credentials: false
289308

290309
- name: Install pnpm
291310
uses: pnpm/action-setup@v4
@@ -336,6 +355,8 @@ jobs:
336355
BASE_PROVIDER_URL: ${{ secrets.BASE_PROVIDER_URL }}
337356
steps:
338357
- uses: actions/checkout@v4
358+
with:
359+
persist-credentials: false
339360

340361
- name: Install pnpm
341362
uses: pnpm/action-setup@v4
@@ -386,6 +407,8 @@ jobs:
386407
SONIC_PROVIDER_URL: ${{ secrets.SONIC_PROVIDER_URL }}
387408
steps:
388409
- uses: actions/checkout@v4
410+
with:
411+
persist-credentials: false
389412

390413
- name: Install pnpm
391414
uses: pnpm/action-setup@v4
@@ -436,6 +459,8 @@ jobs:
436459
PLUME_PROVIDER_URL: ${{ secrets.PLUME_PROVIDER_URL }}
437460
steps:
438461
- uses: actions/checkout@v4
462+
with:
463+
persist-credentials: false
439464

440465
- name: Install pnpm
441466
uses: pnpm/action-setup@v4
@@ -486,6 +511,8 @@ jobs:
486511
HYPEREVM_PROVIDER_URL: ${{ secrets.HYPEREVM_PROVIDER_URL }}
487512
steps:
488513
- uses: actions/checkout@v4
514+
with:
515+
persist-credentials: false
489516

490517
- name: Install pnpm
491518
uses: pnpm/action-setup@v4
@@ -543,6 +570,8 @@ jobs:
543570
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
544571
steps:
545572
- uses: actions/checkout@v4
573+
with:
574+
persist-credentials: false
546575

547576
- uses: actions/cache@v4
548577
id: hardhat-cache
@@ -565,6 +594,8 @@ jobs:
565594

566595
steps:
567596
- uses: actions/checkout@v4
597+
with:
598+
persist-credentials: false
568599

569600
- name: Set up Python 3.10
570601
uses: actions/setup-python@v5

0 commit comments

Comments
 (0)