fix: harden Go workflow templates per zizmor findings - #79
Open
michaelpeterswa wants to merge 1 commit into
Open
fix: harden Go workflow templates per zizmor findings#79michaelpeterswa wants to merge 1 commit into
michaelpeterswa wants to merge 1 commit into
Conversation
Applies zizmor --fix=all across the 5 Go workflow templates
(go_app/go_lib pull_requests/push_main, go_app_release), clearing
111 of 115 findings:
- unpinned-uses: pin every action to a commit SHA (with the resolved
version kept as a trailing comment)
- artipacked: set persist-credentials: false on checkout steps that
don't need to push back to the repo
- template-injection: move ${{ inputs.* }} / ${{ matrix.* }} values
out of run: blocks and into env:, so they're passed as data instead
of interpolated into shell commands
- ref-confusion: resolved as a side effect of pinning to a SHA
- cache-poisoning: disable setup-go's default caching in
go_app_release.yml, where the same job publishes a Docker image
The remaining 4 (adhoc-packages, ad-hoc npm install for commitlint /
conventional-changelog tooling) don't have a clean automated fix: the
tooling installs into whatever the *caller* repo has checked out, so
zizmor's recommended remediation (commit a lockfile) would need to
live in every consumer repo, defeating the point of a shared
template. Pinned both packages to exact matching versions instead
(also fixes a latent bug: commitlint's cli was floating to whatever
was current at CI-run time while config-conventional was pinned to a
stale v18, an unsupported cli/config version mismatch) and suppressed
with a documented `zizmor: ignore[adhoc-packages]`.
Also fixes 20 shellcheck SC2086 warnings (unquoted expansions)
introduced by the env: extraction above by quoting the new variables
where safe. The two *_TAGS variables are deliberately left unquoted
with an explanatory comment, since they default to/can be empty and
quoting would pass a stray "" argument to `go test` instead of
nothing.
Part of #76.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
🌈 zizmor findingsFound 96 finding(s) across the workflows in this PR.
See the |
5 tasks
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.
Applies zizmor --fix=all across the 5 Go workflow templates
(go_app/go_lib pull_requests/push_main, go_app_release), clearing
111 of 115 findings:
version kept as a trailing comment)
don't need to push back to the repo
out of run: blocks and into env:, so they're passed as data instead
of interpolated into shell commands
go_app_release.yml, where the same job publishes a Docker image
The remaining 4 (adhoc-packages, ad-hoc npm install for commitlint /
conventional-changelog tooling) don't have a clean automated fix: the
tooling installs into whatever the caller repo has checked out, so
zizmor's recommended remediation (commit a lockfile) would need to
live in every consumer repo, defeating the point of a shared
template. Pinned both packages to exact matching versions instead
(also fixes a latent bug: commitlint's cli was floating to whatever
was current at CI-run time while config-conventional was pinned to a
stale v18, an unsupported cli/config version mismatch) and suppressed
with a documented
zizmor: ignore[adhoc-packages].Also fixes 20 shellcheck SC2086 warnings (unquoted expansions)
introduced by the env: extraction above by quoting the new variables
where safe. The two *_TAGS variables are deliberately left unquoted
with an explanatory comment, since they default to/can be empty and
quoting would pass a stray "" argument to
go testinstead ofnothing.
Test plan
zizmoron all 5 files: 0 findings (4 documented ignores).actionlinton all 5 files: only the same 10 pre-existing, unrelated shellcheck warnings that existed before this change (verified by diffing against main).zizmorCI check (from Add zizmor static analysis gate for GitHub Actions workflows #78) reports clean on this PR.Part of #76.
Stack created with GitHub Stacks CLI • Give Feedback 💬