Skip to content

fix: keep the rules checkout out of zizmor's scan scope - #11

Merged
arootroatch merged 1 commit into
masterfrom
fix/zizmor-scan-scope
Jul 28, 2026
Merged

fix: keep the rules checkout out of zizmor's scan scope#11
arootroatch merged 1 commit into
masterfrom
fix/zizmor-scan-scope

Conversation

@arootroatch

Copy link
Copy Markdown
Collaborator

Follow-up to #10, fixing a defect that change introduced.

The problem

#10 delivers bin/run-zizmor.sh by checking this repo out into .cc-security-rules inside the consumer's workspace, and zizmor is pointed at .. So this repo's own workflows become audit input for the consumer. The first cleancoders.com run after #10 shows it plainly:

completed ./.cc-security-rules/.github/workflows/security.yml
completed ./.cc-security-rules/.github/workflows/self-test.yml
completed ./.github/workflows/build.yml
...

It is harmless right now — those two workflows are clean, so the consumer's finding count was still 0 — and that is precisely why it would sit unnoticed. The moment a finding lands in one of them:

  • every consumer reports it as its own finding, in a file that is not in its repo
  • any consumer running zizmor-blocking: true fails its build on a file it cannot fix
  • the fix would have to ship here, while the red X sits on their repo

That is a worse version of the silent-misattribution problem #10 set out to fix.

The fix

Stage the script into RUNNER_TEMP and delete the checkout before scanning:

cp .cc-security-rules/bin/run-zizmor.sh "$RUNNER_TEMP/"
rm -rf .cc-security-rules
bash "$RUNNER_TEMP/run-zizmor.sh" zizmor.sarif .

actions/checkout can only write inside the workspace, so staging out and deleting is the way to get the script without it being scan input. This restores the scan scope to exactly what it was before the script existed.

Verification

A clean-vs-clean comparison proves nothing here, since both repos' workflows currently pass. So I planted a workflow with no permissions: block inside a stand-in checkout:

findings attributed to the consumer
before 3 — all in .cc-security-rules/.github/workflows/planted.yml
after 0
  • 3 wiring assertions added to bin/test-run-zizmor.sh (18 total), pinning that the runner is invoked from RUNNER_TEMP, that the checkout is removed, and that it is not invoked from inside the checkout
  • bin/test-detect.sh (17) and bin/test-report-sarif.sh (22) still pass
  • actionlint and shellcheck clean

Note

The end-to-end behaviour from #10 is confirmed working in a real consumer run: the script is invoked, the first attempt aborts on the unreadable uses:, the ::warning:: fires, the retry completes all workflows, and the SARIF has 0 findings — a real 0, not the 0-byte unparseable file from before.

🤖 Generated with Claude Code

The zizmor job gets bin/run-zizmor.sh by checking this repo out into
.cc-security-rules inside the consumer's workspace, and zizmor is pointed at ".".
So this repo's own workflows land in the consumer's scan: a first cleancoders.com
run audited .cc-security-rules/.github/workflows/security.yml and self-test.yml
alongside its own files.

Harmless today because those workflows are clean, which is exactly why it would
go unnoticed. The moment one of them has a finding, every consumer reports it as
its own, and a consumer running zizmor-blocking: true fails on a file it does not
own and cannot fix.

Stage the script into RUNNER_TEMP and delete the checkout before scanning, which
restores the scan scope to what it was before the script existed.

Verified by planting a workflow with no permissions: block inside a stand-in
checkout: 3 findings attributed to the consumer before, 0 after. Three wiring
assertions added to bin/test-run-zizmor.sh (18 total); detect (17) and
report-sarif (22) still pass; actionlint and shellcheck clean.
@arootroatch
arootroatch merged commit 77834e7 into master Jul 28, 2026
10 checks passed
@arootroatch
arootroatch deleted the fix/zizmor-scan-scope branch July 28, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant