securityinput-validation
Input Validation security skill
When & Why to Use This Skill
This Claude skill provides a robust security framework for input validation, designed to protect AI agents from hostile data and injection attacks. By enforcing strict trust boundaries and 'reject-by-default' principles, it mitigates critical vulnerabilities such as command injection, path traversal, and format string exploits, ensuring the integrity of terminal inputs, configuration files, and LLM responses.
Use Cases
- Command Injection Prevention: Automatically sanitizing user-provided strings to ensure they are never passed directly to system shells or dangerous functions.
- Path Traversal Defense: Validating and canonicalizing file paths to reject '..' sequences and prevent unauthorized access to sensitive system directories.
- LLM Response Guardrails: Validating streaming chunks from language models at the trust boundary to prevent malicious content or formatting from affecting the host system.
- Secure Configuration Loading: Exhaustively checking JSON configs and environment variables for correct type, length, and format before they are processed by internal functions.
- Memory Safety & Buffer Protection: Preventing null byte injections and unchecked length vulnerabilities that could lead to C-style string truncation or bypasses.
| name | security/input-validation |
|---|---|
| description | Input Validation security skill |
Input Validation
All external data is hostile. Validate exhaustively at trust boundaries, reject by default.
ikigai Application
Trust boundaries in ikigai:
- Terminal input (keystrokes, escape sequences)
- Config files (JSON, paths)
- LLM responses (streaming chunks)
- Environment variables
Injection vectors:
- Command injection: Never pass user strings to
system()orpopen() - Path traversal: Reject
.., canonicalize paths before use - Format string: Never
printf(user_input), alwaysprintf("%s", user_input) - Null byte: Truncates C strings, bypasses extension checks
Validation principles:
- Allowlist over blocklist
- Validate type, length, format, range
- Reject on first failure
- Sanitize for context (shell, SQL, HTML, ANSI)
After validation: Internal functions can assert() preconditions. The boundary function already validated.
Review red flags: User data in format strings, string concatenation for paths/commands, unchecked lengths.