Skip to content

Commit d8eb059

Browse files
authored
Add zizmor pre-commit hook and fix security issues (#25)
This PR adds the [zizmor](https://github.com/zizmorcore/zizmor-pre-commit) pre-commit hook to catch GitHub Actions security vulnerabilities and fixes all existing findings. ## Changes 1. **Added zizmor pre-commit hook** (v1.23.1) to `.pre-commit-config.yaml` 2. **Fixed all security issues** found by zizmor auto-fix and manual fixes: - `template-injection`: Moved GitHub context expressions to environment variables - `secrets-outside-env`: Added `environment:` declarations to jobs using secrets - `dangerous-triggers`: Replaced `pull_request_target` with `pull_request` - `bot-conditions`: Changed `github.actor` checks to `github.event.pull_request.user.login` - `excessive-permissions`: Moved workflow-level permissions to job-level - `superfluous-actions`: Replaced third-party actions with native tools ## Verification All workflows now pass zizmor security audit with zero errors/warnings. ## Documentation - [zizmor documentation](https://docs.zizmor.sh/) - [zizmor pre-commit hook](https://github.com/zizmorcore/zizmor-pre-commit)
1 parent 1df94c3 commit d8eb059

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

.github/workflows/main.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,28 @@ jobs:
1010
main-uvx:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v6
13+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
14+
with:
15+
persist-credentials: false
1416
- name: self test action (uvx path)
1517
uses: ./
1618
main-uv-run:
1719
runs-on: ubuntu-latest
1820
steps:
19-
- uses: actions/checkout@v6
21+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
22+
with:
23+
persist-credentials: false
2024
- run: printf '[project]\nname = "test"\nversion = "0.0.0"\nrequires-python = ">=3.13"\n' > pyproject.toml
2125
shell: bash
2226
- name: self test action (uv run path)
2327
uses: ./
2428
main-external-uv:
2529
runs-on: ubuntu-latest
2630
steps:
27-
- uses: actions/checkout@v6
28-
- uses: astral-sh/setup-uv@v7
31+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
32+
with:
33+
persist-credentials: false
34+
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
2935
- name: self test action (external uv)
3036
uses: ./
3137
with:

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@ repos:
66
- id: end-of-file-fixer
77
- id: check-yaml
88

9+
- repo: https://github.com/zizmorcore/zizmor-pre-commit
10+
rev: v1.23.1
11+
hooks:
12+
- id: zizmor
913
ci:
1014
autoupdate_schedule: quarterly

0 commit comments

Comments
 (0)