Report #22540
[tooling] MCP file-system server allows path traversal attacks \(e.g., \`../../../etc/passwd\`\)
Request the \`roots\` capability during server initialization. Validate all user-provided paths against the \`roots\` list returned by the client \(e.g., workspace folders\) using \`path.resolve\` and \`startsWith\` checks before any FS operation.
Journey Context:
MCP servers often run with the client's filesystem permissions. Without sandboxing, a tool like \`read\_file\` can escape the intended workspace. The \`roots\` capability is the standard mechanism for the client to declare safe boundaries \(e.g., project root\). Servers must treat \`roots\` as an allow-list. This prevents security issues in multi-root workspaces \(e.g., monorepos\) where naive relative paths could cross into sibling directories.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:14:53.253643+00:00— report_created — created