agentleFS
Robotti-ioRobotti-io/copilot-security-instructions/skills/input-validation-hardening/SKILL.md

input-validation-hardening

Skill42 starsChanged 10 months agoApache-2.0View on GitHub

Process for tightening input validation, canonicalization, and safe parsing to prevent injection and logic abuse.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when asked to validate inputs, harden request parsing, or prevent injection/abuse.

    line 10
  2. Distinctive:

    Prefer typed schemas (DTOs) and allow-lists

    line 24
  3. Distinctive:

    Ensure IDs map to authorized resources (ownership/tenant checks)

    line 30
  4. Distinctive:

    Avoid dynamic execution (eval, shell, template injection)

    line 33

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Input Validation Hardening

When to use

Use this skill when asked to validate inputs, harden request parsing, or prevent injection/abuse.

Inputs to collect (if available)

  • Entry points (HTTP endpoints, consumers, file parsers)
  • Data sensitivity and trust boundaries
  • Existing validation libraries/patterns in the codebase
  • Known attack/abuse cases (payloads, bypass attempts)

Step-by-step process

  1. Inventory inputs
    • HTTP params/body/headers, file uploads, message payloads, env vars, CLI args
  2. Define schemas
    • Prefer typed schemas (DTOs) and allow-lists
    • Enforce length, charset, ranges, and required fields
  3. Canonicalize early
    • Normalize encoding, trim, and apply consistent parsing (dates, IDs, enums)
  4. Validate before use
    • Reject unknown fields if possible
    • Ensure IDs map to authorized resources (ownership/tenant checks)
  5. Protect sinks
    • Parameterize DB queries
    • Avoid dynamic execution (eval, shell, template injection)
  6. Add tests
    • Boundary tests (min/max), malformed inputs, and common payloads

Output

  • Proposed schema(s)
  • Where to enforce validation (middleware/controller boundary)
  • Tests added/updated

Repo integration (optional)

Related prompts:

  • validate-input-handling.prompt.md
  • scan-for-insecure-apis.prompt.md

Output format

  • Inventory: inputs and boundaries
  • Proposed schema(s) (high-level)
  • Enforcement point: where validation should occur
  • Test plan: boundary + malicious inputs

Examples

  • “Public JSON API” → reject unknown fields, enforce max sizes, and add negative tests for type confusion and oversized payloads.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.