Stop opening the OAuth authorization URL through cmd.exe on Windows - #382
Merged
Conversation
The authorization URL is built from the authorization server's metadata, i.e. it is controlled by whatever server the user typed into `mcpc login`. On Windows it was handed to `cmd.exe /c start "" <url>`. libuv only quotes arguments containing whitespace or double quotes, so `&`, `|`, `^` and `%VAR%` inside the URL reached cmd.exe unescaped and were interpreted as commands: `https://evil.example/authorize?x=1&calc` ran `calc` once the user pressed Enter. Even a benign URL was truncated at its first `&`. The browser is now launched via `rundll32 url.dll,FileProtocolHandler` on Windows (no command interpreter in between, same approach as the GitHub CLI), and authorization URLs with a scheme other than http:/https: are refused on every platform before they are shown or opened. The launcher command is built by a pure, exported function with unit tests that assert no shell binary is ever used and that hostile URLs pass through as a single verbatim argument. Fixes H1 in docs/security-review-2026-09.md. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HbTS6Mvbo9t5115trQQm6j
Refs #382. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HbTS6Mvbo9t5115trQQm6j
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mcpc loginhanded the server-supplied authorization URL tocmd.exe /c starton Windows. libuv only quotes arguments with whitespace or double quotes, so&,|,^and%VAR%in the URL ran as commands once the user pressed Enter, and even a benign URL was cut off at its first&. The browser is now launched without any shell, and non-http(s) authorization URLs are refused.rundll32 url.dll,FileProtocolHandler <url>(same approach as the GitHub CLI); macOS and Linux keepopen/xdg-open.http:/https:are rejected in both login flows before they are printed or opened.Securityentry and CLAUDE.md security note updated.Not exercised on Windows itself; the reasoning follows libuv's quoting rules and the rundll32 precedent.
Fixes H1 in docs/security-review-2026-09.md.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HbTS6Mvbo9t5115trQQm6j