fix(oauth): Windows openBrowser URL quoting (v0.11.2)#212
Merged
Conversation
…ze URL
Windows 版 openBrowser() は authorize URL をクォート無しで
`cmd.exe /c start "" <URL>` に渡しており、URL に含まれる `&` が
command separator として解釈され state パラメータ以降が切り落と
されていた。結果 Worker `/oauth/authorize` は state 欠落で 400 を
返し、v0.11.1 の「ブラウザ自動オープン」が Windows 上で機能して
いなかった。
修正: URL を `"..."` で囲んだ上で `shell: true` で cmd.exe 経由に
起動するようにした。これにより cmd.exe は quoted `&` をリテラル
扱いし、authorize URL 全体(client_id + state)がブラウザに届く。
macOS (`open`) と Linux (`xdg-open`) は argv で URL を受け取るため
影響なく、従来実装のまま。
mcp-server と local-mcp の両方を揃え、
`mcp-server/test/open-browser.test.mjs` に platform 分岐と
`&`-regression を検証する spawn-mock unit test を追加。
`docs/installation.{ja,}.md` に v0.11.2 Windows hotfix の短い note
を追記。
バージョンは manifest.json / package.json / server.json を
0.11.1 → 0.11.2 に bump。
Refs #211
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
github-webhook-mcp | f660d38 | Apr 20 2026, 11:22 PM |
liplus-lin-lay
commented
Apr 20, 2026
Member
Author
liplus-lin-lay
left a comment
There was a problem hiding this comment.
Self-review: PASS
Acceptance check (issue #211)
Windows openBrowser fix (mcp-server/server/index.js L173-188, local-mcp/src/index.ts same shape)
command = \start "" "${url}"`withshell: true— cmd.exe receives the full command string; URL wrapped in inner double quotes so&` is treated as a literal character rather than a command separator.- Minimal diff: darwin (
open) and linux (xdg-open) branches untouched. - Stderr fallback warning preserved for spawn failure and thrown exception paths.
- Comment clearly explains the
&-splitting root cause and cites #211 as the fix reference.
Version bumps
- 0.11.1 → 0.11.2 across
manifest.json,package.json,server.json(2 occurrences in server.json).
Tests
mcp-server/test/open-browser.test.mjsadded with 4 cases: win32 quoting regression, darwin passthrough, linux passthrough, and spawn error fallback (total test count 14 → 18, all pass).- Existing
migration.test.mjs/web-auth-required.test.mjsunaffected.
Docs
docs/installation.ja.md/.md: short note added on the v0.11.2 Windows hotfix.
Scope deviations
None.
Later / non-blocking
- Theoretical: URL containing
%followed by uppercase alphanumeric could still be treated as%VAR%expansion by cmd.exe. Current OAuth state/client_id are base64url and hex respectively — no%present — so not a live risk. Flag for awareness only.
Next
Mode = auto. Proceeding to squash merge, then release v0.11.2 (human-confirmed release state).
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.
Closes #211
概要
v0.11.1 Windows 版
openBrowser()は authorize URL をクォート無しでcmd.exe /c start "" <URL>に渡していたため、URL に含まれる&が cmd の command separator として解釈されstateパラメータが欠落し、Worker/oauth/authorizeがinvalid_request: state parameter is requiredで 400 を返していた。結果「ブラウザ自動オープン」が Windows 上で機能しない regression だった(実機検証 2026-04-20 Master)。本 PR は URL を
"..."で囲んでshell: true経由で cmd.exe に渡すよう修正した。cmd.exe は quoted 内の&をリテラル扱いするため、authorize URL 全体(client_id+state)がブラウザに正しく届く。変更
mcp-server/server/index.js/local-mcp/src/index.ts— Windows 分岐をcommand = \start "" "${url}"`; options.shell = true;に変更。macOS / Linux 分岐はそのまま(argv で URL を受け取るため&` の影響なし)。mcp-server/test/open-browser.test.mjs新規 — platform 分岐と&-regression を検証する spawn-mock unit test を追加(win32 quote 形式、darwin/linux argv 形式、&state=...が command 文字列に保持されること)。docs/installation.{ja,}.md— v0.11.2 Windows hotfix の短い note を追記。mcp-server/manifest.json/mcp-server/package.json/mcp-server/server.jsonを 0.11.1 → 0.11.2。検証
cd mcp-server && node --check server/index.js && node --test test/*.test.mjs— 18 tests pass(既存 14 + 新規 4 + spawn-mock 統合 1 を含む)。影響スコープ
Windows 限定の hotfix。macOS / Linux の OAuth flow は挙動不変。
openBrowser()失敗時の stderr フォールバック動作も維持。patch release v0.11.2 の想定。