Skip to content

Commit 63c3f8a

Browse files
authored
PYTHON-4959 Adopt zizmor GitHub Actions security scanner (mongodb#2001)
1 parent 5e55282 commit 63c3f8a

File tree

4 files changed

+49
-0
lines changed

4 files changed

+49
-0
lines changed

.github/workflows/codeql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
uses: actions/checkout@v4
4040
with:
4141
ref: ${{ inputs.ref }}
42+
persist-credentials: false
4243
- uses: actions/setup-python@v5
4344

4445
# Initializes the CodeQL tools for scanning.

.github/workflows/dist.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
uses: actions/checkout@v4
4949
with:
5050
fetch-depth: 0
51+
persist-credentials: false
5152
ref: ${{ inputs.ref }}
5253

5354
- uses: actions/setup-python@v5
@@ -106,6 +107,7 @@ jobs:
106107
- uses: actions/checkout@v4
107108
with:
108109
fetch-depth: 0
110+
persist-credentials: false
109111
ref: ${{ inputs.ref }}
110112

111113
- uses: actions/setup-python@v5

.github/workflows/test-python.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- uses: actions/checkout@v4
23+
with:
24+
persist-credentials: false
2325
- uses: actions/setup-python@v5
2426
with:
2527
python-version: "3.9"
@@ -55,6 +57,8 @@ jobs:
5557
name: CPython ${{ matrix.python-version }}-${{ matrix.os }}
5658
steps:
5759
- uses: actions/checkout@v4
60+
with:
61+
persist-credentials: false
5862
- if: ${{ matrix.python-version == '3.13t' }}
5963
name: Setup free-threaded Python
6064
uses: deadsnakes/[email protected]
@@ -99,6 +103,8 @@ jobs:
99103
name: DocTest
100104
steps:
101105
- uses: actions/checkout@v4
106+
with:
107+
persist-credentials: false
102108
- name: Setup Python
103109
uses: actions/setup-python@v5
104110
with:
@@ -121,6 +127,8 @@ jobs:
121127
runs-on: ubuntu-latest
122128
steps:
123129
- uses: actions/checkout@v4
130+
with:
131+
persist-credentials: false
124132
- uses: actions/setup-python@v5
125133
with:
126134
cache: 'pip'
@@ -139,6 +147,8 @@ jobs:
139147
runs-on: ubuntu-latest
140148
steps:
141149
- uses: actions/checkout@v4
150+
with:
151+
persist-credentials: false
142152
- uses: actions/setup-python@v5
143153
with:
144154
cache: 'pip'
@@ -160,6 +170,8 @@ jobs:
160170
python: ["3.9", "3.11"]
161171
steps:
162172
- uses: actions/checkout@v4
173+
with:
174+
persist-credentials: false
163175
- uses: actions/setup-python@v5
164176
with:
165177
python-version: "${{matrix.python}}"
@@ -177,6 +189,8 @@ jobs:
177189
name: "Make an sdist"
178190
steps:
179191
- uses: actions/checkout@v4
192+
with:
193+
persist-credentials: false
180194
- uses: actions/setup-python@v5
181195
with:
182196
cache: 'pip'

.github/workflows/zizmor.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: GitHub Actions Security Analysis with zizmor 🌈
2+
3+
on:
4+
push:
5+
branches: ["master"]
6+
pull_request:
7+
branches: ["**"]
8+
9+
jobs:
10+
zizmor:
11+
name: zizmor latest via Cargo
12+
runs-on: ubuntu-latest
13+
permissions:
14+
security-events: write
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
persist-credentials: false
20+
- name: Setup Rust
21+
uses: actions-rust-lang/setup-rust-toolchain@v1
22+
- name: Get zizmor
23+
run: cargo install zizmor
24+
- name: Run zizmor 🌈
25+
run: zizmor --format sarif . > results.sarif
26+
env:
27+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
- name: Upload SARIF file
29+
uses: github/codeql-action/upload-sarif@v3
30+
with:
31+
sarif_file: results.sarif
32+
category: zizmor

0 commit comments

Comments
 (0)