Skip to content

Commit fd8a2f0

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 bd4a5f0 commit fd8a2f0

5 files changed

Lines changed: 18 additions & 10 deletions

File tree

.github/dependabot.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "daily"
7+
cooldown:
8+
default-days: 7

.github/workflows/check.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ jobs:
3131
- dev
3232
- pkg_meta
3333
steps:
34-
- uses: actions/checkout@v6
34+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
3535
with:
3636
fetch-depth: 0
37+
persist-credentials: false
3738
- name: Install the latest version of uv
38-
uses: astral-sh/setup-uv@v7
39+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
3940
with:
40-
enable-cache: true
41+
enable-cache: false
4142
cache-dependency-glob: "pyproject.toml"
4243
github-token: ${{ secrets.GITHUB_TOKEN }}
4344
- 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
@@ -33,6 +33,10 @@ repos:
3333
hooks:
3434
- id: prettier
3535
args: ["--print-width=120", "--prose-wrap=always"]
36+
- repo: https://github.com/zizmorcore/zizmor-pre-commit
37+
rev: v1.23.1
38+
hooks:
39+
- id: zizmor
3640
- repo: meta
3741
hooks:
3842
- id: check-hooks-apply

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ test = [
6060
"pytest-cov>=7",
6161
]
6262
type = [
63-
"ty>=0.0.17",
63+
"ty>=0.0.19,<0.0.25",
6464
{ include-group = "test" },
6565
]
6666
lint = [

0 commit comments

Comments
 (0)