agentleFS
riz007riz007/architect-os/skills/aos-hardening/SKILL.md

aos-hardening

Skill1 starsChanged 7 months agoMITView on GitHub

Apply secure-by-default patterns whenever touching authentication, authorization, user input, database queries, file uploads, secrets, tokens, sessions, or HTTP responses. Use proactively while writing or reviewing such code — not only when asked for a security review. Catches IDOR, injection, secret leakage, missing validation, and unsafe token storage before they ship.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every state-changing or sensitive route has an auth guard.

    line 13
  2. Very specific:

    Verify resource ownership: before any read or mutation — fetch by (id, ownerId), not just id.

    line 14
  3. Distinctive:

    No hardcoded secrets, API keys, or tokens — read from env / secret manager.

    line 32
  4. Distinctive:

    Don't leak stack traces or internal messages to clients — log them, return a safe error code + message.

    line 45

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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

Security hardening

This is a model-invoked discipline. When code touches a sensitive surface, apply these defaults as you write it. They are self-contained; the repo need not be present.

Authentication & authorization

  • Every state-changing or sensitive route has an auth guard. No "we'll add it later."
  • Verify resource ownership before any read or mutation — fetch by (id, ownerId), not just id. This is the #1 source of IDOR bugs.
  • Authorization is enforced server-side in the service layer, never only in the UI.

Input validation

  • Validate and parse every external input at the boundary (Zod / class-validator / Pydantic). Reject unknown fields; don't trust client-supplied IDs or roles.
  • Validate type, range, length, and format — not just presence.

Injection & queries

  • Parameterised queries / ORM bindings only. Never concatenate user input into SQL, shell commands, or file paths.
  • Escape or sanitize anything rendered into HTML; rely on framework auto-escaping.

Secrets & tokens

  • No hardcoded secrets, API keys, or tokens — read from env / secret manager.
  • Auth tokens in httpOnly, Secure, SameSite cookies — never localStorage.
  • Strip sensitive fields (password hashes, internal flags, other users' data) from every response. Return a DTO, not the entity.

File uploads

  • Validate content type and size; never trust the filename or extension.
  • Store outside the web root; generate server-side names; scan if untrusted.

Responses & headers

  • Set security headers (CSP, HSTS, X-Content-Type-Options, frame options).
  • Don't leak stack traces or internal messages to clients — log them, return a safe error code + message.

Quick self-check before finishing

  • Could another user pass an id and read/modify data that isn't theirs? (IDOR)
  • Is every input validated and every output a DTO?
  • Did any secret, token, or hash end up in code, logs, or a response?

For a full, on-demand audit (auth, IDOR, secrets, uploads, payments) use /aos-audit.

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.