You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: cache-poisoning false positive for Swatinem/rust-cache with save-if #2051
I have looked through both the open and closed issues for a duplicate report.
zizmor version
1.23.1
Expected behavior
Swatinem/rust-cache with save-if: ${{ github.event_name != 'pull_request' }} should not trigger cache-poisoning, since save-if: false prevents cache writes entirely — the same mitigation as lookup-only: true but less restrictive (cache restoration still works on PRs for build speed).
Actual behavior
zizmor flags the step as cache-poisoning regardless of the save-if value. Looking at cache_poisoning.rs, the Swatinem/rust-cacheActionCoordinate only registers lookup-only as the control field:
Running zizmor on this workflow reports a cache-poisoning finding on the Swatinem/rust-cache step, despite save-if preventing cache writes on PR events.
Suggested fix
Add save-if as a second recognized control field for Swatinem/rust-cache in cache_poisoning.rs, as an OptOut boolean toggle (when save-if: false, no cache is written — same effect as lookup-only: true for the poisoning vector).
I'm actually not sure this is a false positive: disabling cache saving is not equivalent to disabling cache restoration, since GitHub Actions has no concept of "provenance" when restoring cache entries.
In other words: disabling saves via save-if prevents Swatinem/rust-cacheitself from saving to the cache, but any other action can still compromise the cache restore step by predicting the cache key that Swatinem/rust-cachewill restore from. This is trivial in practice, since cache keys are (1) fully controlled but the client side, and (2) are fully public information (e.g. are typically a pure function of repository state visible to an attacker).
TL;DR: loading, not saving, is the more relevant action for cache poisoning, since it's difficult for zizmor to statically demonstrate the security of cache save operation everywhere in your CI/CD (particularly when cache writes can be deeply nested inside called actions). Consequently we rely on being able to prove that "release-shaped" workflows don't load from cache. I strongly recommend using lookup-only: true (or one of the heuristics we support, see #1954 and #2050) if you want to protect release-shaped workflows from cache poisoning.
hi @woodruffw thanks for the reply! that totally makes sense, I think my initial understanding of this was a little backwards. I've switched to lookup-only: true to for our release workflow and will close this out, thanks again for the explanation!
Activity
fix(ci): add zizmor config, start minio for e2e, revert inline ignores
chore(ci): remove zizmor.yml, dismiss alerts via API instead
fix(ci): add zizmor config, start minio for e2e, revert inline ignores
chore(ci): remove zizmor.yml, dismiss alerts via API instead
woodruffw commentedon May 23, 2026
Hi @wpfleger96, thanks for opening an issue.
I'm actually not sure this is a false positive: disabling cache saving is not equivalent to disabling cache restoration, since GitHub Actions has no concept of "provenance" when restoring cache entries.
In other words: disabling saves via
save-ifpreventsSwatinem/rust-cacheitself from saving to the cache, but any other action can still compromise the cache restore step by predicting the cache key thatSwatinem/rust-cachewill restore from. This is trivial in practice, since cache keys are (1) fully controlled but the client side, and (2) are fully public information (e.g. are typically a pure function of repository state visible to an attacker).TL;DR: loading, not saving, is the more relevant action for cache poisoning, since it's difficult for zizmor to statically demonstrate the security of cache save operation everywhere in your CI/CD (particularly when cache writes can be deeply nested inside called actions). Consequently we rely on being able to prove that "release-shaped" workflows don't load from cache. I strongly recommend using
lookup-only: true(or one of the heuristics we support, see #1954 and #2050) if you want to protect release-shaped workflows from cache poisoning.wpfleger96 commentedon May 25, 2026
hi @woodruffw thanks for the reply! that totally makes sense, I think my initial understanding of this was a little backwards. I've switched to
lookup-only: trueto for our release workflow and will close this out, thanks again for the explanation!woodruffw commentedon May 25, 2026
No problem!
Pin and modernize GitHub Actions references (#2824)
ci: quote the cache-usage step's run as a block scalar
ci: run the simulation evidence in the Linux workspace archive job
ci: create the archive directory before nextest writes into it
ci: GitHub-hosted runners, build once and shard, caching fixed (provi…