agentleFS
chiruu12chiruu12/claude-skills-template/.claude/skills/security-hardening/SKILL.md

security-hardening

Skill0 starsChanged 7 months agoMITView on GitHub

Apply concrete security hardening to a codebase. Covers input validation, auth, secrets management, dependency audit, and common vulnerabilities. Use when doing security review, hardening before launch, after a security incident, or when user mentions "security", "OWASP", "vulnerability", or "harden".

  • Reads credentials

31 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use data-engineering, observability and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • travisjneumanSkill

    data-engineering

    ETL/ELT pipelines, data warehousing (BigQuery, Snowflake, Redshift), stream processing (Kafka, Spark Streaming), orchestration (Airflow, Dagster, Prefect), dbt transformations, and data lake architecture. Use when building data pipelines, designing warehouse schemas, or implementing real-time data processing.

    Also in 3 projects that use this

  • OpenAISkill

    observability

    Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.

    Also in 6 projects that use this

  • AnthropicSkill

    incident-response

    Run an incident response workflow — triage, communicate, and write postmortem. Trigger with "we have an incident", "production is down", an alert that needs severity assessment, a status update mid-incident, or when writing a blameless postmortem after resolution.

    Also in 5 projects that use this

  • GitHubSkill

    accessibility-audit

    Audits actual components and routes against applicable WCAG 2.2 A/AA criteria using consumer-owned design-system evidence and repository tools. Use when asked for an accessibility audit, a11y check, keyboard or focus review, contrast check, or screen-reader verification.

    Also in 4 projects that use this

  • jarosser06Skill

    test-strategy

    Plans pytest test strategies for Drift's 90%+ coverage requirement using coverage analysis, edge case identification, and test suite design. Use when determining what tests to write, analyzing coverage gaps, or planning test strategies.

    Also in 3 projects that use this

  • jamestorrevillasSkill

    threat-modeling

    Use this skill when identifying security threats, designing secure systems, thinking like an attacker, performing security assessments, or applying STRIDE threat modeling. Trigger on keywords: threat model, security design, attack surface, STRIDE, vulnerabilities by design, security review, who can attack this, what could go wrong security-wise.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 28 edited versions we read keep these.

  • 8

    Distinctive

    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:

    Before launching to production

    line 16
  2. Distinctive:

    After a security incident or finding

    line 17
  3. Distinctive:

    Every input from outside the system must be validated before use:

    line 27
  4. Distinctive:

    Use allowlists, not denylists

    line 40
  5. Distinctive:

    Update dependencies with known CVEs immediately

    line 78
  6. Distinctive:

    Never log passwords, tokens, PII, or full credit card numbers

    line 84
  7. Distinctive:

    Don't expose stack traces to users in production

    line 85
  8. Distinctive:

    No rate limiting on authentication endpoints — brute force vulnerability

    line 103

“Common” is measured: kept by at least 6 in 10 of the 28 edited versions of this file we could read. “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

Apply concrete, actionable security practices — not vague advice. Every item here is a specific check with a specific fix. Security isn't a phase; it's a property of every line you write.

When to Use

  • Before launching to production
  • After a security incident or finding
  • During code review for security-sensitive code (auth, payments, PII)
  • Regular security audit cadence
  • NOT for threat modeling (use a dedicated threat model process)
  • NOT for compliance documentation (this produces code changes, not docs)

Process

1. Input validation at system boundaries

Every input from outside the system must be validated before use:

- HTTP request bodies, query params, headers
- File uploads (type, size, content)
- Environment variables at startup
- External API responses
- Database query results (when schema could drift)

Rules:

  • Validate at the boundary, trust internally
  • Reject invalid input early (fail fast)
  • Use allowlists, not denylists
  • Parameterize all SQL — never concatenate user input

2. Authentication and secrets

Always DoNever Do
Hash passwords with bcrypt/scrypt/argon2 (cost factor ≥ 12)Store passwords in plaintext or reversible encryption
Use httpOnly, secure, sameSite cookiesStore tokens in localStorage
Rotate secrets on suspected compromiseHardcode secrets in source code
Use environment variables or secret managersCommit .env files or credentials
Implement rate limiting on auth endpointsAllow unlimited login attempts

3. Output encoding

  • HTML: encode before rendering (prevents XSS)
  • SQL: use parameterized queries (prevents SQLi)
  • Shell: never pass user input to shell commands
  • URLs: encode path and query parameters

4. Headers and transport

Content-Security-Policy: default-src 'self'
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: DENY

5. Dependencies

# Check for known vulnerabilities
npm audit          # Node.js
pip audit          # Python
cargo audit        # Rust
  • Update dependencies with known CVEs immediately
  • Pin major versions to prevent supply chain attacks
  • Review new dependencies before adding (check maintainership, download count, last update)

6. Logging and error handling

  • Never log passwords, tokens, PII, or full credit card numbers
  • Don't expose stack traces to users in production
  • Log authentication failures with enough context to detect attacks
  • Implement structured logging for security events

Common Rationalizations

ShortcutWhy It Fails
"It's just an internal tool, security doesn't matter"Internal tools get exposed. Credentials get reused. Attackers pivot through internal systems. Internal ≠ safe.
"We'll add security later before launch"Security is architectural. Bolting it on later means redesigning auth flows, rewriting database queries, and retrofitting validation. It's 10x more expensive after the fact.
"This input comes from our own frontend, it's safe"Frontends can be bypassed. Anyone can send arbitrary HTTP requests. Server-side validation is the only validation that counts.
"The framework handles security for us"Frameworks provide tools, not guarantees. You still need to use them correctly — enable CSRF protection, configure CORS, use parameterized queries. Default isn't always secure.

Red Flags

  • User input concatenated directly into SQL queries — SQL injection
  • dangerouslySetInnerHTML or equivalent without sanitization — XSS
  • Secrets in source code or git history — credential exposure
  • No rate limiting on authentication endpoints — brute force vulnerability
  • eval() or shell exec with user input — code injection

Verification Checklist

  • All user inputs validated at system boundary (not just client-side)
  • Passwords hashed with bcrypt/scrypt/argon2 (cost ≥ 12)
  • No secrets in source code or git history
  • SQL queries use parameterization (no string concatenation)
  • Security headers configured (CSP, HSTS, X-Content-Type-Options)
  • npm audit / equivalent shows no high/critical vulnerabilities
  • Auth endpoints have rate limiting
  • Error responses don't leak internal details to users

Anti-patterns

  • DO NOT validate only on the client — server-side validation is the real boundary
  • DO NOT roll your own crypto — use established libraries (bcrypt, libsodium, etc.)
  • DO NOT store secrets in code, environment variable files committed to git, or client-side storage
  • DO NOT trust "internal" traffic — validate at every service boundary

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.