Skip to content

Commit 9f170aa

Browse files
committed
Add zizmor to CI
- Can't switch release actions to trusted publishing, see #224. - Remove git credentials persistence everywhere. - Fix "unsafe" template expansion in release-builtins. It should not be accessible to any untrusted third party as it's only on `workflow_dispatch` and `schedule`, but it can't hurt. Fixes #249
1 parent e5a1348 commit 9f170aa

File tree

4 files changed

+43
-3
lines changed

4 files changed

+43
-3
lines changed

.github/workflows/ci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
with:
1414
submodules: true
1515
fetch-depth: 0
16+
persist-credentials: false
1617
- name: ruff check
1718
uses: chartboost/ruff-action@v1
1819
- name: ruff format
@@ -46,6 +47,7 @@ jobs:
4647
uses: actions/checkout@v4
4748
with:
4849
submodules: true
50+
persist-credentials: false
4951
- name: Set up Python
5052
uses: actions/setup-python@v5
5153
with:
@@ -104,6 +106,7 @@ jobs:
104106
with:
105107
submodules: true
106108
fetch-depth: 0
109+
persist-credentials: false
107110
- name: Set up Python ${{ matrix.python-version }}
108111
uses: actions/setup-python@v5
109112
with:

.github/workflows/release-builtins.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@ jobs:
2525
with:
2626
submodules: true
2727
fetch-depth: 0
28+
persist-credentials: false
2829
- name: update core
30+
env:
31+
TAG: ${{ inputs.tag || 'master '}}
2932
# needs to detach because we can update to a tag
30-
run: git -C uap-core switch --detach ${{ inputs.tag || 'master' }}
33+
run: git -C uap-core switch --detach "$TAG"
3134
- name: Set up Python
3235
uses: actions/setup-python@v5
3336
with:

.github/workflows/release-main.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
steps:
2323
- name: Checkout working copy
2424
uses: actions/checkout@v4
25+
with:
26+
persist-credentials: false
2527
- name: Set up Python
2628
uses: actions/setup-python@v5
2729
with:
@@ -34,15 +36,15 @@ jobs:
3436
run: python -mbuild
3537
- name: Publish to testpypi
3638
if: ${{ env.ENVNAME == 'testpypi' }}
37-
uses: pypa/gh-action-pypi-publish@release/v1
39+
uses: pypa/gh-action-pypi-publish@release/v1 # zizmor: ignore[use-trusted-publishing]
3840
with:
3941
repository-url: https://test.pypi.org/legacy/
4042
skip-existing: true
4143
verbose: true
4244
password: ${{ secrets.PUBLISH_TOKEN }}
4345
- name: Publish to pypi
4446
if: ${{ env.ENVNAME == 'pypi' }}
45-
uses: pypa/gh-action-pypi-publish@release/v1
47+
uses: pypa/gh-action-pypi-publish@release/v1 # zizmor: ignore[use-trusted-publishing]
4648
with:
4749
verbose: true
4850
password: ${{ secrets.PUBLISH_TOKEN }}

.github/workflows/zizmor.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Zizmor
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
zizmor:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
security-events: write
12+
contents: read
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
persist-credentials: false
19+
20+
- name: Install the latest version of uv
21+
uses: astral-sh/setup-uv@v5
22+
23+
- name: Run zizmor
24+
run: uvx zizmor --format sarif . > results.sarif
25+
env:
26+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Upload SARIF file
29+
uses: github/codeql-action/upload-sarif@v3
30+
with:
31+
sarif_file: results.sarif
32+
category: zizmor

0 commit comments

Comments
 (0)