Skip to content

Fix shell injection vulnerability in comment handling#963

Merged
peter-evans merged 1 commit intomainfrom
fix-shell-injection
Mar 6, 2026
Merged

Fix shell injection vulnerability in comment handling#963
peter-evans merged 1 commit intomainfrom
fix-shell-injection

Conversation

@peter-evans
Copy link
Copy Markdown
Owner

Fixes #948

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

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
@peter-evans peter-evans merged commit 05dff7c into main Mar 6, 2026
5 checks passed
@peter-evans peter-evans deleted the fix-shell-injection branch March 6, 2026 09:26
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.

v3 doesn't properly escape from shell.

1 participant