Skip to content

fix: prevent template injection in run: steps (VULN-1652)#1947

Merged
thomasrockhu-codecov merged 1 commit into
mainfrom
fix/template-injection-vuln-1652
May 13, 2026
Merged

fix: prevent template injection in run: steps (VULN-1652)#1947
thomasrockhu-codecov merged 1 commit into
mainfrom
fix/template-injection-vuln-1652

Conversation

@thomasrockhu-codecov
Copy link
Copy Markdown
Contributor

@thomasrockhu-codecov thomasrockhu-codecov commented May 13, 2026

Summary

Fixes the template injection vulnerability.

Three run: steps in action.yml were 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 into skip_validation, use_oidc, or token could achieve arbitrary command execution on the runner.

Changes

Step Vulnerable expression Fix
Check system dependencies "${{ inputs.skip_validation }}" in if condition Moved to env: INPUT_SKIP_VALIDATION, referenced as $INPUT_SKIP_VALIDATION
Get and set token "${{ inputs.use_oidc }}" in if condition Moved to env: INPUT_USE_OIDC, referenced as $INPUT_USE_OIDC
Get and set token "${{ inputs.token }}" in if condition and command substitution Moved to env: INPUT_TOKEN, referenced as $INPUT_TOKEN
Get and set token "${{ env.CODECOV_TOKEN }}" in elif condition and echo Moved to env: INPUT_CODECOV_TOKEN, referenced as $INPUT_CODECOV_TOKEN

The 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.

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.
@linear
Copy link
Copy Markdown

linear Bot commented May 13, 2026

VULN-1652

@sentry
Copy link
Copy Markdown

sentry Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.14%. Comparing base (57e3a13) to head (8bf0238).

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           
Flag Coverage Δ
demo-macos-latest 97.14% <ø> (ø)
demo-macos-latest-xlarge 97.14% <ø> (?)
demo-ubuntu-latest 97.14% <ø> (ø)
demo-windows-latest 97.14% <ø> (ø)
script- 97.14% <ø> (?)
script-macos-latest 97.14% <ø> (ø)
script-macos-latest-xlarge 97.14% <ø> (?)
script-ubuntu-latest 97.14% <ø> (ø)
script-windows-latest 97.14% <ø> (ø)
version-macos-latest 97.14% <ø> (ø)
version-maxos-latest-xlarge 97.14% <ø> (?)
version-ubuntu-latest 97.14% <ø> (ø)
version-windows-latest 97.14% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@thomasrockhu-codecov thomasrockhu-codecov merged commit 51e6422 into main May 13, 2026
21 checks passed
@thomasrockhu-codecov thomasrockhu-codecov deleted the fix/template-injection-vuln-1652 branch May 13, 2026 18:59
@mpkorstanje
Copy link
Copy Markdown

If you haven't considered it already, I would recommend using https://docs.zizmor.sh/ to scan your Github actions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants