agentleFS
jamal-gmljamal-gml/anthropica/skills/secure-code-review/SKILL.md

secure-code-review

Skill0 starsChanged 11 days agoMITView on GitHub

Security-review code or a diff by tracing untrusted input source to sink (injection, IDOR/authZ, authN/session, SSRF, deserialization, path traversal, XSS, CSRF, crypto, secrets, logging, races, mass assignment), proving reachability, rating severity and giving fixes. Use when a change touches auth, user input, queries, file paths, server-side fetches, templates, crypto or secrets, or for a PR security review. Not for design-stage threats (use `plan-threat-model`).

19 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use vulnerability-triage, threat-modeling and 2 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.
  • superagent-aiSkill

    vulnerability-triage

    Triage inbound vulnerability reports - GitHub Advisories (GHSA/CVE), bug bounty submissions, HackerOne/Bugcrowd/Intigriti exports, or a researcher's issue - to decide whether a finding is real, by-design, or noise. Reads the report offline, cross-references the project's documented intent and threat model (SECURITY.md, README, code, closed issues), statically audits any PoC without executing it, and emits a structured markdown triage report with a P0-P3 / By-Design severity and a recommended action. Use whenever the user asks to triage, assess, or score a vulnerability report, advisory, CVE, GHSA, or bug bounty submission, or asks "is this a real finding or by-design?".

    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 4 projects that use this

  • AnthropicSkill

    competitive-analysis

    Framework for building competitive landscape decks — market positioning, competitor deep-dives, comparative analysis, strategic synthesis. Use when the user asks for a competitive landscape, competitor analysis, peer comparison, market positioning assessment, strategic review, or investment memo deck. Also triggers on "who are the competitors to X", "benchmark X against peers", "build a market map", or any request to systematically evaluate competitive dynamics across an industry.

    Also in 3 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 3 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 18 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Check framework defaults and gotchas: Read references/frameworks.md when the code uses Express/Node, Next.js/React, Django, Flask/FastAPI, …

    line 16
  2. Distinctive:

    Prefer allowlists over denylists.

    line 47
  3. Distinctive:

    Never claim the code is secure.

    line 49
  4. Distinctive:

    Do not run exploits, fuzzers or scanners against live or shared environments without written authorisation for that target.

    line 53
  5. Very specific:

    Never print, copy or commit secret values found during review: report location, type and first/last 4 characters at most, and recommend …

    line 54

“Common” is measured: kept by at least 6 in 10 of the 18 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

Secure Code Review

Find realistic, reachable vulnerabilities in code and prove each one with a source-to-sink trace. Fewer confirmed findings beat many speculative ones.

Procedure

  1. Scope the attack surface. For a diff: git diff --stat <base>...HEAD, then list new or changed entry points (routes, handlers, RPC methods, message consumers, CLI args, file parsers, webhooks, scheduled jobs reading external data). For a codebase: enumerate entry points from the router/framework config first. Read the threat model if one exists.
  2. Identify trust context per entry point: authenticated? which roles? tenant scoped? internet-facing? This decides severity later.
  3. Run cheap automation first, if available and offline-safe: semgrep scan --config p/default --config p/owasp-top-ten --error (or p/<language>), bandit -r src (Python), gosec ./... (Go), brakeman (Rails), eslint-plugin-security, plus gitleaks detect --no-banner --redact for secrets. Treat results as leads, not findings.
  4. Trace source to sink. For each untrusted source (params, body, headers, cookies, path, files, env from users, DB values written by users, third-party API responses, LLM output), follow data through transforms to dangerous sinks. Record each hop as file:line. Note validation, encoding or authorisation encountered and whether it is correct for that sink.
  5. Check every class in the table below against the changed code. Read references/vuln-classes.md for the detailed per-class checklist, sinks and safe patterns.
  6. Check framework defaults and gotchas. Read references/frameworks.md when the code uses Express/Node, Next.js/React, Django, Flask/FastAPI, Rails, Spring, ASP.NET, Go net/http, Laravel/PHP or an ORM.
  7. Prove reachability for each candidate: an attacker-controlled path from an entry point the attacker can call, with their privilege level, to the sink, with no effective control in between. If you cannot show it, report it as a hardening note, not a vulnerability.
  8. Rate, map and fix each finding (rules below). Give the minimal fix plus a regression test (unit or integration test that sends the malicious input and asserts rejection).
  9. Verify fixes by re-reading the patched path and running the tests and scanners again.

Class checklist (OWASP Top 10 2021 mapping)

ClassCore questionOWASP / CWE
Broken access control, IDOR/BOLAIs ownership/tenant checked server-side on every object read, write, list, export?A01 / CWE-639, 862, 863
Mass assignmentCan the client set fields like role, isAdmin, ownerId, price?A01 / CWE-915
CSRFDo cookie-authenticated state changes need a token or SameSite + origin check?A01 / CWE-352
Crypto misuseWeak algorithms, static IV/nonce, ECB, non-CSPRNG tokens, == on MACs, homemade crypto?A02 / CWE-327, 330, 208
Injection (SQL, NoSQL, OS, LDAP, template, header)Is input concatenated into an interpreter instead of parameterised?A03 / CWE-89, 78, 943, 1336
XSSIs output encoded for its context; any raw HTML sinks; CSP present?A03 / CWE-79
Race conditions / business logicCheck-then-act on balances, quotas, coupons, one-time tokens without locking or idempotency?A04 / CWE-362, 367
Security misconfigurationDebug mode, permissive CORS with credentials, missing headers, verbose errors?A05 / CWE-16, 942
AuthN / sessionToken validation (alg, aud, iss, exp), session rotation on login, logout revocation, reset-token entropy and expiry, rate limiting, enumeration?A07 / CWE-287, 384, 307
Insecure deserialization / integrityNative deserialisers on untrusted data, unsigned webhooks, YAML/XML with unsafe loaders?A08 / CWE-502, 345
Secrets in code / sensitive loggingHard-coded keys; tokens, passwords, PII or full requests logged?A09, A02 / CWE-798, 532
SSRFCan user input choose host, scheme, port or redirect target of a server-side fetch?A10 / CWE-918
Path traversal / file handlingUser input in file paths, archive extraction, upload names or content types?A01 / CWE-22, 434

Rules

  • Severity = impact x exploitability, after existing controls:
    • Critical: unauthenticated RCE, SQLi, auth bypass, cross-tenant data access, secret exposure of production credentials.
    • High: authenticated user reaches another user's data or admin function, stored XSS in a privileged view, SSRF to internal network/metadata, account takeover chains.
    • Medium: reflected XSS needing interaction, CSRF on non-critical actions, user enumeration, missing rate limits on login, sensitive data in logs.
    • Low: defence-in-depth gaps with no demonstrated path (missing header, weak but unexploitable config).
    • Raise one level if pre-auth or internet-facing at scale; lower one level if it needs an admin or an unlikely precondition. Give a CVSS v3.1/4.0 vector only if the team uses CVSS.
  • False-positive discipline: no finding without file:line for both source and sink and a stated attacker privilege. Check that the "missing" validation is not done in middleware, a decorator, a DB constraint, an ORM scope or the gateway before reporting. Parameterised queries, auto-escaping templates and framework CSRF protection are effective unless explicitly bypassed (raw, safe, dangerouslySetInnerHTML, csrf_exempt, string-built SQL).
  • Authorisation is checked on the server for the specific object, not just "is logged in"; list endpoints and exports need the same tenant filter as detail endpoints.
  • Prefer allowlists over denylists; validate type, length, range and format at the boundary, and encode at the sink. Sanitising on input for HTML is not a substitute for output encoding.
  • Fixes go to the root cause in a shared layer (query builder, authZ policy, HTTP client wrapper) when the same pattern appears in several places; list every other occurrence you found with rg.
  • Never claim the code is secure; state what was reviewed, what was not (e.g. infra, dependencies), and residual risk.
  • Hand dependency and CI findings to secure-supply-chain; repository setting gaps to secure-repo-governance; general correctness issues to review-pull-request.

Safety gates

  • Do not run exploits, fuzzers or scanners against live or shared environments without written authorisation for that target; use local or ephemeral environments and test accounts.
  • Never print, copy or commit secret values found during review: report location, type and first/last 4 characters at most, and recommend rotation (secure-supply-chain covers exposure response).
  • Proof-of-concept payloads go in private findings or tests, not in public issues or PR comments for unfixed vulnerabilities. Ask before posting review comments or opening issues.

Output

## Security review: <scope> (commit/PR, date)
**Reviewed:** entry points, files | **Not reviewed:** ... | **Tools run:** ...

| ID | Severity | Class (OWASP/CWE) | Location (sink) | Source -> sink trace | Attacker / precondition | Impact | Fix | Test |
|---|---|---|---|---|---|---|---|---|
| S1 | High | A01 IDOR / CWE-639 | `api/invoices.py:88` | `GET /invoices/<id>` path param -> `Invoice.get(id)` no owner filter | any logged-in user | read other tenants' invoices | scope query by `request.user.org_id` | `test_invoice_idor` |

**Hardening notes (not proven exploitable):** ...
**Residual risk / follow-ups:** ...

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.