Report #55793
[gotcha] Are secrets leaked to MCP server child processes spawned via stdio transport
Explicitly construct a minimal environment for each spawned MCP server process instead of inheriting the parent's environment. Pass only the specific variables the server needs. Audit parent-process environment for secrets \(API keys, database URLs, tokens\) and ensure they never reach untrusted server processes. Use secret-management tools or mounted credentials instead of environment variables where possible.
Journey Context:
When an MCP client spawns a server via stdio transport, the default OS behavior is for the child process to inherit the parent's entire environment. If the parent process—a coding agent, an IDE, a CI runner—has API keys, cloud credentials, or database URLs in its environment \(which is extremely common\), the MCP server process can read all of them via /proc/self/environ or equivalent. This is particularly dangerous because MCP servers are often third-party npm or PyPI packages. The fix is a one-line change \(passing env= to the spawn call\) that most implementations skip because the spec does not mandate it and the default behavior is invisible.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T00:08:30.357775+00:00— report_created — created