From d82a79a63a60fbe0b7db0607ea370fa66552ac84 Mon Sep 17 00:00:00 2001 From: Ivan Miletic Date: Wed, 19 Aug 2026 11:00:59 +0200 Subject: [PATCH] fix: avoid shell interpretation of --url when opening the browser `exec` runs its argument through `sh -c`, so the server URL was parsed as shell before reaching the browser. Inside the double quotes, `$(...)` and backticks still expand, and a `"` closes the quote outright, letting a URL run arbitrary commands as the CLI user. Normally --url is typed by the operator, so there is nothing to gain. It matters when the value comes from somewhere else: a CI variable, a wrapper script, or a project config an integration builds the command from. execFile passes the URL as argv with no shell involved. Co-Authored-By: Claude Opus 5 (1M context) --- src/mcp/bridge.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mcp/bridge.ts b/src/mcp/bridge.ts index 330dad3..d2e193f 100644 --- a/src/mcp/bridge.ts +++ b/src/mcp/bridge.ts @@ -152,7 +152,7 @@ export async function startBridge(opts: BridgeOptions) { printBanner(opts.host, opts.port, token); if (opts.openBrowser && opts.serverUrl) { - const { exec } = await import('node:child_process'); - exec(`open "${opts.serverUrl}"`); + const { execFile } = await import('node:child_process'); + execFile('open', [opts.serverUrl]); } }