fix: keep the rules checkout out of zizmor's scan scope - #11
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #10, fixing a defect that change introduced.
The problem
#10 delivers
bin/run-zizmor.shby checking this repo out into.cc-security-rulesinside 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: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:
zizmor-blocking: truefails its build on a file it cannot fixThat is a worse version of the silent-misattribution problem #10 set out to fix.
The fix
Stage the script into
RUNNER_TEMPand delete the checkout before scanning:actions/checkoutcan 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:.cc-security-rules/.github/workflows/planted.ymlbin/test-run-zizmor.sh(18 total), pinning that the runner is invoked fromRUNNER_TEMP, that the checkout is removed, and that it is not invoked from inside the checkoutbin/test-detect.sh(17) andbin/test-report-sarif.sh(22) still passactionlintandshellcheckcleanNote
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