CI: Add zizmor workflow audit for unpinned actions#15757
CI: Add zizmor workflow audit for unpinned actions#15757kevinjqliu wants to merge 3 commits intoapache:mainfrom
Conversation
| # compromised or force-pushed tag, allowing arbitrary code execution | ||
| # in CI. Pinning to a full commit SHA makes the reference immutable. | ||
| run: | | ||
| findings=$(uvx --from zizmor zizmor \ |
There was a problem hiding this comment.
This isn't the prettiest, but it does isolate the unpinned-use error
There was a problem hiding this comment.
why don't we want to do the "security-events" write ?
There was a problem hiding this comment.
we will eventually. This is just gate regression for 1 specific issue (unpinned-uses)
we already fixed it in #15707
|
once we burn down the warnings from zizmor, we can enforce everything using the zizmor github action (https://github.com/marketplace/actions/zizmor-action) |
|
the fact the zizmor found an unpinned reference is a successful test run: it shows it works |
| findings=$(uvx --from zizmor zizmor \ | ||
| --offline \ | ||
| --format json-v1 \ | ||
| .github/workflows 2>/dev/null \ |
There was a problem hiding this comment.
Nit: 2>/dev/null hides errors, if zizmor fails to run, $findings will be empty and the check will silently pass. Maybe remove it or check the exit code first?
| | jq -r ' | ||
| [ | ||
| .[] | ||
| | select(.ident == "unpinned-uses") |
There was a problem hiding this comment.
should we include all items with high severity and high confidence?
"confidence": "High",
"severity": "High",
Or is unpinned-uses just the first step?
|
superseded by #15793 |
Part of #15742
We've already moved all references to pinned commit hash in #15753
This adds a CI workflow that uses zizmor to detect unpinned third-party GitHub Actions in workflow files.
Future violations will trigger this CI to fail.
Problem
Actions referenced by mutable tag (e.g.
actions/checkout@v4) can be silently replaced by a compromised or force-pushed tag, allowing arbitrary code execution inside CI. Alluses:references should be pinned to a full commit SHA to make them immutable and auditable.Solution
Add a
zizmor.ymlworkflow that:.github/workflows/**unpinned-usesfindingsTesting
Ran CI on forked repo w/ a tagged pin, kevinjqliu#14
Fails CI ✅ https://github.com/kevinjqliu/iceberg/actions/runs/23516762295/job/68450916216?pr=14