Harden GitHub Actions workflows - #83
Merged
Merged
Conversation
- suppress cache-poisoning on release setup-ruby (ref-isolated cache) - suppress unpinned-uses on ruby/actions reusable workflow (@master needed for a current Ruby version matrix)
Deny-all at the workflow level and grant each job only what it needs: lint-actions and test get contents:read; ruby-versions (reusable workflow) and ci-pass need none.
Neither the test job nor the release job needs the persisted checkout token: rubygems/release-gem configures its own git credential cache for the tag push (its README documents persist-credentials: false).
The single push job already declares its own contents:write and
id-token:write, so the workflow-level block can be permissions: {}.
CI runs zizmor v1.23.1, which flags the direct ${{ needs.test.result }}
expansion in the ci-pass run block as template-injection (newer zizmor no
longer does). Move the expression into an env var so the shell reads a plain
variable instead.
flavorjones
force-pushed
the
harden-gh-actions
branch
from
July 13, 2026 12:57
0309263 to
4bc3e26
Compare
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.
This hardens the GitHub Actions workflows against the vulnerability classes that zizmor audits. It handles the cache-poisoning concern differently from #76, see thread in that PR.
Changes
lint-actionsjob inci.ymlruns actionlint and zizmor on every push and pull request, so workflow regressions surface in CI.github-actionsentries independabot.ymlgain a seven-day cooldown, which matches the minimum age used when pinning.pinact. Theruby/actionsruby_versions.ymlreusable workflow stays on@masterso that the Ruby version matrix remains current, and an inline comment records why that reference is not pinned.GITHUB_TOKENpermissions are scoped per job. Both workflows deny all permissions at the top level and grant each job only the permissions it needs.persist-credentials: false. The release job remains correct becauserubygems/release-gemconfigures its own git credential cache for the tag push.Cache poisoning in the release workflow
I kept
bundler-cache: trueinpush_gem.ymland suppressed the zizmorcache-poisoningfinding rather than disabling the cache. GitHub Actions caches are isolated by git ref. A cache created by a pull request lives in therefs/pull/<n>/mergescope and can only be restored by re-runs of that pull request, so nothing a fork or pull request does can reach the cache that this tag-push release build restores. The inline suppression comment records this reasoning.Verification
zizmor reports no findings under both the default and pedantic personas, and actionlint is clean.