Skip to content

Command Injection Risk in OAuth Browser Launch (CRITICAL)#68

Merged
wesm merged 2 commits intowesm:mainfrom
hughdbrown:bug-command-injection
Feb 5, 2026
Merged

Command Injection Risk in OAuth Browser Launch (CRITICAL)#68
wesm merged 2 commits intowesm:mainfrom
hughdbrown:bug-command-injection

Conversation

@hughdbrown
Copy link
Contributor

  • Location: internal/oauth/oauth.go:325-339
  • Issue: openBrowser() passes URL to exec.Command(). While not using shell, an attacker controlling OAuth redirect could potentially craft malicious URLs.
  • Fix: Validate URL format/scheme before passing to exec.Command().

hughdbrown and others added 2 commits February 5, 2026 07:50
- Location: internal/oauth/oauth.go:325-339
- Issue: openBrowser() passes URL to exec.Command(). While not using shell, an attacker controlling OAuth redirect could potentially
craft malicious URLs.
- Fix: Validate URL format/scheme before passing to exec.Command().
URL schemes are case-insensitive per RFC 3986, but the comparison was
case-sensitive, rejecting valid URLs like "HTTP://..." or "Https://...".
Normalize with strings.ToLower before comparing.

Extract validateBrowserURL so the validation logic can be unit-tested
without launching a browser. Add 12 table-driven tests covering: valid
http/https, uppercase and mixed-case schemes, and rejected schemes
(file, javascript, custom, ftp, empty, missing, malformed).

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@wesm wesm force-pushed the bug-command-injection branch from e09489c to 989ef5f Compare February 5, 2026 13:52
@wesm wesm merged commit 7335ae4 into wesm:main Feb 5, 2026
2 checks passed
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.

2 participants