Skip to content

Commit 08c0fd4

Browse files
authored
fix(ci): address zizmor security findings in workflows (#305)
1 parent 5addfb7 commit 08c0fd4

2 files changed

Lines changed: 36 additions & 18 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
branches:
77
- main
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
test:
1114
runs-on: ubuntu-latest
@@ -15,9 +18,11 @@ jobs:
1518
python: ["3.10", "3.12"]
1619

1720
steps:
18-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
with:
23+
persist-credentials: false
1924
- name: Install uv
20-
uses: astral-sh/setup-uv@v3
25+
uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # v3.2.4
2126
with:
2227
enable-cache: true
2328
- name: Set up Python ${{ matrix.python }}
@@ -35,9 +40,11 @@ jobs:
3540
lint:
3641
runs-on: ubuntu-latest
3742
steps:
38-
- uses: actions/checkout@v3
43+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
44+
with:
45+
persist-credentials: false
3946
- name: Install uv
40-
uses: astral-sh/setup-uv@v3
47+
uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # v3.2.4
4148
with:
4249
enable-cache: true
4350
- name: Set up Python
@@ -55,9 +62,11 @@ jobs:
5562
docs:
5663
runs-on: ubuntu-latest
5764
steps:
58-
- uses: actions/checkout@v3
65+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
66+
with:
67+
persist-credentials: false
5968
- name: Install uv
60-
uses: astral-sh/setup-uv@v3
69+
uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # v3.2.4
6170
with:
6271
enable-cache: true
6372
- name: Set up Python
@@ -69,7 +78,7 @@ jobs:
6978
run: |
7079
mkdir ./docs/build
7180
uv run ./docs/generate.sh --out=./docs/build/ --pypath=src/
72-
- uses: actions/upload-artifact@v4
81+
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
7382
name: Upload Docs Preview
7483
with:
7584
name: reference-docs
@@ -78,9 +87,11 @@ jobs:
7887
format:
7988
runs-on: ubuntu-latest
8089
steps:
81-
- uses: actions/checkout@v3
90+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
91+
with:
92+
persist-credentials: false
8293
- name: Install uv
83-
uses: astral-sh/setup-uv@v3
94+
uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # v3.2.4
8495
with:
8596
enable-cache: true
8697
- name: Set up Python
@@ -90,4 +101,4 @@ jobs:
90101
uv sync
91102
- name: Check Formatting with ruff
92103
run: |
93-
uv run ruff format --check .
104+
uv run ruff format --check .

.github/workflows/release.yaml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ on:
2020
# Allow workflow to be triggered manually.
2121
workflow_dispatch:
2222

23+
permissions:
24+
contents: read
25+
2326
jobs:
2427
stage_release:
2528
# To publish a release, merge the release PR with the label 'release:publish'.
@@ -34,15 +37,17 @@ jobs:
3437

3538
steps:
3639
- name: Checkout source for staging
37-
uses: actions/checkout@v3
40+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41+
with:
42+
persist-credentials: false
3843

3944
- name: Set up Python
40-
uses: actions/setup-python@v4
45+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
4146
with:
4247
python-version: '3.10'
4348

4449
- name: Install uv
45-
uses: astral-sh/setup-uv@v3
50+
uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # v3.2.4
4651
with:
4752
enable-cache: true
4853

@@ -62,7 +67,7 @@ jobs:
6267
# Attach the packaged artifacts to the workflow output. These can be manually
6368
# downloaded for later inspection if necessary.
6469
- name: Archive artifacts
65-
uses: actions/upload-artifact@v4
70+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
6671
with:
6772
name: dist
6873
path: dist/
@@ -92,11 +97,13 @@ jobs:
9297

9398
steps:
9499
- name: Checkout source for publish
95-
uses: actions/checkout@v4
100+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
101+
with:
102+
persist-credentials: false
96103

97104
# Download the artifacts created by the stage_release job.
98105
- name: Download release candidates
99-
uses: actions/download-artifact@v4.1.7
106+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
100107
with:
101108
name: dist
102109
path: dist
@@ -111,7 +118,7 @@ jobs:
111118
- name: Create release tag
112119
# Skip creating a release tag for prereleases
113120
if: (!contains(github.event.pull_request.labels.*.name, 'release:prerelease'))
114-
uses: fleskesvor/create-release@1a72e235c178bf2ae6c51a8ae36febc24568c5fe
121+
uses: fleskesvor/create-release@1a72e235c178bf2ae6c51a8ae36febc24568c5fe # zizmor: ignore[unpinned-uses]
115122
env:
116123
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117124
with:
@@ -122,4 +129,4 @@ jobs:
122129
prerelease: false
123130

124131
- name: Publish to Pypi
125-
uses: pypa/gh-action-pypi-publish@release/v1
132+
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2

0 commit comments

Comments
 (0)