fix: prevent template injection in run: steps (VULN-1652)#1947
Merged
Conversation
Replace direct ${{ inputs.skip_validation }}, ${{ inputs.use_oidc }},
${{ inputs.token }}, and ${{ env.CODECOV_TOKEN }} interpolation inside
run: shell scripts with env-var indirection. GitHub Actions resolves
template expressions before the shell sees the script, so any consumer
workflow that passes user-controlled data into these inputs could
achieve arbitrary command execution on the runner. Moving the values
into env: entries and referencing them as $INPUT_* shell variables
ensures the shell always treats them as data, not code.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1947 +/- ##
=======================================
Coverage 97.14% 97.14%
=======================================
Files 2 2
Lines 35 35
=======================================
Hits 34 34
Misses 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
drazisil-codecov
approved these changes
May 13, 2026
|
If you haven't considered it already, I would recommend using https://docs.zizmor.sh/ to scan your Github actions |
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 the template injection vulnerability.
Three
run:steps inaction.ymlwere directly interpolating${{ inputs.xxx }}template expressions inside shell scripts. Because GitHub Actions resolves these expressions before the shell sees the script, a consumer workflow that passes user-controlled data intoskip_validation,use_oidc, ortokencould achieve arbitrary command execution on the runner.Changes
"${{ inputs.skip_validation }}"inifconditionenv: INPUT_SKIP_VALIDATION, referenced as$INPUT_SKIP_VALIDATION"${{ inputs.use_oidc }}"inifconditionenv: INPUT_USE_OIDC, referenced as$INPUT_USE_OIDC"${{ inputs.token }}"inifcondition and command substitutionenv: INPUT_TOKEN, referenced as$INPUT_TOKEN"${{ env.CODECOV_TOKEN }}"inelifcondition and echoenv: INPUT_CODECOV_TOKEN, referenced as$INPUT_CODECOV_TOKENThe env-var indirection pattern is already used consistently in other steps in this file (e.g., the "Set fork" and "Override branch for forks" steps). This change makes the three affected steps consistent with that existing safe pattern.