Repository navigation
Harden the OpenCode bump workflow against shell injection from a release tag - #1064
Merged
Merged
Conversation
Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com> (cherry picked from commit 8888ac16bfe00612ebc891e0f39fbd069ed3c1fe)
Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
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.
The weekly OpenCode bump workflow read the latest anomalyco/opencode release tag and pasted it into shell source through
${{ steps.latest.outputs.version }}. Git tag names may contain$,(,;and backticks, so a hostile upstream tag could run code in a job holdingcontents: writeandpull-requests: write. Found by the supply-chain audit of PR #985 (it predates that PR).X.Y.ZorX.Y.Z-prerelease) before they reachGITHUB_OUTPUT.env:and a quoted variable; no${{ }}expression remains inside arun:script.actions/checkoutusespersist-credentials: false; the PR step already pushes with its own minted app token.actions/checkoutandactions/create-github-app-tokenare pinned to commit SHAs.Verified: a bash harness runs the workflow's producer scripts and rejects
1.2.3;id,1.2.3$(id)and1.2.3`id`while accepting1.14.39and2.0.0-beta.1. With the guards removed, all 9 rejection checks fail. All 7 run scripts passbash -n.Summary by cubic
Harden the weekly OpenCode bump workflow so hostile
anomalyco/opencoderelease tags can no longer inject shell commands into a job holdingcontents: writeandpull-requests: write. Tag names, which may contain$,(,;, and backticks, were previously interpolated intorun:scripts without validation.X.Y.ZorX.Y.Z-prerelease) before use.env:variables; no${{ }}expression remains inside arun:script.actions/checkoutandactions/create-github-app-tokento commit SHAs.persist-credentials: falseon checkout; the PR step already pushes with its own minted app token.1.2.3;id,1.2.3$(id), and1.2.3`id`while accepting1.14.39and2.0.0-beta.1.Written for commit b03986a. Summary will update on new commits.