Fix: Env-mediate expressions in run blocks - #38
Merged
tykeal merged 1 commit intoJul 28, 2026
Merged
Conversation
Copilot started reviewing on behalf of
ModeSevenIndustrialSolutions
July 28, 2026 10:39
View session
There was a problem hiding this comment.
Pull request overview
This PR mitigates GitHub Actions template-injection risk by ensuring GitHub expressions are not interpolated directly into run: script bodies, instead passing dynamic values via env: and then referencing them as shell variables.
Changes:
- Env-mediate SBOM output values (
component_count,dependency_manager) before emitting to$GITHUB_STEP_SUMMARY. - Env-mediate validated tag values (
tag/tag_name) before using them in release-relatedghcommands.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| .github/workflows/build-test.yaml | Moves SBOM output expressions out of the run: block into env: for the SBOM summary step. |
| .github/workflows/build-test-release.yaml | Env-mediates tag values in release steps and SBOM outputs in the SBOM summary step. |
| .github/workflows/build-test-release-multiarch.yaml | Env-mediates tag values in release steps and SBOM outputs in the multiarch SBOM summary step. |
| .github/workflows/build-test-multiarch.yaml | Moves SBOM output expressions out of the run: block into env: for the multiarch SBOM summary step. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ModeSevenIndustrialSolutions
force-pushed
the
fix/zizmor-template-injection
branch
from
July 28, 2026 10:51
f6b5857 to
09ee19f
Compare
Copilot started reviewing on behalf of
ModeSevenIndustrialSolutions
July 28, 2026 10:51
View session
Copilot started reviewing on behalf of
ModeSevenIndustrialSolutions
July 28, 2026 10:54
View session
zizmor's auditor persona reported 14 template-injection findings
across the four reusable workflows: GitHub expressions expanded
directly inside 'run:' blocks, where expansion happens before the
shell sees the script and a crafted value could inject commands.
Pass the values through 'env:' instead and reference them as shell
variables, the convention docs/BRIEF.md already states ("never
interpolate into run: blocks; env-mediate dynamic values") and
which the rest of the repository follows.
Two patterns were affected:
- Release jobs assigning TAG from a tag-validate output, in the
ensure-release, check-promoted and set-promoted-url steps. Those
steps already declared an 'env:' block for GH_TOKEN, so the tag
joins it as TAG_NAME.
- SBOM summary steps echoing the component count and dependency
manager into the step summary, now read from
SBOM_COMPONENT_COUNT and SBOM_DEPENDENCY_MANAGER.
No behavioural change: the same values reach the same commands.
Zizmor now reports no findings for the repository.
Co-authored-by: Claude <claude@anthropic.com>
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
ModeSevenIndustrialSolutions
force-pushed
the
fix/zizmor-template-injection
branch
from
July 28, 2026 13:25
09ee19f to
7b43a82
Compare
Copilot started reviewing on behalf of
ModeSevenIndustrialSolutions
July 28, 2026 13:26
View session
tykeal
approved these changes
Jul 28, 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.
Fix: Env-mediate expressions in run blocks
zizmor --persona auditorreported 14template-injectionfindings across the four reusable workflows. This clears all of them; the repository now reports zero findings.The issue
GitHub expressions were expanded directly inside
run:blocks. Expansion happens before the shell sees the script, so the expanded value becomes part of the script text rather than data — a crafted value can inject commands.This also contradicts a convention
docs/BRIEF.mdalready states:So this brings the code into line with the documented design, and with
go-workflows/node-workflows, both of which already report zero findings.Two patterns fixed
1. Release jobs assigning
TAG(6 sites —ensure-release,check-promoted,set-promoted-url). These steps already declared anenv:block forGH_TOKEN, so the tag simply joins it:2. SBOM summary steps (4 sites × 2 expressions = 8 findings):
The multiarch variants already had an
env:block forTARGET_ARCH; the new entries join it, leaving the existing$TARGET_ARCHreference untouched.No behavioural change
The same values reach the same commands. Only the transport changes — expression → environment variable → shell variable, instead of expression → literal script text.
Validation
zizmor --persona auditor .github/workflows/— "No findings to report." (was 14)${{ }}expressions inside anyrun:block across all 9 workflow filespre-commit run --files …— all hooks pass (yamllint, actionlint, workflow schema validation, reuse lint, codespell)Replacements were applied by an assertion-checked script requiring an exact occurrence count per pattern, so a silent partial match would have failed rather than half-applied.
Note on merge order
This branches from
mainand touches the same four files as #37 (build egress hatch), though different regions — #37 changes theinputs:block and thepython-buildjob, this changes thesbom/release jobs. They should merge cleanly in either order; if the second one conflicts, it'll be trivial to resolve.