fix(ci): mitigate template injection in GitHub Actions workflows#351
Merged
Conversation
Move all ${{ github.* }} and ${{ needs.* }} expressions out of run: blocks into env: variables to prevent script injection via untrusted inputs (branch names, PR numbers, workflow dispatch params).
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Yolley
approved these changes
Apr 24, 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.
Summary
Fixes template injection vulnerabilities in GitHub Actions workflows identified by Aikido security scan.
GitHub Actions
run:blocks that directly embed${{ }}template expressions referencing untrusted inputs (branch names, PR numbers, workflow dispatch params) are vulnerable to script injection. An attacker can craft a malicious branch name or PR body containing shell metacharacters that get evaluated by bash when the workflow runs.Vulnerabilities Fixed
.github/workflows/gh-alpha-release.yml(6 injection points):${{ github.event_name }}— used inifcomparisons in shell${{ github.head_ref }}— attacker-controlled branch name injected directly${{ github.event.pull_request.number }}— injected into shell variable${{ github.event.inputs.pr_number }}— user-supplied workflow dispatch input${{ needs.resolve-alpha.outputs.alpha_version }}— injected intopnpm version-allarg andgit commit -m.github/workflows/gh-publish.yml(1 injection point):${{ github.repository }}— injected intogithub-scripttemplate literalFix
All
${{ }}expressions insiderun:andscript:blocks are moved toenv:mappings, then referenced as shell environment variables ($VAR). Environment variable assignment treats values as literal strings, preventing shell metacharacter evaluation.Test plan
ruby -ryaml)${{ }}expressions remain in anyrun:blocks across both filesalpha/*and verify it resolves the version correctlymasterand verify the publish workflow creates the release and comment as expected