fix(daemon): gate dynamic stdio MCP spawn (H6 / DR-038)#81
Open
sudhirverma wants to merge 1 commit into
Open
Conversation
Require command allowlist and operator approval before spawning stdio MCP processes, and reject command/args from unauthenticated callers when consumers are configured.
8 tasks
8 tasks
sathyapramod
added a commit
that referenced
this pull request
Jul 21, 2026
Renumber self-connection decision to DR-039 (avoids collision with #81), refuse local MCP URLs when listen ports are unknown, normalize IPv4-mapped loopback, record failed status on self-reject, and drop unintentional package-lock engines churn.
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.
Summary
Closes finding H6: dynamic
RegisterMcpServerwithtransport: stdiopreviously spawnedcommand/argsdirectly, so any caller withmcp_register(or anyone when consumers were unset) could run arbitrary host commands.This change fails closed before any process is spawned:
commandmust matchsecurity.stdio_command_allowlist(basename or absolute path). Empty / omitted allowlist denies all dynamic stdio.POST /api/mcp/stdio-spawns/:requestIdunlessstdio_require_approval: false.consumersis configured, stdiocommand/argsrequire an authenticated consumer withmcp_register.Config-file
mcp_serversremain admin-trusted and skip these gates. Prefer caller-spawned HTTP/SSE for dynamic registration (DR-025). Documented as DR-038.Config
API / UI
GET /api/mcp/stdio-spawnsPOST /api/mcp/stdio-spawns/:requestId{ "decision": "allow" | "deny" }Denials return clear gRPC
PERMISSION_DENIEDreasons and are logged as[StdioMCP] DENIED: ….Test plan
/bin/shrejected;StdioMCPTransportnot constructedconnect()skips allowlistmcp-stdio-spawn-policy.test.ts):/bin/sh→ denied, no spawn, denial visible via APInpx→ pending approval → approve → process startsPERMISSION_DENIEDconfig.yaml, start web dashboard, approve a pending stdio spawn from MCP Servers tabRelated