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.
In this repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- aos-auditSkill
- aos-ciSkill
- aos-codereviewSkill
- aos-debuggingSkill
- aos-featureSkill
- aos-frontendSkill
- aos-generateSkill
- aos-implementing-featuresSkill
- aos-pragmaticSkill
- aos-qaSkill
- aos-refactorSkill
- aos-reviewSkill
- aos-scaffoldSkill
- aos-setupSkill
- aos-tddSkill
- aos-uxSkill
- aos-vuetifySkill
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
- Distinctive: line 13
Every state-changing or sensitive route has an auth guard.
- Very specific: line 14
Verify resource ownership: before any read or mutation — fetch by (id, ownerId), not just id.
- Distinctive: line 32
No hardcoded secrets, API keys, or tokens — read from env / secret manager.
- Distinctive: line 45
Don't leak stack traces or internal messages to clients — log them, return a safe error code + message.
≈ “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.
Files
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 justid. 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,SameSitecookies — neverlocalStorage. - 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
idand 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.
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.

