Skip to content

Commit 3cc9419

Browse files
authored
Introduce zizmor (#605)
* Introduce zizmor * harden workflows
1 parent c3596e4 commit 3cc9419

File tree

3 files changed

+49
-4
lines changed

3 files changed

+49
-4
lines changed

‎.github/workflows/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919

2020
steps:
2121
- uses: "actions/checkout@v4"
22+
with:
23+
persist-credentials: false
2224

2325
- uses: "pdm-project/setup-pdm@v4"
2426
with:
@@ -48,6 +50,8 @@ jobs:
4850

4951
steps:
5052
- uses: "actions/checkout@v4"
53+
with:
54+
persist-credentials: false
5155

5256
- uses: "actions/setup-python@v5"
5357
with:
@@ -104,6 +108,8 @@ jobs:
104108

105109
steps:
106110
- uses: "actions/checkout@v4"
111+
with:
112+
persist-credentials: false
107113
- uses: "pdm-project/setup-pdm@v4"
108114
with:
109115
python-version: "3.12"

‎.github/workflows/pypi-package.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ on:
1010
- published
1111
workflow_dispatch:
1212

13-
permissions:
14-
contents: read
15-
id-token: write
16-
1713
jobs:
1814
build-package:
1915
name: Build & verify package
@@ -23,6 +19,7 @@ jobs:
2319
- uses: actions/checkout@v4
2420
with:
2521
fetch-depth: 0
22+
persist-credentials: false
2623

2724
- uses: hynek/build-and-inspect-python-package@v1
2825

@@ -33,6 +30,8 @@ jobs:
3330
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
3431
runs-on: ubuntu-latest
3532
needs: build-package
33+
permissions:
34+
id-token: write
3635

3736
steps:
3837
- name: Download packages built by build-and-inspect-python-package
@@ -53,6 +52,8 @@ jobs:
5352
if: github.event.action == 'published'
5453
runs-on: ubuntu-latest
5554
needs: build-package
55+
permissions:
56+
id-token: write
5657

5758
steps:
5859
- name: Download packages built by build-and-inspect-python-package

‎.github/workflows/zizmor.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# https://github.com/woodruffw/zizmor
2+
name: Zizmor
3+
4+
on:
5+
push:
6+
branches: ["main"]
7+
pull_request:
8+
branches: ["*"]
9+
10+
permissions:
11+
contents: read
12+
13+
14+
jobs:
15+
zizmor:
16+
name: Zizmor latest via Cargo
17+
runs-on: ubuntu-latest
18+
permissions:
19+
security-events: write
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
with:
24+
persist-credentials: false
25+
- name: Setup Rust
26+
uses: actions-rust-lang/setup-rust-toolchain@v1
27+
- name: Get zizmor
28+
run: cargo install zizmor
29+
- name: Run zizmor
30+
run: zizmor --format sarif . > results.sarif
31+
- name: Upload SARIF file
32+
uses: github/codeql-action/upload-sarif@v3
33+
with:
34+
# Path to SARIF file relative to the root of the repository
35+
sarif_file: results.sarif
36+
# Optional category for the results
37+
# Used to differentiate multiple results for one commit
38+
category: zizmor

0 commit comments

Comments
 (0)