Skip to content

Commit e522f47

Browse files
committed
GHA/checksrc: check GHA rules with zizmor
The pedantic level is experimental. If it causes issues, we may just disable it alongside the ignore comments. Also: - silence error: ``` INFO audit: zizmor: completed label.yml error[dangerous-triggers]: use of fundamentally insecure workflow trigger --> label.yml:13:1 | 13 | 'on': [pull_request_target] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ pull_request_target is almost always used insecurely | = note: audit confidence -> Medium ``` - fix pedantic warning: ``` INFO audit: zizmor: completed label.yml warning[excessive-permissions]: overly broad permissions --> label.yml:1:1 ... | 24 | | with: 25 | | repo-token: '${{ secrets.GITHUB_TOKEN }}' | |____________________________________________________- default permissions used due to no permissions: block | = note: audit confidence -> Medium ``` - silence `template-injection` false positives like: ``` - note: ${{ matrix.build.torture && 'test-torture' || 'test-ci' }} may expand into attacker-controllable code - note: ${{ contains(matrix.build.install_steps, 'pytest') && 'caddy httpd vsftpd' || '' }} may expand into attacker-controllable code ``` It doesn't seem like these could be controlled by an attacker. Let me know if I'm missing something. Closes #17278
1 parent 283ad5c commit e522f47

5 files changed

Lines changed: 23 additions & 2 deletions

File tree

.github/workflows/checksrc.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,18 @@ jobs:
117117
run: |
118118
grep -Ev '(\\bwill| url | dir )' .github/scripts/badwords.txt | \
119119
.github/scripts/badwords.pl $(git ls-files -- src lib include)
120+
121+
ghacheck:
122+
name: GHA analysis
123+
runs-on: macos-latest
124+
timeout-minutes: 1
125+
steps:
126+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
127+
with:
128+
persist-credentials: false
129+
name: checkout
130+
131+
- name: zizmor
132+
run: |
133+
brew install zizmor
134+
zizmor --pedantic .github/workflows/*.yml

.github/workflows/label.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
# https://github.com/actions/labeler
1111

1212
name: Labeler
13-
'on': [pull_request_target]
13+
'on': [pull_request_target] # zizmor: ignore[dangerous-triggers]
14+
15+
permissions: {}
1416

1517
jobs:
1618
label:
17-
1819
runs-on: ubuntu-latest
1920
permissions:
2021
contents: read

.github/workflows/linux.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ jobs:
298298
steps:
299299
- name: 'install prereqs'
300300
if: matrix.build.container == null && !contains(matrix.build.name, 'i686')
301+
# zizmor: ignore[template-injection]
301302
run: |
302303
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
303304
sudo apt-get -o Dpkg::Use-Pty=0 update
@@ -661,6 +662,7 @@ jobs:
661662
- name: 'run tests'
662663
if: ${{ !contains(matrix.build.install_steps, 'skipall') && !contains(matrix.build.install_steps, 'skiprun') }}
663664
timeout-minutes: ${{ contains(matrix.build.install_packages, 'valgrind') && 30 || 15 }}
665+
# zizmor: ignore[template-injection]
664666
run: |
665667
export TFLAGS='${{ matrix.build.tflags }}'
666668
if [ -z '${{ matrix.build.torture }}' ]; then

.github/workflows/macos.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ jobs:
183183
# Run this command with retries because of spurious failures seen
184184
# while running the tests, for example
185185
# https://github.com/curl/curl/runs/4095721123?check_suite_focus=true
186+
# zizmor: ignore[template-injection]
186187
run: |
187188
echo ${{ matrix.build.generate && 'ninja' || 'automake libtool' }} \
188189
pkgconf libpsl libssh2 \
@@ -311,6 +312,7 @@ jobs:
311312
- name: 'run tests'
312313
if: ${{ !matrix.build.clang-tidy }}
313314
timeout-minutes: ${{ matrix.build.torture && 20 || 10 }}
315+
# zizmor: ignore[template-injection]
314316
run: |
315317
export TFLAGS='-j20 ${{ matrix.build.tflags }}'
316318
if [ -z '${{ matrix.build.torture }}' ]; then

.github/workflows/windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ jobs:
572572
steps:
573573
- name: 'install packages'
574574
timeout-minutes: 5
575+
# zizmor: ignore[template-injection]
575576
run: |
576577
sudo rm -f /var/lib/man-db/auto-update
577578
sudo apt-get -o Dpkg::Use-Pty=0 install mingw-w64 \

0 commit comments

Comments
 (0)