Skip to content

Commit 5200de8

Browse files
authored
ci: harden workflows (#345)
* ci: harden workflows This hash-pins all of our workflows and fixes some (low-impact) zizmor findings. It also adds a `zizmor` workflow that'll run on pushes and PRs to prevent issues from sneaking in. Signed-off-by: William Woodruff <[email protected]> * ci: zizmor: fix hash pin See stacklok/frizbee#206. Signed-off-by: William Woodruff <[email protected]> --------- Signed-off-by: William Woodruff <[email protected]>
1 parent 904ff9a commit 5200de8

File tree

3 files changed

+47
-5
lines changed

3 files changed

+47
-5
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ jobs:
1919
contents: write
2020

2121
steps:
22-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
23+
with:
24+
persist-credentials: false
2325

24-
- uses: actions/setup-python@v5
26+
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
2527
with:
2628
python-version: "3.x"
2729

@@ -32,5 +34,5 @@ jobs:
3234
run: python -m build
3335

3436
- name: publish
35-
uses: pypa/gh-action-pypi-publish@release/v1
37+
uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # release/v1
3638

.github/workflows/tests.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ jobs:
2020
os: ["macos-latest", "windows-latest", "ubuntu-latest"]
2121

2222
steps:
23-
- uses: "actions/checkout@v4"
24-
- uses: "actions/setup-python@v5"
23+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
24+
with:
25+
persist-credentials: false
26+
27+
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
2528
with:
2629
python-version: "${{ matrix.python-version }}"
2730
allow-prereleases: true
31+
2832
- name: "Install dependencies"
2933
run: |
3034
python -VV

.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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
21+
with:
22+
persist-credentials: false
23+
24+
- name: Install the latest version of uv
25+
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
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@faa06bd0c3efe9bf73685e4489e70f0f552edc63 # v3
34+
with:
35+
sarif_file: results.sarif
36+
category: zizmor

0 commit comments

Comments
 (0)