Skip to content

Commit 739804c

Browse files
committed
Harden workflow permissions and credential persistence
Address the remaining zizmor findings: - Give every workflow a read-only default token (contents: read). The deploy-demo job additionally gets contents: write, which it needs to push to gh-pages. - Stop the checkout action from persisting credentials in lint, test and version-module, which never use them. deploy-demo keeps them, because its deploy step pushes with them; that finding is suppressed with a rationale.
1 parent 0521a67 commit 739804c

4 files changed

Lines changed: 24 additions & 0 deletions

File tree

‎.github/workflows/deploy-demo.yml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,23 @@ on:
55
branches:
66
- main
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
deploy-demo:
1013
# Pinned because our Playwright version cannot install its system
1114
# dependencies on newer Ubuntu releases. Upgrade Playwright to unpin.
1215
runs-on: ubuntu-24.04
1316

17+
permissions:
18+
contents: write # Needed to push the built demo to the gh-pages branch.
19+
1420
steps:
1521
- uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3.7.0
22+
with:
23+
# zizmor: ignore[artipacked] - credentials are used to push to gh-pages in the deploy step
24+
persist-credentials: true
1625
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
1726
with:
1827
node-version: 20

‎.github/workflows/lint.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@ name: lint
22

33
on: [push, pull_request]
44

5+
permissions:
6+
contents: read
7+
58
jobs:
69
lint:
710
runs-on: ubuntu-latest
811

912
steps:
1013
- uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3.7.0
14+
with:
15+
persist-credentials: false
1116
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
1217
with:
1318
node-version: 20

‎.github/workflows/test.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: test
22

33
on: [push, pull_request]
44

5+
permissions:
6+
contents: read
7+
58
jobs:
69
test:
710
# Pinned because our Playwright version cannot install its system
@@ -10,6 +13,8 @@ jobs:
1013

1114
steps:
1215
- uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3.7.0
16+
with:
17+
persist-credentials: false
1318
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
1419
with:
1520
node-version: 20

‎.github/workflows/version-module.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: version-module
22

33
on: [push, pull_request]
44

5+
permissions:
6+
contents: read
7+
58
jobs:
69
version-module:
710
# Pinned because our Playwright version cannot install its system
@@ -10,6 +13,8 @@ jobs:
1013

1114
steps:
1215
- uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3.7.0
16+
with:
17+
persist-credentials: false
1318
- uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
1419
with:
1520
node-version: 20

0 commit comments

Comments
 (0)