Repository navigation
ci: pass release tag values through env vars on v2 - #1446
Merged
TerryHowe merged 1 commit intoSep 24, 2026
Merged
Conversation
The "Create and push tag" step interpolated
${{ steps.version.outputs.version }} and
${{ github.event.pull_request.merge_commit_sha }} directly into the
script body. The runner substitutes that text before bash parses the
line, so the step's safety rested on the extraction regex above it
staying strict. Pass both values through env: and quote them instead,
matching the equivalent step on main (oras-project#1264).
No behavior change: the anchored title regex already constrains the
captured version to semver, so nothing reaching this step could have
exploited the interpolation today. This is defense in depth, not a
fix for a live issue.
Closes oras-project#1442
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Akash Kumar <116457960+akashchamp@users.noreply.github.com>
akashchamp
requested review from
TerryHowe,
Wwwsylvia,
sabre1041 and
shizhMSFT
as code owners
September 23, 2026 17:05
Member
|
Thanks! |
This was referenced Sep 24, 2026
Merged
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.
Fixes #1442.
release.yml's "Create and push tag" step interpolates${{ steps.version.outputs.version }}and${{ github.event.pull_request.merge_commit_sha }}directly into therun:shell block. This is the same class of template-injection risk that PR #1264 already fixed onmainfor the v1 release workflow, and PR #1439 fixed for the rest of this step's siblings onv2โ this issue is the one remaining follow-up, filed by @TerryHowe after closing #1440 in favor of tracking it here.This PR applies the identical fix, scoped only to this one step: pass both values through
env:and reference them as quoted shell variables ("$VERSION","$MERGE_COMMIT") instead of interpolating the${{ }}expressions straight into the script. The resulting step is byte-for-byte identical to the equivalent step already merged onmain.Verification performed
actionlint .github/workflows/release.ymlandactionlintagainst the full.github/workflows/directory: clean, no findings.python3 -c "import yaml; yaml.safe_load(open('.github/workflows/release.yml'))"parses without error.git diff --check: no whitespace/encoding issues;git status --shortconfirms only this one file changed.main(fetched viaFETCH_HEAD): output empty โ identical.VERSION="v1.2.3"andMERGE_COMMIT=<real commit sha>as env vars, and ran the new script's exact commands (git tag "$VERSION" "$MERGE_COMMIT"; git push origin "$VERSION") verbatim.git ls-remote --tags originconfirmed the tag was created and pushed correctly โ normal behavior is unchanged.v1.2.3; touch /tmp/pwned-oras-demo #) directly into the old pattern (git tag <value> <sha>with the value substituted unquoted, mirroring literal${{ }}template substitution before bash parses it) and ran it โ the injectedtouchgenuinely executed. Ran the identical malicious string through the new pattern (git tag "$VERSION" "$MERGE_COMMIT"withVERSIONset via env var) โ the injected command did not execute; the whole string was passed as a single inert argument togit tag, which errored on an invalid ref name instead. Demo artifact removed afterward.AI assistance
This project has no AI-assistance disclosure policy in
CONTRIBUTING.md,AGENTS.md, or the PR template. Disclosing anyway: this change was prepared with Claude (Claude Code) assistance under the account holder's direction and review before submission.Signed-off-by: Akash Kumar 116457960+akashchamp@users.noreply.github.com