Skip to content

Fix expression injection in composite actions - #6

Merged
jeremy merged 3 commits into
mainfrom
action-sec
Mar 5, 2026
Merged

jeremy merged 3 commits into
mainfrom
action-sec

Conversation

@jeremy

@jeremy jeremy commented Mar 5, 2026

Copy link
Copy Markdown
Member

Summary

  • Move ${{ inputs.* }} interpolations from run: blocks to env: blocks in both rubric-check and surface-compat composite actions
  • Values are now set as environment variables by the runner before bash executes, preventing shell injection via crafted input values

These actions are consumed by our *-cli repos, where workflows run on user-submitted PRs. A malicious PR author could craft input values containing shell metacharacters that break out of the interpolation context. The env: pattern eliminates this class entirely.

Resolves all 10 CodeQL actions/code-injection alerts (1–10).

Test plan

  • make check passes
  • CodeQL re-scan closes all 10 alerts
  • grep confirms no ${{ inputs. remains in any run: block

jeremy added 2 commits March 5, 2026 01:17
Move ${{ inputs.* }} from run: blocks to env: blocks so values are
set as environment variables before bash executes. Prevents shell
injection via crafted input values on user-submitted PRs.

Resolves CodeQL alerts 1–4 (actions/code-injection).
Move ${{ inputs.* }} from run: blocks to env: blocks so values are
set as environment variables before bash executes. Prevents shell
injection via crafted input values on user-submitted PRs.

Resolves CodeQL alerts 5–10 (actions/code-injection).
Copilot AI review requested due to automatic review settings March 5, 2026 09:17
@github-actions github-actions Bot added bug Something isn't working actions and removed bug Something isn't working labels Mar 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the repo’s composite GitHub Actions (rubric-check and surface-compat) against expression/shell injection by removing direct ${{ inputs.* }} interpolation from run: scripts and passing those values via env: instead. This is particularly important because these actions are used in workflows that execute on untrusted PRs in downstream *-cli repositories.

Changes:

  • Moved inputs.cli-binary, inputs.baseline, and inputs.profile usage out of run: blocks into step env: blocks in both actions.
  • Updated bash scripts to reference the environment variables (e.g., $INPUT_CLI_BINARY, $INPUT_BASELINE, $INPUT_PROFILE) instead of inline expressions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
actions/surface-compat/action.yml Uses env: variables for cli-binary and baseline to avoid input interpolation inside bash scripts.
actions/rubric-check/action.yml Uses env: variables for cli-binary and profile to avoid input interpolation inside bash scripts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread actions/surface-compat/action.yml
Comment thread actions/surface-compat/action.yml
Comment thread actions/rubric-check/action.yml Outdated
Workflow commands (::error::, ::warning::) are vulnerable to newline
injection when they include user-controlled values. Replace with plain
stderr messages to eliminate the command injection vector.
@github-actions github-actions Bot added the bug Something isn't working label Mar 5, 2026
@jeremy
jeremy merged commit 3ec412a into main Mar 5, 2026
18 checks passed
@jeremy
jeremy deleted the action-sec branch March 5, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

actions bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants