fix(ci): harden release workflows against expression injection + SHA-pin actions#37
Merged
Merged
Conversation
…pin actions Follow-up to a workflow-security audit across oablab/chi, oablab/ecsctl, and openabdev/ghpool (companion of openabdev/openab#1393/#1395/#1396, which fixed the same pattern in openab's release-pr.yml). release-pr.yml and release.yml expanded ${{ inputs.version }}, ${{ inputs.tag }}, and ${{ steps.*.outputs.* }} directly inside run: shell blocks across five jobs (resolve-version, create-release, build, docker, docker-manifest). Actions expands ${{ }} before bash ever sees the script, so a crafted version/tag string can break out of the shell string context. Threat model: release-pr.yml is workflow_dispatch-only (requires repo write access + carries an App token with contents:write + pull-requests:write via steps.app-token.outputs.token). release.yml triggers on 'push: tags' too, which is also gated on write access to push a tag. Same insider/leaked-credential threat model as openab's release-pr.yml. Fix: every inputs.*/steps.*.outputs.* reference in a run: block now goes through env: and is referenced as "$VAR" in shell, matching the canonical pattern already applied across openab's workflows. No behavioral change. Also SHA-pins dtolnay/rust-toolchain@stable and Swatinem/rust-cache@v2 across ci.yml, e2e.yml, and release.yml (same rationale as openabdev/openab#1396: a mutable tag/branch ref can be moved by anyone with push access to the upstream action repo; a commit SHA cannot). Version kept as a trailing comment for readability.
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.
What
Hardens
release-pr.ymlandrelease.ymlagainst expression injection, and SHA-pins two third-party actions. Found during a workflow-security audit acrossoablab/chi,oablab/ecsctl, andopenabdev/ghpool(companion of openabdev/openab#1393/#1395/#1396, which fixed the identical pattern inopenab'srelease-pr.yml).Injection fix
${{ inputs.version }},${{ inputs.tag }}, and${{ steps.*.outputs.* }}were expanded directly insiderun:shell blocks across five jobs (resolve-version,create-release,build,docker,docker-manifest). GitHub Actions expands${{ }}before bash parses the script, so a crafted version/tag string can break out of the shell string context.Threat model:
release-pr.ymlisworkflow_dispatch-only (requires repo write access, and carries an App token withcontents: write+pull-requests: write).release.ymlalso triggers onpush: tags, itself gated on write access. Same insider/leaked-credential threat model asopenab'srelease-pr.yml— not an open attack surface, but the same class of footgun.Fix: every
inputs.*/steps.*.outputs.*reference in arun:block now goes throughenv:and is referenced as"$VAR"in shell. No behavioral change.SHA-pinning
dtolnay/rust-toolchain@stableandSwatinem/rust-cache@v2are pinned to the commit SHA their tag/branch currently resolves to, acrossci.yml,e2e.yml, andrelease.yml— same rationale asopenabdev/openab#1396: a mutable tag or branch ref can be moved by anyone with push access to the upstream action repo; a commit SHA cannot. Version kept as a trailing comment.Verification
actionlintclean (exit=0)inputs.*,steps.*.outputs.*) inrun:blocks