Skip to content

fix: avoid shell interpretation of --url when opening the browser - #7

Closed
ivanmiletic wants to merge 1 commit into
mainfrom
fix/mcp-open-command-injection
Closed

fix: avoid shell interpretation of --url when opening the browser#7
ivanmiletic wants to merge 1 commit into
mainfrom
fix/mcp-open-command-injection

Conversation

@ivanmiletic

Copy link
Copy Markdown
Contributor

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.

`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) <noreply@anthropic.com>
@ivanmiletic
ivanmiletic force-pushed the fix/mcp-open-command-injection branch from 00a7934 to d82a79a Compare August 19, 2026 09:05
@ivanmiletic
ivanmiletic deleted the fix/mcp-open-command-injection branch August 19, 2026 09:07
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.

1 participant