fix(ci): bind reusable-workflow inputs to env (script injection) - #5
Open
MarkAtwood wants to merge 2 commits into
Open
fix(ci): bind reusable-workflow inputs to env (script injection)#5MarkAtwood wants to merge 2 commits into
MarkAtwood wants to merge 2 commits into
Conversation
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
There was a problem hiding this comment.
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"insiderun: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=$? |
sameehj
force-pushed
the
master
branch
4 times, most recently
from
July 24, 2026 14:09
3ab77f9 to
9bdf5b7
Compare
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.
Fixes #2. Reusable workflow interpolated caller
${{ inputs.* }}straight intorun:blocks (script injection, distributed to every product repo). Inputs bound toenv:and referenced as"$VAR"; addedpermissions: contents: read; hardened the host-path-leak grep against a no-file glob. Independent of the other review PRs.