Skip to content

fix: prevent shell injection in maintenance and upgrade workflows - #76951

Merged
pelikhan merged 1 commit into
mainfrom
pelikhan/ai-scan-command-injection
Nov 11, 2026
Merged

pelikhan merged 1 commit into
mainfrom
pelikhan/ai-scan-command-injection

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Branch names and release tags could be interpreted as shell source in two workflows, triggering AI Scan CWE-78 alerts 1100 and 1101.

Changes

  • Replace evaluated cleanup commands with an explicit --delete mode that passes branch names as literal arguments. Enumerate refs without display formatting and bind branch names into jq with --arg.
  • Preserve preview, age, PR-state, and maximum-count filtering. Fail explicitly on PR lookup or deletion errors instead of reporting success.
  • Pass release tags and event names through environment variables rather than interpolating them into Bash source.

Validation

  • 29 focused and related Node regressions passed, including mocked git/gh cases for valid refs containing command substitutions, semicolons, and quotes, with literal-argument and no-side-effect assertions.
  • ShellCheck, actionlint, and make agent-report-progress passed.
  • Tests performed no remote branch deletions or extension installs. No workflows were dispatched.

Alert closure requires rescanning the merged code. The existing race between branch eligibility checks and deletion is unchanged.

Remove eval from Copilot branch cleanup, preserve literal refs through enumeration and PR lookup, and execute deletion only through quoted arguments. Pass upgrade release metadata through environment variables and cover both paths with isolated mocked regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review November 11, 2026 20:20
Copilot AI adaptive review requested due to automatic review settings November 11, 2026 20:20
@pelikhan
pelikhan merged commit 17f2f8f into main Nov 11, 2026
73 of 75 checks passed
@pelikhan
pelikhan deleted the pelikhan/ai-scan-command-injection branch November 11, 2026 20:24
@pelikhan
pelikhan removed the request for review from Copilot November 11, 2026 21:42
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.3

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.

1 participant