← ClaudeAtlas

coding-input-sanitizationlisted

Use when handling untrusted or external input at an application or facing-API boundary - an HTTP/REST endpoint, web form, file upload, webhook, CLI taking user data, queue/broker message, or data from a third-party or legacy system - or when emitting into SQL, HTML, a shell, a file path, or another sink. Keywords - SQL injection, XSS, command injection, path traversal, deserialization, SSRF, unbounded-input DoS. For boundary-parsing architecture see coding-python-clean-architecture and coding-python-enforce-data-architecture-strict.
bitranox/bitranox-skills · ★ 1 · AI & Automation · score 57
Install: claude install-skill bitranox/bitranox-skills
# coding-input-sanitization ## Overview Untrusted input is sanitized at the TRUST BOUNDARY - the edge of an application or a public/facing API - in two directions: validate-and-bound on the way IN, escape-for-the-sink on the way OUT. **Core principle: sanitize at the boundary, not in the libraries between boundaries.** A library called by your own trusted code assumes its inputs were already validated at the edge; re-sanitizing on every internal call is waste and false confidence. Two distinct defenses, both required: input validation does NOT make output safe, and output escaping does NOT replace input validation. ## Where this applies (and where it does NOT) APPLIES - an untrusted boundary, data from outside your control: - HTTP request body / query params / headers / cookies; web form fields; multipart file uploads - webhook payloads; queue / broker / pub-sub messages - CLI arguments and stdin carrying user data - responses from a third-party API; scraped data; rows from a foreign / legacy system DOES NOT APPLY - internal seams between trusted code: - a domain/application function called by your own validated code - a library/package boundary between your own modules - These rely on the TYPE CONTRACT (the edge already validated). At most assert/typecheck; do not re-run input sanitization. Sanitizing everywhere is the anti-pattern this skill prevents. ## On the way IN - validate at the edge - **Parse into a typed model, never inspect a raw dict.** A boundary parse