Skip to content

fix(ci): bind reusable-workflow inputs to env (script injection) - #5

Open
MarkAtwood wants to merge 2 commits into
masterfrom
fix/ci-script-injection
Open

fix(ci): bind reusable-workflow inputs to env (script injection)#5
MarkAtwood wants to merge 2 commits into
masterfrom
fix/ci-script-injection

Conversation

@MarkAtwood

Copy link
Copy Markdown

Fixes #2. Reusable workflow interpolated caller ${{ inputs.* }} straight into run: blocks (script injection, distributed to every product repo). Inputs bound to env: and referenced as "$VAR"; added permissions: contents: read; hardened the host-path-leak grep against a no-file glob. Independent of the other review PRs.

sameehj and others added 2 commits July 23, 2026 15:54
Signed-off-by: Sameeh Jubran <sameeh@wolfssl.com>
Caller-controlled ${{ inputs.* }} values were interpolated directly
into run: blocks; the runner substitutes them before the shell parses
the script, so shell metacharacters execute as code. As a reusable
workflow shipped to every product repo this distributes the footgun.

Bind each input to env: and reference "$VAR" in the script (env values
are not re-parsed by ${{ }}), add permissions: contents: read, and make
the host-path-leak grep distinguish exit 2 (no-file glob) from 1 (clean).

Fixes #2

Fixes #2

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 reusable SBOM GitHub Actions workflow against script injection by preventing direct interpolation of caller-controlled inputs.* into run: shell scripts, reducing risk across all product repos that consume the workflow.

Changes:

  • Binds reusable-workflow inputs to env: and references them as "$VAR" inside run: scripts to avoid expression-time textual substitution.
  • Adds least-privilege job permissions (contents: read) for checkout.
  • Improves “host path leak” scanning behavior by handling grep exit codes and surfacing matches/errors.

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

env:
BUILD_COMMAND: ${{ inputs.build-command }}
run: |
bash -c "$BUILD_COMMAND"
Comment on lines +100 to +102
set +e
out="$(grep -REn '"/(home|Users|root)/' $OUTPUTS)"
rc=$?
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.

Script injection: untrusted inputs interpolated into run: in sbom-reusable.yml

3 participants