input-validation-hardening · git:20261120.76a1b83 · 2026-11-20 · sha256 7760556f4311c9ae
input-validation-hardening git:20261120.76a1b83B
Immutable. This exact content never changes and is served at /api/v1/blob/7760556f4311c9ae.
No tool to install first
claude plugin marketplace add https://markdownregistry.com/mp/a/art_v5es4ypayqst7ftt/7760556f4311c9ae9638c8c51f937b5c373f75098b68d3e02c605acedbf05946.json
Then /plugin install input-validation-hardening@markdownregistry-v5es4ypayqst7ftt in Claude Code. It installs this exact version, the one graded B here, pinned to the commit it was graded at, and leaves it there.
--- name: input-validation-hardening description: Adds allowlist validation where data enters your code and context-correct encoding where it leaves, closing injection paths at every trust boundary. --- # Input validation hardening Validate on the way in with allowlists. Encode on the way out for the exact context. ## Steps 1. List the trust boundaries: HTTP bodies, query strings, headers, cookies, uploaded files, webhooks, queue messages, environment and third-party API responses. 2. For each, check whether a schema runs before the data is used. Reuse the project's library (zod, joi, pydantic, class-validator, Bean Validation). Do not add a second one. 3. Write schemas that state: type, length range, character set or pattern, enum of allowed values, numeric bounds. Reject unknown fields. Prefer "must match" over "must not contain". 4. Validate on the server even when the client validates too. 5. Find sinks and match each to its defence: - SQL: parameters, never concatenation. - HTML: framework auto-escaping; no raw-HTML insertion without a sanitizer. - Shell: argument arrays, no shell string building. - File paths: resolve and confirm the result stays inside the base directory. - URLs for server-side fetches: allowlist hosts. 6. Return a generic 400 with field names, not internals. 7. Add tests with hostile inputs: empty, huge, wrong type, `'; --`, `<script>`, `../`, null bytes. ## Rules - Never fix a vulnerability by blocklisting bad strings. - Normalize before validating (trim, Unicode normalization), not after. - Change one boundary at a time and keep the tests green. ## Report Boundaries covered, schemas added, sinks fixed, tests added, and boundaries still open.