Skip to content
Skills Library
Security · Building & coding

input-validation

/input-validation

Validate untrusted input at every trust boundary with allowlists, canonicalization, and hard limits so malformed data never reaches logic. Use when accepting data from requests, files, uploads, or third-party APIs.

Repository
AI-SKILLS ↗
Licence
MIT
Last repository change
05.09.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 05.09.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Validate untrusted input at every trust boundary with allowlists, canonicalization, and hard limits so malformed data never reaches logic. Use when accepting data from requests, files, uploads, or third-party APIs.

Original author description

Validate untrusted input at every trust boundary with allowlists, canonicalization, and hard limits so malformed data never reaches logic. Use when accepting data from requests, files, uploads, or third-party APIs.

How it works

  1. Method
  2. Checks
  3. Boundaries
Original SKILL.md headings · 51 lines, 411 words
SKILL.md preview
---
name: input-validation
description: Validate untrusted input at every trust boundary with allowlists, canonicalization, and hard limits so malformed data never reaches logic. Use when accepting data from requests, files, uploads, or third-party APIs.
---

# Input validation

Input validation is the wall between the outside world and code that trusts
its arguments. It fails when validation is scattered, negative (blocklists),
or run after the value has already been used. Do it once, at the boundary,
before anything downstream reads the value.

## Method

1. **Validate at the boundary, not deep in the stack.** Check input where it
   enters: the request handler, the deserializer, the file parser. Once a
   value passes the wall, downstream code may assume it is well-formed.
   Validation buried three calls deep leaves the first two calls exposed.
2. **Prefer allowlists over blocklists.** Define what is legal (a set of
   country codes, `^[a-z0-9_]{3,32}$` for a username, an enum of statuses)
   and reject the rest. Blocklists lose: attackers find the encoding, the
   Unicode homoglyph, or the case you did not enumerate.
3. **Canonicalize before you check.** Normalize first, validate second, or
   an attacker slips past with an alternate encoding. Decode
   percent-encoding, resolve `..` and symlinks in paths, apply Unicode
   NFC, lowercase the host. Validating the raw form then using the decoded
   form is the classic path-traversal bug.
4. **Cap length, count, and depth.** Set a maximum on every string, array,
   upload, and nested-JSON depth. A 2 GB "username" or a 10,000-level nested
   object is a denial of service you accepted by omission. Reject at the
   limit with a clear error.
5. **Check type and range, then parse to a typed value.** Confirm the
   integer is an integer within bounds, the date parses, the enum is a
   member. Convert to the real type at the boundary so downstream code
   handles `int` and `Date`, not `str`.
6. **Fail closed with a specific error.** On invalid input, reject and stop;
   do not coerce, truncate silently, or "fix" it. Say which field failed and
   why, but never echo the raw bad value into an error page unescaped.

## Checks

- Does each field have an explicit rule, or does some input reach logic only
  because nothing rejected it?
- Do you canonicalize before validating everywhere a value is later decoded?
- Is there a length or size cap on every unbounded input, including request
  bodies?

## Boundaries

Input validation shrinks attack surface; it does not replace output encoding
or parameterized queries. A validated string can still be dangerous in a SQL
statement or an HTML page, so defend those sinks separately (see
sql-injection-defense and xss-defense). Ownership checks (does this user own
this order?) belong with authorization, not here.

Versions

RepositoryScoreLicence
This page · Amey-Thakur/AI-SKILLS100MIT
drvoss/everything-copilot-cli100MIT
jeremymorgan/code-review-skills90CC0-1.0

Database snapshot: 13.11.2026 · package version b35c63e99fa7 (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

  • 90security-boundaries
    Use when untrusted input, credentials, permissions or tenant boundaries may permit unintended access.
  • 100harden
    Harden code where untrusted input enters the system. Use when implementing auth, handling user input, storing sensitive data, integrating external APIs, adding file uploads or LLM features, or crossing any trust boundary. Don't use for secret scanning (/safe-repo) or dependency CVEs (/deps-audit).
  • 100security-hardening
    Audits a change or a system for reachable vulnerabilities by tracing untrusted input to its sinks and checking authorization at every new path. Use when code touches authentication, secrets, cryptography, file paths, shell execution, deserialization, or any input crossing a…
  • 100input-validation-injection
    Apply when reviewing or writing code that processes untrusted input, constructs queries or commands, or handles user-supplied data. Covers SQL, LDAP, OS command injection, prototype pollution, and general validation strategy.
  • 100security-verification
    Check that every user-input surface is validated and sanitized — forms, textareas, query and URL params, external data. Use when asked to verify input validation, audit sanitization, or confirm untrusted input is handled safely.
  • 100security-verification
    Check that every user-input surface is validated and sanitized — forms, textareas, query and URL params, external data. Use when asked to verify input validation, audit sanitization, or confirm untrusted input is handled safely.

Feedback and reports

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