app-security-hardening
Skill4 starsChanged 3 months agoMITView on GitHub
Harden an application against common security risks — validate inputs at boundaries, least-privilege access, safe secrets handling, dependency hygiene, and secure defaults. Load when shipping user-facing code, adding auth/session flows, handling untrusted data, exposing APIs, or the user asks for "security hardening", "OWASP hardening", "secure this feature". Not for skill-library security gates (use secure-skill family).
In this repository125 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/agent-loom-routing.mdcCursor rule
- .cursor/rules/agent-loom-skills-index.mdcCursor rule
- adversarial-hatSkill
- agent-builderSkill
- agent-launcherSkill
- agent-loom-syncSkill
- agent-observabilitySkill
- agent-run-retroSkill
- agent-system-architectureSkill
- api-and-interface-designSkill
- api-deprecation-and-migrationSkill
- apply-paper-to-projectSkill
- architectural-decision-logSkill
- assumption-mappingSkill
- brainstormingSkill
- browser-testing-with-devtoolsSkill
- business-modelingSkill
- ci-cd-and-automationSkill
- codebase-understandingSkill
- code-review-crspSkill
- code-simplificationSkill
- compress-skillSkill
- context-engineeringSkill
- create-agent-promptSkill
- cross-link-skillsSkill
- customer-discoverySkill
- debug-and-fixSkill
- deep-thinkingSkill
- dependency-mappingSkill
- deploy-anywhereSkill
- deprecate-skillSkill
- design-directionSkill
- design-reviewSkill
- design-systemSkill
- dynamic-routingSkill
- eval-judgeSkill
- eval-outputSkill
- eval-pipelineSkill
- eval-rubric-designSkill
- experimentationSkill
- experiment-backlogSkill
- experiment-readoutSkill
- experiment-runbookSkill
- experiment-specSkill
- fault-localizeSkill
- feature-specSkill
- fermiSkill
- first-principlesSkill
- frontend-designSkill
- generate-changelogSkill
- git-workflow-and-versioningSkill
- gsap-animationSkill
- harness-engineeringSkill
- harness-evolutionSkill
- harness-generationSkill
- idea-evaluationSkill
- idea-generationSkill
- implementation-planSkill
- improve-skillsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
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
- Distinctive: line 27
Treat all external inputs as untrusted: HTTP requests, headers, query params, cookies, env vars, webhooks, third-party APIs, user-generated …
- Distinctive: line 29
Never log secrets or credentials.
- Distinctive: line 30
Prefer deny-by-default authorization checks.
- Distinctive: line 74
Run a vulnerability scan tool if available in the project
- Distinctive: line 159
No changes — citation audit passed.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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
App Security Hardening
You reduce the chance and blast radius of security failures in application code. You focus on boundary validation, safe defaults, and least privilege — not theoretical checklists.
Hard Rules
- Treat all external inputs as untrusted: HTTP requests, headers, query params, cookies, env vars, webhooks, third-party APIs, user-generated content.
- Validate at boundaries (routes/controllers/handlers) and at trust transitions (external API responses, deserialization).
- Never log secrets or credentials. Redact by default.
- Prefer deny-by-default authorization checks; make allow-lists explicit.
- Security changes must include a verification step (test, repro, or scanner run).
Workflow
Step 1 — Define the surface
Write down:
- Entry points (endpoints, jobs, webhooks, CLI, UI forms)
- Data types crossing trust boundaries
- High-value assets (accounts, money, tokens, PII)
Step 2 — Boundary validation
For each entry point:
- Validate shape/types (schema/DTO)
- Validate constraints (length, ranges, enum allow-lists)
- Normalize (trim, lowercase where appropriate, Unicode normalization when relevant)
- Reject unknown fields (where feasible) to reduce ambiguity
Step 3 — AuthN/AuthZ hardening (when applicable)
- AuthN: secure session/token storage; rotation; expiration; CSRF strategy if cookie-based
- AuthZ: check permissions on every sensitive action; avoid "frontend-only" gating
- Multi-tenant: enforce tenant scoping on queries and writes (no implicit tenant)
Step 4 — Injection and unsafe execution
- SQL/NoSQL: parameterize queries; avoid string concatenation
- Command execution: avoid shelling out; if unavoidable, strict allow-list
- Template rendering: escape by default; avoid dangerouslySetInnerHTML-style patterns
Step 5 — Secrets, config, and logging
- Load secrets from secret manager / env (never commit)
- Redact tokens, emails, IDs where appropriate
- Fail closed on missing security-critical config (e.g., auth secret)
Step 6 — Dependency and supply-chain hygiene
- Prefer pinned lockfiles
- Minimize new deps; scrutinize transitive deps
- Run a vulnerability scan tool if available in the project
Step 7 — Verify and document
Pick the cheapest credible verification:
- Unit/integration tests for validators and authZ
- Repro steps for common attacks (IDOR, privilege escalation)
- Static analysis / dependency audit command
When NOT to use
- Skill-library security scanning or external content ingestion (use
secure-skill*) - Pure refactors with no change in security-relevant behavior (unless risk is suspected)
Gotchas
- “We validated on the frontend” is not validation.
- Multi-tenant bugs are often missing constraints, not fancy exploits.
- External API JSON can contain unexpected types; validate before trusting.
- Logging is an exfiltration channel; redact by default.
Common Rationalizations
| Excuse | Reality |
| "We’ll add security later" | Retrofits are expensive; boundary validation is cheapest at creation time. |
| "Frontend already checks this" | Attackers don’t use your UI. Validate server-side. |
| "It’s internal, not public" | “Internal” systems still get breached; least privilege still matters. |
| "We can just block obvious bad inputs" | Allow-lists beat deny-lists; constraints must be explicit. |
| "Logging helps debug" | Logging secrets creates permanent incident blast radius. Redact. |
Output Format
## App security hardening — [scope]
Surfaces reviewed: [list]
High-value assets: [list]
Hardening changes: [numbered list]
Verification: [tests/repro/scans] → [result]
Open risks: [remaining items + rationale]Examples
<examples>
<example>
<input>“Add a new endpoint that updates a user profile.”</input>
<output>
Validate request DTO at the route boundary, enforce authZ (user can only update self unless admin), normalize strings, reject unknown fields, ensure CSRF strategy matches session model, and add tests for IDOR and invalid payloads.
</output>
</example>
</examples>Verification
- Every external entry point has boundary validation (shape + constraints)
- AuthZ checks exist for every sensitive action (no frontend-only gating)
- Secrets are never logged; logs are redacted by default
- At least one verification step was run (tests/repro/scanner)
- Remaining risks (if any) are explicitly listed with rationale
Red Flags
- Frontend-only validation treated as sufficient
- Multi-tenant query missing account or tenant constraint
- Secrets or tokens logged in error or debug output
- External JSON trusted without schema or type validation
Prune Log
Last pruned: 2026-07-04
- No changes — citation audit passed; content current (improve-skills full pass 2026-07-04)
Impact Report
Scope: [endpoints/modules] | Surfaces: N
Validators added: [yes/no] | AuthZ checks: [yes/no]
Verification: [what] | Open risks: NDoes 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.

