Skip to content
Skills Library
Security · Review & audit

input-output-sanitization

/input-output-sanitization

Enforce input and output sanitization in MCP servers. Use when building or reviewing MCP server request handling, tool invocation, or response processing.

Licence
Apache-2.0
Last repository change
15.07.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 15.07.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Enforce input and output sanitization in MCP servers. Use when building or reviewing MCP server request handling, tool invocation, or response processing.

Original author description

Enforce input and output sanitization in MCP servers. Use when building or reviewing MCP server request handling, tool invocation, or response processing.

How it works

  1. Security Requirement
  2. Input Sanitization
  3. Output Sanitization
  4. Key Principle
  5. Implementation Checklist
Original SKILL.md headings · 45 lines, 305 words
SKILL.md preview
---
name: input-output-sanitization
description: Enforce input and output sanitization in MCP servers. Use when building or reviewing MCP server request handling, tool invocation, or response processing.
category: "secure_development"
subcategory: "mcp-server"
---

# Input/Output Sanitization for MCP Servers

## Security Requirement

MCP servers MUST treat all inputs as untrusted, including:

- User-provided parameters
- Prompt-driven parameters (values determined by the LLM)
- Descriptions and outputs from other tools
- Any data that flows through the MCP protocol

## 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:

- Strip or escape content that could be interpreted as code or commands
- Validate output format matches the expected schema
- Truncate excessively large outputs to prevent resource exhaustion
- Scrub sensitive data from outputs before returning to clients

## 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

- [ ] Validate all input parameters (type, length, format, allowed values)
- [ ] Treat LLM-generated parameters as untrusted input
- [ ] Treat outputs from other tools as untrusted input
- [ ] Implement path traversal prevention for any file path parameters
- [ ] Sanitize outputs before returning to clients
- [ ] Validate output format against expected schemas
- [ ] Truncate excessively large outputs
- [ ] Log sanitization actions (blocked or modified inputs) for security monitoring

Versions

The database has no other skills named input-output-sanitization.

Database snapshot: 13.11.2026 · package version 69bd5d234e47 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100scanning-input-validation-practices
    Scan for input validation vulnerabilities and injection risks. Use when reviewing user input handling. Trigger with 'scan input validation', 'check injection vulnerabilities', or 'validate sanitization'.
  • 100scanning-input-validation-practices
    Scan for input validation vulnerabilities and injection risks. Use when reviewing user input handling. Trigger with 'scan input validation', 'check injection vulnerabilities', or 'validate sanitization'.
  • 100secure-token-handling
    Enforce secure token validation and storage in MCP servers. Use when implementing or reviewing token handling, JWT validation, or token storage in MCP servers.
  • 100roots-support
    Enforce roots directive support in MCP servers. Use when building or reviewing MCP server filesystem access, directory scoping, or path boundary enforcement.
  • 90input-validation
    Reviews input validation and sanitization across the application for injection and malformed-input risks. Use when auditing how untrusted input is handled.
  • 100content-sanitization
    Provides sanitization guidelines for external content in skills and hooks. Use when loading GitHub Issues, PRs, WebFetch results, or any untrusted input.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.