Input output sanitization

From RedHatProductSecurity/prodsec-skills · View interactive version

Input output sanitization is an AI agent skill from the GitHub repository RedHatProductSecurity/prodsec-skills. Enforce input and output sanitization in MCP servers. Use when building or reviewing MCP server request handling, tool invocation, or response processing.

How to use this skill

Skill file

Input/Output Sanitization for MCP Servers

Security Requirement

MCP servers MUST treat all inputs as untrusted, including:

Input Sanitization

| Input Source | Risk | Sanitization |

|---|---|---|

| User parameters | Injection, path traversal, XSS | Validate type, length, format; reject unexpected values |

| LLM-generated parameters | Prompt injection artifacts, malformed data | Same validation as user input; never trust LLM output implicitly |

| Tool outputs used as inputs | Poisoned tool chains, injection propagation | Validate before passing to next tool; treat as untrusted |

| File paths | Path traversal, symlink attacks | Canonicalize and validate against allowed directories |

Output Sanitization

Tool outputs returned to clients or passed to other tools must also be sanitized:

Key Principle

Never assume any input is safe because it came from "inside" the system. LLM-generated content and inter-tool communication are just as untrusted as external user input.

Implementation Checklist

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.