Fix shell injection vulnerability in comment handling#963
Merged
peter-evans merged 1 commit intomainfrom Mar 6, 2026
Merged
Conversation
Replace all `${{ inputs.* }}` interpolations inside `run:` scripts with
environment variables passed via `env:` blocks, preventing shell
interpretation of backticks, `$(...)`, and other metacharacters in
user-supplied inputs.
- Pass `comment` directly as an env var to the Close Issue step,
eliminating the heredoc/delimiter pass-through via `GITHUB_OUTPUT`
- Use a bash array (`comment_args`) to conditionally include
`--comment` flag, avoiding unsafe string concatenation
- Route `close-reason`, `labels`, `repository`, and `issue-number`
through `env:` blocks in all steps for defense in depth
- Quote variable references in label processing to handle whitespace
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 #948
Replace all
${{ inputs.* }}interpolations insiderun:scripts with environment variables passed viaenv:blocks, preventing shell interpretation of backticks,$(...), and other metacharacters in user-supplied inputs.commentdirectly as an env var to the Close Issue step, eliminating the heredoc/delimiter pass-through viaGITHUB_OUTPUTcomment_args) to conditionally include--commentflag, avoiding unsafe string concatenationclose-reason,labels,repository, andissue-numberthroughenv:blocks in all steps for defense in depth