Skip to content

Commit ff22c45

Browse files
authored
Merge pull request #160 from sigstore/ww/zizmor
ci: cleanup, fix zizmor findings
2 parents f7d1382 + 3f94c8b commit ff22c45

File tree

5 files changed

+98
-6
lines changed

5 files changed

+98
-6
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
14+
with:
15+
persist-credentials: false
16+
1417
- uses: actions/setup-python@v5
1518
with:
1619
python-version: "3.x"
20+
1721
- name: lint
1822
run: make lint

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@v4
20+
with:
21+
persist-credentials: false
2022

2123
- name: sign
2224
uses: ./

.github/workflows/selftest.yml

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ on:
88
workflow_dispatch:
99
workflow_call:
1010

11-
permissions:
12-
id-token: write
11+
permissions: {}
1312

1413
jobs:
1514
selftest:
15+
permissions:
16+
id-token: write
1617
strategy:
1718
matrix:
1819
os:
@@ -25,6 +26,8 @@ jobs:
2526
if: (github.event_name != 'pull_request') || !github.event.pull_request.head.repo.fork
2627
steps:
2728
- uses: actions/checkout@v4
29+
with:
30+
persist-credentials: false
2831
- uses: actions/setup-python@v5
2932
if: ${{ matrix.os != 'ubuntu-latest' }}
3033
with:
@@ -41,6 +44,8 @@ jobs:
4144
[[ -f ./test/artifact.txt.sigstore.json ]] || exit 1
4245
4346
selftest-runner-python:
47+
permissions:
48+
id-token: write
4449
strategy:
4550
matrix:
4651
os:
@@ -51,6 +56,8 @@ jobs:
5156
if: (github.event_name != 'pull_request') || !github.event.pull_request.head.repo.fork
5257
steps:
5358
- uses: actions/checkout@v4
59+
with:
60+
persist-credentials: false
5461
- name: Sign artifact and publish signature
5562
uses: ./
5663
id: sigstore-python
@@ -63,6 +70,8 @@ jobs:
6370
[[ -f ./test/artifact.txt.sigstore.json ]] || exit 1
6471
6572
selftest-whitespace:
73+
permissions:
74+
id-token: write
6675
strategy:
6776
matrix:
6877
os:
@@ -73,6 +82,8 @@ jobs:
7382
if: (github.event_name != 'pull_request') || !github.event.pull_request.head.repo.fork
7483
steps:
7584
- uses: actions/checkout@v4
85+
with:
86+
persist-credentials: false
7687
- uses: actions/setup-python@v5
7788
if: ${{ matrix.os != 'ubuntu-latest' }}
7889
with:
@@ -94,6 +105,8 @@ jobs:
94105
[[ -f ./test/more\ white\ space.txt ]] || exit 1
95106
96107
selftest-xfail-invalid-inputs:
108+
permissions:
109+
id-token: write
97110
runs-on: ubuntu-latest
98111
strategy:
99112
matrix:
@@ -105,6 +118,8 @@ jobs:
105118
if: (github.event_name != 'pull_request') || !github.event.pull_request.head.repo.fork
106119
steps:
107120
- uses: actions/checkout@v4
121+
with:
122+
persist-credentials: false
108123
- name: Sign artifact and publish signature
109124
continue-on-error: true
110125
uses: ./
@@ -122,10 +137,14 @@ jobs:
122137
[[ "${XFAIL}" == "true" ]] || { >&2 echo "expected step to fail"; exit 1; }
123138
124139
selftest-staging:
140+
permissions:
141+
id-token: write
125142
runs-on: ubuntu-latest
126143
if: (github.event_name != 'pull_request') || !github.event.pull_request.head.repo.fork
127144
steps:
128145
- uses: actions/checkout@v4
146+
with:
147+
persist-credentials: false
129148
- name: Sign artifact and publish signature
130149
uses: ./
131150
id: sigstore-python
@@ -138,10 +157,14 @@ jobs:
138157
[[ -f ./test/artifact.txt.sigstore.json ]] || exit 1
139158
140159
selftest-glob:
160+
permissions:
161+
id-token: write
141162
runs-on: ubuntu-latest
142163
if: (github.event_name != 'pull_request') || !github.event.pull_request.head.repo.fork
143164
steps:
144165
- uses: actions/checkout@v4
166+
with:
167+
persist-credentials: false
145168
- name: Sign artifacts and publish signatures
146169
uses: ./
147170
id: sigstore-python
@@ -156,12 +179,16 @@ jobs:
156179
[[ -f ./test/artifact2.txt.sigstore.json ]] || exit 1
157180
158181
selftest-xfail-glob-input-expansion:
182+
permissions:
183+
id-token: write
159184
runs-on: ubuntu-latest
160185
env:
161186
TEST_DIR: test
162187
if: (github.event_name != 'pull_request') || !github.event.pull_request.head.repo.fork
163188
steps:
164189
- uses: actions/checkout@v4
190+
with:
191+
persist-credentials: false
165192
- name: Sign artifacts and publish signatures
166193
continue-on-error: true
167194
uses: ./
@@ -182,10 +209,14 @@ jobs:
182209
[[ "${XFAIL}" == "true" ]] || { >&2 echo "expected step to fail"; exit 1; }
183210
184211
selftest-glob-multiple:
212+
permissions:
213+
id-token: write
185214
runs-on: ubuntu-latest
186215
if: (github.event_name != 'pull_request') || !github.event.pull_request.head.repo.fork
187216
steps:
188217
- uses: actions/checkout@v4
218+
with:
219+
persist-credentials: false
189220
- name: Sign artifacts and publish signatures
190221
uses: ./
191222
id: sigstore-python
@@ -205,10 +236,14 @@ jobs:
205236
[[ -f ./test/subdir/hello3.txt.sigstore.json ]] || exit 1
206237
207238
selftest-upload-artifacts:
239+
permissions:
240+
id-token: write
208241
runs-on: ubuntu-latest
209242
if: (github.event_name != 'pull_request') || !github.event.pull_request.head.repo.fork
210243
steps:
211244
- uses: actions/checkout@v4
245+
with:
246+
persist-credentials: false
212247
- name: Sign artifact and publish signature
213248
uses: ./
214249
id: sigstore-python
@@ -228,10 +263,14 @@ jobs:
228263
working-directory: ./test/uploaded
229264

230265
selftest-verify:
266+
permissions:
267+
id-token: write
231268
runs-on: ubuntu-latest
232269
if: (github.event_name != 'pull_request') || !github.event.pull_request.head.repo.fork
233270
steps:
234271
- uses: actions/checkout@v4
272+
with:
273+
persist-credentials: false
235274
- name: Sign artifact and publish signature
236275
uses: ./
237276
id: sigstore-python
@@ -244,6 +283,8 @@ jobs:
244283
internal-be-careful-debug: true
245284

246285
selftest-xfail-verify-missing-options:
286+
permissions:
287+
id-token: write
247288
runs-on: ubuntu-latest
248289
strategy:
249290
matrix:
@@ -268,6 +309,8 @@ jobs:
268309
if: (github.event_name != 'pull_request') || !github.event.pull_request.head.repo.fork
269310
steps:
270311
- uses: actions/checkout@v4
312+
with:
313+
persist-credentials: false
271314
- name: Sign artifact and publish signature
272315
continue-on-error: true
273316
uses: ./
@@ -290,10 +333,14 @@ jobs:
290333
[[ "${XFAIL}" == "true" ]] || { >&2 echo "expected step to fail"; exit 1; }
291334
292335
selftest-identity-token:
336+
permissions:
337+
id-token: write
293338
runs-on: ubuntu-latest
294339
if: (github.event_name != 'pull_request') || !github.event.pull_request.head.repo.fork
295340
steps:
296341
- uses: actions/checkout@v4
342+
with:
343+
persist-credentials: false
297344
- name: Get OIDC token
298345
id: get-oidc-token
299346
run: |

.github/workflows/semgrep.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ name: Semgrep
1212
jobs:
1313
semgrep:
1414
name: Scan
15-
runs-on: ubuntu-20.04
15+
runs-on: ubuntu-latest
1616
env:
1717
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
1818
container:
19-
image: returntocorp/semgrep
19+
image: semgrep/semgrep
20+
2021
steps:
21-
- uses: actions/checkout@v4
22-
- run: semgrep ci
22+
- uses: actions/checkout@v4
23+
with:
24+
persist-credentials: false
25+
- run: semgrep ci

.github/workflows/zizmor.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: GitHub Actions Security Analysis with zizmor 🌈
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["**"]
8+
9+
jobs:
10+
zizmor:
11+
name: zizmor latest via PyPI
12+
runs-on: ubuntu-latest
13+
permissions:
14+
security-events: write
15+
# required for workflows in private repositories
16+
contents: read
17+
actions: read
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
with:
22+
persist-credentials: false
23+
24+
- name: Install the latest version of uv
25+
uses: astral-sh/setup-uv@v5
26+
27+
- name: Run zizmor 🌈
28+
run: uvx zizmor --format sarif . > results.sarif
29+
env:
30+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Upload SARIF file
33+
uses: github/codeql-action/upload-sarif@v3
34+
with:
35+
sarif_file: results.sarif
36+
category: zizmor

0 commit comments

Comments
 (0)