Skip to content

W-22550539: prevent command injection in DevOps checkout guidance#465

Open
jag-j wants to merge 1 commit into
mainfrom
jj/W-22550539
Open

W-22550539: prevent command injection in DevOps checkout guidance#465
jag-j wants to merge 1 commit into
mainfrom
jj/W-22550539

Conversation

@jag-j

@jag-j jag-j commented Jun 8, 2026

Copy link
Copy Markdown

Fixes @W-22550539@

Addresses command injection vulnerability where branch names were embedded directly into shell command strings without validation or escaping in the checkout helper's "Agent execution guide".

Changes:

  • Import and use validateGitBranchName() to validate branch names
  • Added shellEscape() function for safe shell argument escaping
  • All git commands now use shell-escaped branch names
  • Added 10 comprehensive security test cases
  • Tests validate rejection of POC from W-22550539
  • Tests verify shell escaping in generated commands

Security improvements:

  • Validates branch name format before use
  • Blocks command injection patterns (;, |, $(), backticks)
  • Blocks path traversal attempts (..)
  • Shell-escapes branch names with single quotes
  • Prevents arbitrary command execution in agent environments

What does this PR do?

What issues does this PR fix or reference?

Fixes W-22550539

Addresses command injection vulnerability where branch names were
embedded directly into shell command strings without validation or
escaping in the checkout helper's "Agent execution guide".

Changes:
- Import and use validateGitBranchName() to validate branch names
- Added shellEscape() function for safe shell argument escaping
- All git commands now use shell-escaped branch names
- Added 10 comprehensive security test cases
- Tests validate rejection of POC from W-22550539
- Tests verify shell escaping in generated commands

Security improvements:
- Validates branch name format before use
- Blocks command injection patterns (;, |, $(), backticks)
- Blocks path traversal attempts (..)
- Shell-escapes branch names with single quotes
- Prevents arbitrary command execution in agent environments

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@jag-j jag-j requested a review from a team as a code owner June 8, 2026 22:46
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