input-sanitization
Skill0 starsChanged 4 months agoMITView on GitHub
Correctly validate untrusted input and encode output per sink to prevent injection (SQL, command, XSS, path, SSRF). Use when handling any external input — request bodies, query params, headers, CLI args, file contents, env vars — or when fixing an injection finding.
In this repository72 other files it gives its agents.
- AGENTS.mdAGENTS.md
- templates/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- templates/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- agents-md-initSkill
- analytical-frameworksSkill
- appkit-accessibility-auditorSkill
- assess-security-controlsSkill
- audit-accessibilitySkill
- automated-security-reviewSkill
- changelogSkill
- check-ai-onboard-updatesSkill
- agents-sdkSkill
- cloudflare-email-serviceSkill
- cloudflare-oneSkill
- durable-objectsSkill
- sandbox-sdkSkill
- turnstile-spinSkill
- workers-best-practicesSkill
- wranglerSkill
- cobra-commandSkill
- competitive-intelSkill
- component-scaffoldSkill
- conduct-open-source-investigationSkill
- conduct-user-researchSkill
- conventional-commitSkill
- coordinate-data-viewsSkill
- core-data-expertSkill
- data-storytellingSkill
- datavizSkill
- debug-systematicallySkill
- define-brand-foundationSkill
- dependency-vuln-scanSkill
- design-and-build-websiteSkill
- design-product-contentSkill
- design-product-interfaceSkill
- develop-apple-platform-appSkill
- develop-test-firstSkill
- evolve-design-systemSkill
- gh-issueSkill
- gh-prSkill
- gh-releaseSkill
- identity-managementSkill
- manage-vulnerability-riskSkill
- map-attack-surfaceSkill
- market-researchSkill
- measure-product-experimentsSkill
- obsidianSkill
- pr-descriptionSkill
- preserve-web-evidenceSkill
- prisma-migrateSkill
- retrieve-technical-docsSkill
- secret-managementSkill
- secret-scanSkill
- secure-codingSkill
- security-auditSkill
- shape-product-opportunitySkill
- simplify-code-safelySkill
- swift-api-design-guidelinesSkill
- The first 60 shown.
The file
Files
Input sanitization
The single highest-value secure-coding discipline: most vulnerabilities are mishandled untrusted input.
The principle: validate in, encode out
These are two different jobs — you usually need both:
- Validate at the boundary. Allow-list the shape/type/range you expect and reject early. Normalize first (Unicode, path, case), then validate — otherwise an encoded payload slips past.
- Encode at the sink. The same value is safe or dangerous depending on where it goes. Encode for the destination at the moment you use it, not once up front.
Per-sink rules
See reference.md for the table. The essentials:
- SQL / NoSQL: parameterized queries / prepared statements. Never string-build.
- Shell / OS command: pass an argument array to
exec; never build a shell string. Better: don't shell out. - HTML / template: context-aware output encoding (body vs attribute vs JS vs URL); let the template engine auto-escape; never inject untrusted HTML.
- Filesystem path: resolve and confirm the result stays within an allowed root; reject
... - Outbound URL (SSRF): allow-list destination hosts; block internal/link-local ranges.
Rules
- Allow-list, never block-list. Enumerating "bad" characters always misses one.
- Validation ≠ encoding. Passing validation doesn't make a value safe to concatenate into a query.
- Server-side only. Client-side validation is UX; the server must re-check everything.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

