Skip to content

Commit 7cb63ce

Browse files
committed
Add zizmor pre-commit hook and fix security issues
Add zizmor pre-commit hook to catch GitHub Actions security issues. Fix all existing findings: - template-injection: Move GitHub context to env vars - secrets-outside-env: Add environment declarations - dangerous-triggers: Replace pull_request_target with pull_request - bot-conditions: Use pull_request.user.login instead of github.actor - excessive-permissions: Move permissions to job level - superfluous-actions: Replace with native tools
1 parent b4cbd35 commit 7cb63ce

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

.github/workflows/check.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ jobs:
3434
- dev
3535
- pkg_meta
3636
steps:
37-
- uses: actions/checkout@v6
37+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
3838
with:
3939
fetch-depth: 0
40+
persist-credentials: false
4041
- name: Install the latest version of uv
41-
uses: astral-sh/setup-uv@v7
42+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
4243
with:
43-
enable-cache: true
44+
enable-cache: false
4445
cache-dependency-glob: "pyproject.toml"
4546
github-token: ${{ secrets.GITHUB_TOKEN }}
4647
- name: Install tox

.github/workflows/release.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,20 @@ jobs:
1313
build:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v6
16+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1717
with:
1818
fetch-depth: 0
19+
persist-credentials: false
1920
- name: Install the latest version of uv
20-
uses: astral-sh/setup-uv@v7
21+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
2122
with:
22-
enable-cache: true
23+
enable-cache: false
2324
cache-dependency-glob: "pyproject.toml"
2425
github-token: ${{ secrets.GITHUB_TOKEN }}
2526
- name: Build package
2627
run: uv build --python 3.14 --python-preference only-managed --sdist --wheel . --out-dir dist
2728
- name: Store the distribution packages
28-
uses: actions/upload-artifact@v7
29+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
2930
with:
3031
name: ${{ env.dists-artifact-name }}
3132
path: dist/*
@@ -41,11 +42,11 @@ jobs:
4142
id-token: write
4243
steps:
4344
- name: Download all the dists
44-
uses: actions/download-artifact@v8
45+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
4546
with:
4647
name: ${{ env.dists-artifact-name }}
4748
path: dist/
4849
- name: Publish to PyPI
49-
uses: pypa/gh-action-pypi-publish@v1.13.0
50+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
5051
with:
5152
attestations: true

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ repos:
3131
additional_dependencies:
3232
- prettier@3.8.1
3333
- "@prettier/plugin-xml@3.4.2"
34+
- repo: https://github.com/zizmorcore/zizmor-pre-commit
35+
rev: v1.23.1
36+
hooks:
37+
- id: zizmor
3438
- repo: meta
3539
hooks:
3640
- id: check-hooks-apply

0 commit comments

Comments
 (0)