Skip to content

Commit a88a6eb

Browse files
ci: Fix GHA security issues flagged by zizmor
Fix security-related issues in our GitHub Actions workflows flagged by the zizmor security linter, and enable zizmor in CI to prevent regressions. Signed-off-by: Peyton Murray <peynmurray@gmail.com>
1 parent a2d9b6b commit a88a6eb

9 files changed

Lines changed: 105 additions & 43 deletions

File tree

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,12 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "daily"
7+
cooldown:
8+
default-days: 7
9+
10+
- package-ecosystem: "docker"
11+
directory: "/"
12+
schedule:
13+
interval: "daily"
14+
cooldown:
15+
default-days: 7

.github/workflows/build_wheels.yml

Lines changed: 53 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Wheels
22

3+
permissions: {}
4+
35
on:
46
push:
57
pull_request:
@@ -19,12 +21,14 @@ jobs:
1921
name: Build source distribution
2022
runs-on: ubuntu-latest
2123
steps:
22-
- uses: actions/checkout@v6
24+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
25+
with:
26+
persist-credentials: false
2327

2428
- name: Build sdist
2529
run: pipx run build --sdist
2630

27-
- uses: actions/upload-artifact@v7
31+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
2832
with:
2933
name: sdist
3034
path: dist/*.tar.gz
@@ -59,19 +63,19 @@ jobs:
5963
- name: Disable ptrace security restrictions
6064
run: |
6165
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
62-
- uses: actions/download-artifact@v8
66+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
6367
with:
6468
name: sdist
6569
- name: Extract sdist
6670
run: |
6771
tar zxvf *.tar.gz --strip-components=1
6872
- name: Build wheels
69-
uses: pypa/cibuildwheel@v3.4.1
73+
uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
7074
env:
7175
CIBW_BUILD: "cp3{9..14}{t,}-${{ matrix.wheel_type }}"
7276
CIBW_ARCHS_LINUX: auto
7377
CIBW_ENABLE: cpython-prerelease cpython-freethreading
74-
- uses: actions/upload-artifact@v7
78+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
7579
with:
7680
name: ${{ matrix.wheel_type }}-wheels
7781
path: ./wheelhouse/*.whl
@@ -84,13 +88,15 @@ jobs:
8488
matrix:
8589
python_version: ["2.7", "3.7"]
8690
steps:
87-
- uses: actions/checkout@v6
88-
- uses: actions/download-artifact@v8
91+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
92+
with:
93+
persist-credentials: false
94+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
8995
with:
9096
name: "manylinux_x86_64-wheels"
9197
path: dist
9298
- name: Set up Python
93-
uses: actions/setup-python@v6
99+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
94100
with:
95101
python-version: '>=3.13'
96102
- name: Set up dependencies
@@ -124,17 +130,20 @@ jobs:
124130
matrix:
125131
python_version: ["3.13"]
126132
steps:
127-
- uses: actions/checkout@v6
128-
- uses: actions/download-artifact@v8
133+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
134+
with:
135+
persist-credentials: false
136+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
129137
with:
130138
name: "manylinux_x86_64-wheels"
131139
path: dist
132140
- name: Install uv
133-
uses: astral-sh/setup-uv@v7
141+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
134142
with:
135143
version: latest
136144
python-version: ${{ matrix.python_version }}
137145
activate-environment: true
146+
enable-cache: false
138147
- name: Set up dependencies
139148
run: |
140149
sudo apt-get update
@@ -159,12 +168,14 @@ jobs:
159168
matrix:
160169
python_version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.13t", "3.14", "3.14t"]
161170
steps:
162-
- uses: actions/checkout@v6
171+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
172+
with:
173+
persist-credentials: false
163174
- name: Set up Python
164-
uses: actions/setup-python@v6
175+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
165176
with:
166177
python-version: "${{matrix.python_version}}-dev"
167-
- uses: actions/download-artifact@v8
178+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
168179
with:
169180
name: "manylinux_x86_64-wheels"
170181
path: dist
@@ -194,12 +205,14 @@ jobs:
194205
matrix:
195206
python_version: ["3.9", "3.13", "3.14"]
196207
steps:
197-
- uses: actions/checkout@v6
208+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
209+
with:
210+
persist-credentials: false
198211
- name: Set up Python
199-
uses: actions/setup-python@v6
212+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
200213
with:
201214
python-version: "${{matrix.python_version}}-dev"
202-
- uses: actions/download-artifact@v8
215+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
203216
with:
204217
name: "manylinux_aarch64-wheels"
205218
path: dist
@@ -232,12 +245,14 @@ jobs:
232245
matrix:
233246
python_version: ["3.13", "3.14"]
234247
steps:
235-
- uses: actions/checkout@v6
248+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
249+
with:
250+
persist-credentials: false
236251
- name: Set up Python
237-
uses: actions/setup-python@v6
252+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
238253
with:
239254
python-version: "${{matrix.python_version}}-dev"
240-
- uses: actions/download-artifact@v8
255+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
241256
with:
242257
name: "manylinux_x86_64-wheels"
243258
path: dist
@@ -278,11 +293,13 @@ jobs:
278293
options: --cap-add=SYS_PTRACE
279294

280295
steps:
281-
- uses: actions/checkout@v6
296+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
297+
with:
298+
persist-credentials: false
282299
- name: Set up dependencies
283300
run: |
284301
apk add --update alpine-sdk bash alpine-sdk python3 python3-dev gdb musl-dbg python3-dbg
285-
- uses: actions/download-artifact@v8
302+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
286303
with:
287304
name: "musllinux_x86_64-wheels"
288305
path: dist
@@ -308,7 +325,9 @@ jobs:
308325
options: --cap-add=SYS_PTRACE
309326

310327
steps:
311-
- uses: actions/checkout@v6
328+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
329+
with:
330+
persist-credentials: false
312331
- name: Set up dependencies
313332
run: |
314333
dnf install -y \
@@ -319,7 +338,7 @@ jobs:
319338
python3-devel
320339
dnf debuginfo-install -y \
321340
python3
322-
- uses: actions/download-artifact@v8
341+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
323342
with:
324343
name: "manylinux_x86_64-wheels"
325344
path: dist
@@ -343,7 +362,9 @@ jobs:
343362
image: archlinux
344363
options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
345364
steps:
346-
- uses: actions/checkout@v6
365+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
366+
with:
367+
persist-credentials: false
347368
- name: Set up dependencies
348369
run: |
349370
pacman -Syu --noconfirm \
@@ -356,7 +377,7 @@ jobs:
356377
python-wheel \
357378
elfutils \
358379
debuginfod
359-
- uses: actions/download-artifact@v8
380+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
360381
with:
361382
name: "manylinux_x86_64-wheels"
362383
path: dist
@@ -383,7 +404,9 @@ jobs:
383404
options: --cap-add=SYS_PTRACE
384405

385406
steps:
386-
- uses: actions/checkout@v6
407+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
408+
with:
409+
persist-credentials: false
387410
- name: Set up dependencies
388411
run: |
389412
apt-get update
@@ -394,7 +417,7 @@ jobs:
394417
python3-pip \
395418
python3-venv \
396419
python3-dbg
397-
- uses: actions/download-artifact@v8
420+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
398421
with:
399422
name: "manylinux_x86_64-wheels"
400423
path: dist
@@ -416,7 +439,7 @@ jobs:
416439
permissions:
417440
id-token: write # Required to retrieve a Trusted Publishing token
418441
steps:
419-
- uses: actions/download-artifact@v8
442+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
420443
with:
421444
# with no name set, it downloads all of the artifacts
422445
path: dist
@@ -425,6 +448,6 @@ jobs:
425448
mv dist/*-wheels/*.whl dist/
426449
rmdir dist/{sdist,*-wheels}
427450
ls -R dist
428-
- uses: pypa/gh-action-pypi-publish@release/v1
451+
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
429452
with:
430453
skip_existing: true

.github/workflows/coverage.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ jobs:
2727
strategy:
2828
fail-fast: false
2929
steps:
30-
- uses: actions/checkout@v6
30+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
31+
with:
32+
persist-credentials: false
3133
- name: Set up Python
32-
uses: actions/setup-python@v6
34+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
3335
with:
3436
python-version: "3.10"
3537
- name: Set up dependencies
@@ -67,13 +69,13 @@ jobs:
6769
lcov --capture --directory build --output-file cppcoverage.lcov
6870
lcov --extract cppcoverage.lcov '*/src/pystack/_pystack/*' --output-file cppcoverage.lcov
6971
- name: Upload Python report to Codecov
70-
uses: codecov/codecov-action@v6
72+
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6
7173
with:
7274
token: ${{ secrets.CODECOV_TOKEN }}
7375
files: pycoverage.lcov
7476
flags: python
7577
- name: Upload C++ report to Codecov
76-
uses: codecov/codecov-action@v6
78+
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6
7779
with:
7880
token: ${{ secrets.CODECOV_TOKEN }}
7981
files: cppcoverage.lcov

.github/workflows/docs.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Publish docs
22

3+
permissions: {}
4+
35
on:
46
push:
57
branches:
@@ -13,9 +15,11 @@ jobs:
1315
permissions:
1416
contents: write
1517
steps:
16-
- uses: actions/checkout@v6
18+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
19+
with:
20+
persist-credentials: false
1721
- name: Set up Python
18-
uses: actions/setup-python@v6
22+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
1923
with:
2024
python-version: "3.10"
2125
- name: Set up dependencies
@@ -32,7 +36,7 @@ jobs:
3236
run: |
3337
make docs
3438
- name: Publish docs to GitHub Pages
35-
uses: JamesIves/github-pages-deploy-action@v4
39+
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4
3640
with:
3741
folder: docs/_build/html
3842
single-commit: true

.github/workflows/lint_and_docs.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
name: Lint and docs
22

3+
permissions: {}
4+
35
on: [push, pull_request]
46

57
jobs:
68
lint_and_docs:
79
runs-on: ubuntu-latest
810
steps:
9-
- uses: actions/checkout@v6
10-
- uses: actions/setup-python@v6
11+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
12+
with:
13+
persist-credentials: false
14+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
1115
with:
1216
python-version: "3.10"
1317
- name: Set up dependencies
@@ -23,7 +27,8 @@ jobs:
2327
- name: Lint sources
2428
run: |
2529
make lint PYTHON=python3
26-
python3 -m prek run --all-files --hook-stage pre-push
30+
- name: Run zizmor 🌈
31+
uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6
2732
- name: Build docs
2833
run: |
2934
towncrier build --version 99.99 --name pystack --keep

.github/workflows/news-check.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
name: News entry check
2+
3+
permissions: {}
4+
25
on:
36
pull_request:
47
paths:
@@ -16,7 +19,7 @@ jobs:
1619
name: Check for news entry
1720
steps:
1821
- name: "Check for news entry"
19-
uses: brettcannon/check-for-changed-files@v1
22+
uses: brettcannon/check-for-changed-files@871d7b8b5917a4f6f06662e2262e8ffc51dff6d1 # v1
2023
with:
2124
file-pattern: |
2225
news/*.rst

.github/workflows/sanity-check.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
name: Sanity check
2+
3+
permissions: {}
4+
25
on:
36
pull_request:
47
types:
@@ -15,10 +18,10 @@ jobs:
1518
steps:
1619
- name: Get PR Commits
1720
id: "get-pr-commits"
18-
uses: tim-actions/get-pr-commits@master
21+
uses: tim-actions/get-pr-commits@198af03565609bb4ed924d1260247b4881f09e7d # master
1922
with:
2023
token: ${{ secrets.GITHUB_TOKEN }}
2124
- name: DCO Check
22-
uses: tim-actions/dco@master
25+
uses: tim-actions/dco@f2279e6e62d5a7d9115b0cb8e837b777b1b02e21 # master
2326
with:
2427
commits: ${{ steps.get-pr-commits.outputs.commits }}

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ RUN apt-get update \
3737
# Stage 2: Final stage
3838
FROM ubuntu:24.04
3939
ARG DEBIAN_FRONTEND=noninteractive
40+
LABEL org.opencontainers.image.source="https://github.com/bloomberg/pystack"
4041

4142
# Install runtime dependencies
4243
RUN apt-get update \

0 commit comments

Comments
 (0)