Skip to content
This repository was archived by the owner on Aug 1, 2026. It is now read-only.

Potential fix for code scanning alert no. 2: Second order command injection - #28

Draft
daddia wants to merge 1 commit into
mainfrom
alert-autofix-2
Draft

Potential fix for code scanning alert no. 2: Second order command injection#28
daddia wants to merge 1 commit into
mainfrom
alert-autofix-2

Conversation

@daddia

@daddia daddia commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Potential fix for https://github.com/carinyaparc/carinyaparc/security/code-scanning/2

To fix this safely without changing functionality, ensure user-influenced ref arguments are always passed after Git’s end-of-options marker -- for commands that accept refs (fetch, checkout). This prevents Git from interpreting attacker-controlled strings as flags even if validation is bypassed or changed later.

Best single fix in this snippet:

  • In packages/crew/src/workspace.ts, update:
    • line 116 ['fetch', 'origin', branch]['fetch', 'origin', '--', branch]
    • line 117 ['checkout', '-b', branch, \origin/${branch}`]['checkout', '-b', branch, '--', `origin/${branch}`]`
    • line 123 ['checkout', '-b', branch]['checkout', '-b', branch, '--']

This is defense-in-depth and keeps existing branch validation logic intact.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…ection

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant