Source-to-sink method used by the Code Review Crew's security reviewer to find exploitable vulnerabilities in a code change or feature - injection, access control, auth, secrets, SSRF, path traversal, XSS, deserialization, crypto, LLM prompt injection, supply chain and CI - with a false-positive filter so only reachable issues are reported. Use when asked for a security review of code.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Code Review Security?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/mhdaljuboori-code-review-security)
---
name: code-review-security
description: Source-to-sink method used by the Code Review Crew's security reviewer to find exploitable vulnerabilities in a code change or feature - injection, access control, auth, secrets, SSRF, path traversal, XSS, deserialization, crypto, LLM prompt injection, supply chain and CI - with a false-positive filter so only reachable issues are reported. Use when asked for a security review of code.
---
# Security review
Report only what an attacker can reach. Every finding needs an entry point, a path and an impact.
## 1. Model the system (2 minutes)
- What is it (public web app, internal API, CLI, library, desktop app, infra-as-code)? Who are the attackers (anonymous internet, logged-in users, other tenants, local users, malicious input files, compromised dependency)?
- Entry points in the change: HTTP routes, message handlers, CLI args, file/URL inputs, webhooks, env/config, IPC, uploaded files.
- What the project already uses for auth, validation, escaping, queries, secrets. Code that bypasses those helpers is a smell.
## 2. Trace sources to sinks
For each untrusted input in the change, follow it to where it is used:
| Sink | Look for | Control that makes it safe |
|---|---|---|
| SQL / NoSQL query | string concatenation, f-strings, template literals, `$where`, raw query helpers | parameterized queries / ORM bindings; allow-list for identifiers (column, sort order) |
| Shell / process | `exec`, `system`, `shell=True`, backticks, building a command string | argument arrays, no shell; allow-list; never pass user input as an option (`--` separator) |
| File system | joining user input into a path, archive extraction, upload filenames | resolve then check it stays under the base dir; generate names server-side; reject `..`, absolute paths, symlinks |
| Outbound HTTP (SSRF) | fetching a user-supplied URL, webhooks, image/preview fetchers | allow-list hosts; block private, loopback, link-local and metadata IPs after DNS resolution; no redirects to them |
| HTML / templates (XSS) | `innerHTML`, `dangerouslySetInnerHTML`, `v-html`, `|safe`, unescaped template output, `javascript:` URLs, user-controlled `href`/`src` | framework auto-escaping; sanitizer (DOMPurify) for rich text; URL scheme allow-list; CSP |
| Deserialization | `pickle`, `yaml.load`, Java/PHP/.NET native deserialization, `eval`, `new Function` | safe loaders (`yaml.safe_load`), JSON with schema validation |
| Redirects | `redirect(req.query.next)` | relative-path or allow-listed host only |
| Logs | user input or secrets in log lines | strip newlines (log forging); never log tokens, passwords, full card numbers, PII beyond need |
| Regex | user-controlled pattern or catastrophic backtracking on user input (ReDoS) | escape user input; linear-time engines or bounded patterns |
| XML | external entities | disable DTDs/external entities |
| LLM prompt or tool call | untrusted text (emails, web pages, user content, file contents) concatenated into a prompt that can call tools, read secrets or take actions | treat model output as untrusted; least-privilege tools; human confirmation for side effects; never put secrets in the prompt |
| Object merge (JS) | deep merge or `obj[key] = value` with user-controlled keys (`__proto__`, `constructor`, `prototype`) | reject those keys; `Object.create(null)`; `Map` |
| File check then use | `exists()`/`stat()` then `open()` on a path others can change (TOCTOU) | open once and check the handle; atomic create (`O_EXCL`); safe temp files |
## 3. Access control and auth (the most common real bugs)
- Every new route, handler, WebSocket message and GraphQL resolver (and field): authenticated? Authorized for **this object** (IDOR: `GET /orders/:id` without checking the order belongs to the caller)? Tenant-scoped queries in multi-tenant systems?
- Role checks on the server, not only hidden in the UI. Mass assignment (`User.update(req.body)` letting callers set `role` or `isAdmin`).
- Session/token: expiry, revocation, rotation on privilege change; JWT `alg` pinned and signature verified; tokens not in URLs.
- Password and reset flows: rate limits, constant-time comparison of secrets, single-use expiring reset tokens, no user enumeration in messages.
- CSRF on cookie-authenticated state-changing requests; CORS not reflecting arbitrary origins with credentials.
## 4. Secrets and crypto
- Hard-coded keys, tokens, passwords, connection strings, private keys (including in tests, fixtures, docs, `.env` committed). Report file and line only, never the value. If it was committed, recommend rotating it: it stays in git history.
- Secrets shipped to the client: server keys in frontend env vars (`NEXT_PUBLIC_*`, `VITE_*`, `REACT_APP_*`), in mobile app bundles, or in source maps.
- Crypto: no MD5/SHA1 for passwords (use bcrypt/scrypt/argon2), no ECB, no static IV/nonce, randomness from a CSPRNG for tokens, TLS verification never disabled (`verify=False`, `rejectUnauthorized: false`).
## 5. Supply chain and config
- New or bumped dependency: needed? maintained? name close to a popular package (typosquat)? install scripts? Pinned? Audit only the added or bumped packages with the ecosystem's tool if the network is available; otherwise list it as not checked.
- Once you confirm a bug, look for its variants: the same pattern elsewhere in the change (and note obvious ones outside it as pre-existing).
- CI/workflow changes: `pull_request_target` with checkout of PR code, secrets exposed to forks, unpinned third-party actions, script injection via `${{ github.event.* }}` in `run:`.
- Infra/config: public buckets, `0.0.0.0` binds, debug mode on, permissive IAM (`*`), security headers removed.
## 6. False-positive filter (apply before reporting)
Drop the finding if:
- An upstream check already blocks the input (show you looked).
- The input is not attacker-controlled in this deployment (a build-time constant, an admin-only local CLI flag) and the impact needs it to be.
- The framework handles it by default (React text escaping, ORM parameter binding) and the code doesn't bypass it.
- It's generic hardening with no path to impact (missing rate limit on an internal tool, "add a WAF", theoretical timing attack on a non-secret).
- It's denial of service by a single authenticated user on their own resources.
## Severity
Critical: remote/unauthenticated → code execution, data breach, account takeover. High: needs an account or one precondition, same impact; secret exposure. Medium: limited scope or hard preconditions. Low: hardening.
## Finding format
`[Severity] path:line, class (CWE-nnn)` → **Attack** (who sends what, gets what) → **Path** (source → checks → sink, with lines) → **Fix** (specific; prefer the project's existing helper) → **Scope** (in change / pre-existing; a change that makes an old bug newly reachable is in the change).