Security check
Trace the target, not the whole application. Find each trust boundary the target crosses, then follow untrusted data from its source to its sink. Untrusted data includes requests, files, webhooks, third-party responses and model output.
review runs this trace inside its security dimension and gives the findings its own shape. Run on its own, it reports in the conversation.
1. Pin the target
Settle what you are checking, such as a ref, a path or the working tree, and what it is compared against. With an empty diff, say so and stop.
2. Trace and sweep
- Trace: For each trust boundary, follow the data through Untrusted data reaching a sink and Who is acting. Follow a control that lives outside the target, such as a gateway, when you can read it.
- Sweep: Walk the other sections wherever the target touches them, with or without a boundary, such as a new dependency or a CI change.
This step is done when every boundary has been traced and every section that applies has been walked.
3. Report
Present the report in the conversation:
- Target: What was checked, and what it was compared against.
- Boundaries: Each trust boundary traced, in one line each, so the user can see what was covered.
- Findings: Each one as a finding block, ordered Act on, Consider, Noted. Cite a secret by its location, never its value. With none, write "No findings."
- Closing line: Any control outside the target you couldn't read, and anything else you couldn't assess.
Each finding takes this block:
### <title: name the problem, not the category>
**Recommendation:** Act on / Consider / Noted · **Category:** Security · **Where:** `path/file.cs:42` · **Evidence rung:** <prove-it rung>
Why it matters, then the current shape and the suggested one, with code snippets only where prose is less precise.
- Act on: Fix before this ships.
- Consider: Worth doing, and it can wait.
- Noted: An observation, with no action expected.
Where lists every implicated file:line. A problem the change neither caused nor worsened is pre-existing: start its title with Pre-existing:, and recommend Noted or Consider.
Untrusted data reaching a sink
- Queries: Is data bound as parameters, including in raw ORM calls and dynamic
ORDER BY clauses?
- Commands: Does the code pass an argument array rather than a shell string?
- HTML: Is output contextually encoded? Check raw-HTML paths such as
innerHTML and dangerouslySetInnerHTML.
- Paths: Is the path canonicalized, then confirmed to sit inside the permitted root?
- Outbound URLs: Can the caller steer the destination, including through redirects? This is SSRF.
- Redirects: Is the target limited to known destinations?
- Deserialization: Can untrusted data reach
pickle, unsafe YAML loading, Java object deserialization, or an XML parser with external entities enabled?
- Code execution: Can it reach
eval, exec, Function, dynamic imports, or templates compiled from input?
- Regular expressions: Can input trigger catastrophic backtracking?
- Object mapping: Is input mapped to allowed fields only? Check mass assignment and prototype pollution.
- Prompts and model output: Can untrusted text steer an agent into using its tools? Is model output treated as untrusted before it reaches a sink?
Who is acting
- Object access: Does each read and write confirm that this caller may touch this specific record, including tenant scope?
- Function access: Is authorization enforced server-side on every new route, job and action?
- Sessions and tokens: Are cookies
Secure, HttpOnly and SameSite, and is the session rotated at login? Are a JWT's signature, algorithm, expiry and audience verified?
- Passwords: Are they hashed with Argon2, scrypt or bcrypt?
- CSRF: Do cookie-authenticated, state-changing requests carry a CSRF defence?
- Webhooks: Is the signature verified against the raw body?
- Races: Can a check-then-act sequence be raced, such as a balance check or a single-use token?
Secrets and sensitive data
- Secrets: Are they kept out of code and config? Treat a committed secret as compromised, and recommend rotating it.
- Logs and errors: Do secrets, tokens and personal data stay out of logs, traces and error responses?
- Responses: Does each response return only the fields this caller may see?
- Personal data: Is new collection or sharing necessary, and is the data protected at rest?
Cryptography
- Libraries: Does the code use established libraries and authenticated encryption, such as AES-GCM or ChaCha20-Poly1305?
- Randomness: Do tokens, keys and nonces come from a secure random source, with nonces never reused?
- Hashes: Are MD5 and SHA-1 absent from security-sensitive use?
- Comparisons: Are secrets compared in constant time?
Files and resource limits
- Uploads: Are size and content type checked, with files stored outside the web root under non-guessable names?
- Limits: Do parsing, pagination, and new expensive or authentication endpoints have limits?
Supply chain and configuration
- Dependencies: Is each new package needed, maintained, spelled correctly and locked? Do lockfile changes match the manifest?
- CI: Does untrusted pull request data stay out of
run: steps? Check pull_request_target, actions pinned to a commit SHA, and token permissions.
- Configuration: Check changed CORS rules, security headers, debug flags, TLS settings and default credentials.
C and C++
- Copies: Are they bounded, using
snprintf, std::string or std::span?
- Format strings: Are they constant?
- Memory: Check object lifetimes, use-after-free, and integer overflow before allocation.