🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
ADR 401: Browser MCP Windows Shell Boundary
Status: Accepted
Date: 2026 09 26
Related: #2770 (the fallback this ADR corrects), ADR 399 (Git execution boundary), ADR 127 (github-safe shell-free execution)
Context
The browser MCP tools (browser_open, browser_fill, browser_type, browser_press, browser_select, browser_eval, and the others that share execBrowserCommand) run the agent-browser CLI. When agent-browser is not installed globally, execBrowserCommand fell back to npx --yes agent-browser ....
On Windows npx is npx.cmd, a batch file that execFileSync cannot spawn without cmd.exe. The #2770 fix enabled shell: process.platform === 'win32' for that fallback and recorded a safety condition in a comment: the arguments were hard-coded flags plus a package name, and "if user-controlled args are ever added, escape them before spawn."
That condition stopped being true. execBrowserCommand now receives tool-supplied values: the fill value, the eval script, selectors, key names, URLs and paths. Their only validation is validateText, which checks type, length and NUL bytes. With shell: true, Node joins argv with spaces and passes the string to cmd.exe, so &, |, ^, %VAR% and quotes in any of those values are shell syntax. An MCP caller, including a prompt-injected agent, can run commands as the host user on any Windows host where agent-browser is missing.
Scope of the exposure:
- Windows only, and only on the fallback path (global
agent-browserabsent). - POSIX was never affected:
shellisfalsethere. - Affects every published version that carries the #2770 fallback, including 3.46.0.
The condition was reported through an independent research run against main at 88955d9f. It was verified here by reading the published 3.46.0 artifact: the shell: process.platform === 'win32' option and the stale comment are present in dist/src/mcp-tools/browser-tools.js.
Decision
Tool-supplied text never reaches a shell. execBrowserCommand no longer sets a shell option on any spawn.
Windows launch targets are resolved to the process behind the npm shim, and that process is spawned directly with an argv array:
agent-browser:where.exe agent-browser, then a native.exe, ornode <entry>where<entry>is the package's ownbinfile read from<npm prefix>/node_modules/agent-browser/package.json.npxfallback:node <npm>/bin/npx-cli.js --yes agent-browser ..., using the running Node's own npm, or the npm thatwhere.exe npxpoints at.
This is the resolution runtime/claude-command.ts already applies to Claude Code and the hook runner applies to resolveNpmShim. It lives in runtime/browser-command.ts as two small functions with injectable platform, filesystem and lookup so they are testable on any host.
Guards:
- A resolved target ending in
.cmdor.batis never returned. Spawning one impliescmd.exeeven withshell: false. - A
binentry that resolves outside its package directory is rejected. - If neither launcher resolves on Windows, the tool fails with the existing install hint. It does not fall back to a shell.
- POSIX behaviour is unchanged:
agent-browser, thennpx, both without a shell.
Enforcement
browser-win32-no-shell.test.tsdrivesexecBrowserCommandwith hostile values (" & calc.exe & ",%COMSPEC%,^|,$(id), CRLF injection, a script that callschild_process) under a stubbedwin32andlinuxplatform. It asserts that every spawn receives the value as one literal argv element and no truthyshell. It fails on the previous implementation.- A static test fails if
browser-tools.tsever contains ashell:option again. browser-command-resolver.test.tscovers resolution,.cmdand.batrefusal, and bin-path traversal.
Alternatives considered
- Escape arguments for
cmd.exe(escapeCmdArg). Rejected. Ashell: truecommand line is parsed twice, bycmd.exeand then by the target's argv parser, and correct quoting differs between them. The hook runner needed a dedicated two-parser escaper for exactly this. Removing the shell removes the class of bug instead of relying on complete escaping of every future argument. - Tighten
validateText. Rejected as the primary control.fillandevallegitimately carry arbitrary text, including quotes and ampersands, so a denylist would either break the tools or miss a metacharacter. - Require a global
agent-browserand drop thenpxfallback. Viable, but a behaviour change for users who rely on the fallback. Kept as a possible follow-up.
Consequences
- The Windows fallback keeps working on standard Node installs. On unusual layouts where
npx-cli.jscannot be located, the tool now reports the install hint instead of running throughcmd.exe. - Users on Windows with a global
agent-browsernow run it withoutnpxat all, which is faster than before. - Other
shell: process.platform === 'win32'call sites were audited and are not exposed to tool input:commands/init.tspasses hard-coded flags and a pre-validated model name,commands/eject.tstakes arguments from the local user's own command line, andmcp-tools/agentbbs-tools.tsruns a fixed--versionagainst a binary chosen by a trusted environment variable. Their stale "no injection risk" comments should be revisited if any of those arguments ever become tool-supplied.
Disclosure
The fix and the patched release ship together. The advisory text describes the condition and the affected configuration without an exploit string.