Skip to content

Security: Command injection vulnerability in git diff command builder#3253

Open
tomaioo wants to merge 1 commit into
coder:mainfrom
tomaioo:fix/security/command-injection-vulnerability-in-git-d
Open

Security: Command injection vulnerability in git diff command builder#3253
tomaioo wants to merge 1 commit into
coder:mainfrom
tomaioo:fix/security/command-injection-vulnerability-in-git-d

Conversation

@tomaioo
Copy link
Copy Markdown

@tomaioo tomaioo commented May 7, 2026

Summary

Security: Command injection vulnerability in git diff command builder

Problem

Severity: Critical | File: mobile/src/utils/git/gitCommands.ts:L28

mobile/src/utils/git/gitCommands.ts builds git commands using string interpolation instead of proper argument escaping. The diffBase, pathFilter parameters are directly interpolated into the command string without sanitization, allowing shell injection attacks.

Solution

Use an array-based command builder instead of string interpolation. Pass parameters as separate arguments to the git command to let git handle escaping properly. Example: ['git', 'diff', diffBase, '--', pathFilter]

Changes

  • mobile/src/utils/git/gitCommands.ts (modified)

mobile/src/utils/git/gitCommands.ts builds git commands using string interpolation instead of proper argument escaping. The diffBase, pathFilter parameters are directly interpolated into the command string without sanitization, allowing shell injection attacks.

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
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