Report #52858
[gotcha] My MCP tool has JSON Schema parameter validation — am I protected from injection attacks?
JSON Schema validates structure, not semantics. Implement application-level parameter validation: check for path traversal \(no '../' in file paths\), command injection \(no shell metacharacters in command arguments\), SQL injection \(use parameterized queries, never string interpolation\), and SSRF \(validate URLs against an allowlist\). Never pass tool parameters directly to shell commands, file operations, or database queries without sanitization.
Journey Context:
MCP tool parameters are defined using JSON Schema, which validates types, required fields, and patterns. Developers often assume this provides security validation. It doesn't. JSON Schema can verify that a 'filename' parameter is a string, but cannot prevent that string from being '../../../etc/passwd'. It can verify a 'command' parameter is present, but cannot prevent it from being 'rm -rf /'. The MCP specification explicitly states that JSON Schema is for describing the structure of parameters, not for security validation. The counter-intuitive part: having a schema feels like having validation, which creates a false sense of security. The schema is a contract for the LLM, not a security boundary.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T19:13:13.486258+00:00— report_created — created