$npx -y skills add selmakcby/claude-agents-skills --skill security-reviewAI-powered security vulnerability detection. Use PROACTIVELY after writing code that handles user input, authentication, API endpoints, payments, or sensitive data. Flags OWASP Top 10 issues with diff-aware scanning.
| 1 | <!-- |
| 2 | Source: anthropics/claude-code-security-review (official) |
| 3 | File: https://github.com/anthropics/claude-code-security-review/blob/main/.claude/commands/security-review.md |
| 4 | Used by: reviewer agent |
| 5 | --> |
| 6 | |
| 7 | # Security Review |
| 8 | |
| 9 | ## When to trigger |
| 10 | - After writing code touching auth, payments, API endpoints, file I/O, or user input |
| 11 | - Before commit on security-sensitive changes |
| 12 | - When user asks `/security-review` |
| 13 | |
| 14 | ## Scanning mode |
| 15 | |
| 16 | **Diff-aware:** only analyze changed files in the current PR/commit. |
| 17 | Focus on real vulnerabilities — filter out false positives aggressively. |
| 18 | |
| 19 | ## What to check (OWASP Top 10 mapping) |
| 20 | |
| 21 | ### 1. Injection |
| 22 | - SQL injection → parameterized queries? |
| 23 | - NoSQL injection → $where clauses, user-controlled operators? |
| 24 | - Command injection → `exec()` with user input? |
| 25 | - **Prompt injection** (AI-specific) → user input flowing into system prompts? |
| 26 | |
| 27 | ### 2. Broken authentication |
| 28 | - Missing auth checks on protected routes |
| 29 | - Weak password hashing (bcrypt/argon2 required) |
| 30 | - JWT misuse — missing signature verification, weak secrets, `none` algorithm accepted |
| 31 | - Session fixation, missing session rotation on login |
| 32 | |
| 33 | ### 3. Sensitive data exposure |
| 34 | - Hardcoded secrets in code |
| 35 | - API keys in client bundles (import in `"use client"` components) |
| 36 | - PII in logs |
| 37 | - Missing HTTPS enforcement |
| 38 | - Secrets in error messages |
| 39 | |
| 40 | ### 4. XML/XXE |
| 41 | - XML parsers with external entity processing enabled |
| 42 | |
| 43 | ### 5. Broken access control |
| 44 | - Missing authorization (authenticated but not authorized) |
| 45 | - IDOR (accessing other users' data by changing an ID) |
| 46 | - Privilege escalation paths |
| 47 | |
| 48 | ### 6. Security misconfiguration |
| 49 | - Default credentials |
| 50 | - Debug endpoints exposed in prod |
| 51 | - Missing security headers (CSP, HSTS, X-Frame-Options) |
| 52 | |
| 53 | ### 7. XSS |
| 54 | - `dangerouslySetInnerHTML` with user input |
| 55 | - Rendering LLM output without sanitization |
| 56 | - URL parameters reflected without escaping |
| 57 | |
| 58 | ### 8. Insecure deserialization |
| 59 | - `JSON.parse` with user-controlled content (usually fine in JS, but watch for prototype pollution) |
| 60 | |
| 61 | ### 9. Using components with known vulnerabilities |
| 62 | - Run `npm audit` mentally — are any flagged deps in critical paths? |
| 63 | |
| 64 | ### 10. Insufficient logging |
| 65 | - Security events unlogged (failed logins, permission denials) |
| 66 | - Overlogging (logging PII, tokens, passwords) |
| 67 | |
| 68 | ## AI-specific checks |
| 69 | |
| 70 | - **Webhooks:** signature verification present? (Stripe, GitHub, etc.) |
| 71 | - **Rate limiting:** on public endpoints? On AI endpoints especially? |
| 72 | - **Input length:** max length on LLM inputs? |
| 73 | - **Output validation:** Zod schema on LLM responses before rendering? |
| 74 | - **CORS / CSRF:** properly configured for auth endpoints? |
| 75 | |
| 76 | ## Severity (same as code-review) |
| 77 | |
| 78 | - **CRITICAL** — exposed secret, missing auth, unverified webhook, SQL injection, missing rate limit on AI endpoint |
| 79 | - **HIGH** — missing input validation, weak crypto |
| 80 | - **MEDIUM** — logging gaps, overly verbose errors |
| 81 | - **LOW** — defense-in-depth suggestions |
| 82 | |
| 83 | ## Output format |
| 84 | |
| 85 | ```markdown |
| 86 | ## CRITICAL |
| 87 | - [`<file>:<line>`] <vulnerability> (OWASP: <category>) |
| 88 | - Impact: <what an attacker could do> |
| 89 | - Fix: <specific mitigation> |
| 90 | |
| 91 | ## HIGH / MEDIUM / LOW |
| 92 | - ... |
| 93 | |
| 94 | ## Verdict |
| 95 | PASS | BLOCK (CRITICAL count: N) |
| 96 | ``` |
| 97 | |
| 98 | ## Rules |
| 99 | |
| 100 | - **Never hand-wave.** "This might be a risk" is not enough — say if it is or isn't, with evidence. |
| 101 | - **Every finding:** severity, OWASP category, file + line, attacker scenario, specific fix. |
| 102 | - **Rotate suspected exposed secrets immediately** and flag at top of report. |
| 103 | - **False positives are worse than no review** — if you're not sure, don't flag it. |
| 104 | - **AI endpoints get extra scrutiny** — token limits, output sanitization, rate limits. |