fix(ci): resolve template injection and ref-version-mismatch findings#1502
Merged
stevebeattie merged 3 commits intomainfrom May 4, 2026
Merged
fix(ci): resolve template injection and ref-version-mismatch findings#1502stevebeattie merged 3 commits intomainfrom
stevebeattie merged 3 commits intomainfrom
Conversation
Move ${{ context }} expressions to env: variables to prevent shell injection.
Refs: PSEC-923
Add .github/zizmor.yml to configure dependabot cooldown and disable pedantic-only rules with no security value (anonymous-definition, undocumented-permissions, concurrency-limits). Switch zizmor CI to pedantic persona to catch all template expansions in run: blocks. Extend trigger paths to include .github/zizmor.yml and .github/dependabot.yml so config changes also run the check. Refs: PSEC-923
Resolves 6 ref-version-mismatch zizmor findings by annotating SHA-pinned action refs with their corresponding version: - chainguard-dev/actions@0cba302 (5 occurrences): add # main (this action tracks the rolling main branch; no semver tags are published) - dtolnay/rust-toolchain@e97e2d8: add # v1 Refs: PSEC-923
| - name: Install Rust for yara-x-capi | ||
| if: steps.yara-x-capi.outputs.cache-hit != 'true' | ||
| uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 | ||
| uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1 |
Member
Author
There was a problem hiding this comment.
No change here in the action used, only added a tag comment to match the commit hash. The cover letter mentions that this is an optional thing to address.
| tuf-repo-cdn.sigstore.dev:443 | ||
|
|
||
| - uses: chainguard-dev/actions/setup-gitsign@4a81273c8653122cf4e48cc248f9073b660c5e6d | ||
| - uses: chainguard-dev/actions/setup-gitsign@4a81273c8653122cf4e48cc248f9073b660c5e6d # main |
| octo-sts.dev:443 | ||
| release-assets.githubusercontent.com:443 | ||
| - uses: chainguard-dev/actions/setup-gitsign@4a81273c8653122cf4e48cc248f9073b660c5e6d | ||
| - uses: chainguard-dev/actions/setup-gitsign@4a81273c8653122cf4e48cc248f9073b660c5e6d # main |
| apk add bash curl findutils gh git gnutar ${{ env.GO_RELEASE }} nodejs perl upx xz yara-x~${{ env.YARA_X_RELEASE }} | ||
| - uses: chainguard-dev/actions/setup-gitsign@4a81273c8653122cf4e48cc248f9073b660c5e6d | ||
| apk add bash curl findutils gh git gnutar "${GO_RELEASE}" nodejs perl upx xz "yara-x~${YARA_X_RELEASE}" | ||
| - uses: chainguard-dev/actions/setup-gitsign@4a81273c8653122cf4e48cc248f9073b660c5e6d # main |
| tuf-repo-cdn.sigstore.dev:443 | ||
|
|
||
| - uses: chainguard-dev/actions/setup-gitsign@4a81273c8653122cf4e48cc248f9073b660c5e6d | ||
| - uses: chainguard-dev/actions/setup-gitsign@4a81273c8653122cf4e48cc248f9073b660c5e6d # main |
| release-assets.githubusercontent.com:443 | ||
| tuf-repo-cdn.sigstore.dev:443 | ||
| - uses: chainguard-dev/actions/setup-gitsign@4a81273c8653122cf4e48cc248f9073b660c5e6d | ||
| - uses: chainguard-dev/actions/setup-gitsign@4a81273c8653122cf4e48cc248f9073b660c5e6d # main |
egibs
approved these changes
May 4, 2026
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.
Ticket: PSEC-923
Date: 2026-05-03
Patches: 3
Summary
This patch series addresses GitHub Actions security findings in
chainguard-dev/malcontentas part of the PSEC-923 systematic hardening campaign across Chainguard public repositories.
Patch 0001 — fix(ci): resolve template injection findings
Fixes 18
template-injectionfindings (zizmor pedantic persona) across 6 workflow filesby moving
${{ context }}template expressions out ofrun:blocks and intoenv:variables or using the shell variables that the workflow-level
env:block already exports.Files changed:
.github/workflows/codeql.yaml—${{ github.workspace }}in "Build yara-x-capi" stepmoved to
env: WORKSPACE:and referenced as"${WORKSPACE}"in the run block..github/workflows/fuzz.yaml—${{ env.GO_RELEASE }}and${{ env.YARA_X_RELEASE }}replaced with shell variable references
"${GO_RELEASE}"and"yara-x~${YARA_X_RELEASE}";${{ matrix.target.test }}and${{ matrix.target.package }}moved toenv: FUZZ_TARGET:and
env: FUZZ_PACKAGE:in the "Run fuzzer" step..github/workflows/go-tests.yaml— sameenv.GO_RELEASE/env.YARA_X_RELEASEfix inboth the
testandintegrationjob "Install dependencies" steps..github/workflows/style.yaml— same fix in thegolangci-lintjob "Install dependencies"..github/workflows/third-party.yaml— same fix in "Install dependencies"..github/workflows/update-yara-x.yaml—${{ github.repository }}moved toenv: REPOSITORY:in the "Check for new yara-x version" step.Note on
env.*fixes: The${{ env.GO_RELEASE }}and${{ env.YARA_X_RELEASE }}expressions appear in container-job
apk addlines. Since these are workflow-levelenv:variables, they are already exported to the shell environment as
$GO_RELEASEand$YARA_X_RELEASE. The fix simply removes the template expression and uses the shellvariables directly — no functional change.
Patch 0002 — fix(ci): add pedantic persona and suppress noisy zizmor rules
.github/zizmor.ymlwith:dependabot-cooldownconfigured to 3 daysanonymous-definition,undocumented-permissions,concurrency-limitsdisabled(pedantic-only rules with no security impact)
.github/workflows/zizmor.yaml:persona: pedanticto thezizmorcore/zizmor-actionstep so CI catches allrun:block template expansions going forwardpaths:triggers to include.github/zizmor.ymland.github/dependabot.ymlso changes to those files also trigger the workflow check
Patch 0003 — fix(ci): add missing version comments to SHA-pinned action refs
Resolves 6
ref-version-mismatchzizmor findings by annotating SHA-pinned action refswith their corresponding version:
chainguard-dev/actions/setup-gitsign@4a81273c(5 occurrences acrossdigestabot.yaml,release.yaml,update-yara-x.yaml,version.yaml,third-party.yaml): add# main.This action tracks the rolling
mainbranch; no semver tags are published.dtolnay/rust-toolchain@e97e2d8incodeql.yaml: add# v1.Two additional
ref-version-mismatchfindings (chainguard-dev/actions/gofmtandchainguard-dev/actions/goimports) already had# maincomments and needed no change.Note:
step-security/harden-runnerwas at v2.19.0 when this series was drafted;dependabot bumped it to v2.19.1 upstream before this PR landed, so that update
is not included.
Findings not addressed in this series
dtolnay/rust-toolchainincodeql.yaml— zizmor suggestsreplacing with native
rustup, but the action provides additional conveniences and thesecurity improvement is marginal. Left for repo owners to decide.
concurrency-limits, 11anonymous-definition, 8undocumented-permissions,2
dependabot-cooldown— suppressed via.github/zizmor.yml(pedantic-only, nosecurity impact).
Testing notes
git am 0001-*.patch 0002-*.patch 0003-*.patchapk add "${GO_RELEASE}"and"yara-x~${YARA_X_RELEASE}"work correctly in thecontainer jobs (the workflow-level env vars are passed into the container environment)
go test -fuzz="^${FUZZ_TARGET}$"pattern matches correctly"${WORKSPACE}/yara-x"path resolves correctlyzizmor --persona=pedantic .github/against the patched repo to verify zeroremaining
template-injectionandref-version-mismatchfindings.github/zizmor.ymlRefs: PSEC-923