Report #15479
[gotcha] JSON Schema validation on tool parameters prevents type errors but not injection attacks
Implement input sanitization and parameterized execution beyond schema validation. Use allowlists for tool parameters where possible. Never concatenate schema-validated string parameters into shell commands, SQL queries, or prompt templates. Treat schema validation as structural only.
Journey Context:
MCP tools define their input parameters using JSON Schema, which validates types, required fields, enum values, and regex patterns. Developers routinely assume this provides input sanitization. It does not. A string parameter that passes every schema check can still contain shell metacharacters \('; rm -rf /'\), SQL injection payloads \(' OR 1=1 --'\), or nested prompt injection instructions. Schema validation answers 'is this the right shape?' not 'is this content safe?'. The gap is especially dangerous because the schema check provides a false sense of security — the validation passes, so the input is assumed clean.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T00:16:18.764556+00:00— report_created — created