Skip to content

tobihagemann/turbo / codex/skills/review-code

review-code

Verified

Review code for bugs, security, API misuse, consistency, simplicity, or test coverage, with peer review in parallel. Use when the user asks to "review my code", "check for bugs", or "security audit".

references/security-review.md

View on GitHub
# Security Review Reference

## Review Instructions

Check if `.turbo/threat-model.md` exists at the repository root. If it does, read sections 2 (Trust Boundaries and Assumptions) and 3 (Attack Surface, Mitigations and Attacker Stories) to understand assets at risk, identified attack surfaces with existing mitigations, and attacker stories. Treat the entry points, sinks, and hot files listed by surfaces that intersect the reviewed scope as read targets, and use the attacker stories to prioritize findings. Treat the threat model as absent when a surface has no cited path that still resolves, ignoring any `:line` suffix. If no threat model exists, proceed without it.

### Review Mindset

Do not treat the existence of a check, sanitizer, or authorization guard as proof of safety. When a defense exists, reason about whether it actually constrains the value or state as intended across the full transformation and execution chain. A regex that validates a URL before decoding does not constrain the decoded URL. A permission check in one handler does not protect a second handler that skips it. Start from what the code is trying to guarantee, then look for ways that guarantee can fail.

Hold dismissals to the same standard. Refute a finding only with a mitigation you located and read. An expectation that the framework escapes the value, that the caller already validated it, or that the type constrains it stays an assumption until you have read the code that enforces it, and an assumption leaves the finding standing.

## What to Review

- **Injection** — SQL, command, template, LDAP, XPath, header injection via unsanitized input
- **Authentication and authorization** — missing or weakened auth checks, hardcoded credentials, insecure token handling, privilege escalation
- **Cryptographic misuse** — weak algorithms, hardcoded keys/IVs, nonce reuse, missing authentication (e.g., AES-CBC without HMAC)
- **Data exposure** — secrets in logs, error messages leaking internals, sensitive data in URLs or query params
- **Input validation** — missing or insufficient validation at trust boundaries, path traversal, open redirects
- **Insecure defaults** — debug mode, permissive CORS, disabled TLS verification, fail-open behavior
- **Deserialization** — untrusted data deserialization without type constraints
- **Dependency risks** — new dependencies with known CVEs, removed security-related dependencies
- **Race conditions** — TOCTOU bugs, unprotected shared state in security-critical paths
- **Transformation chain bypasses** — validation or sanitization that runs before encoding, decoding, normalization, or type coercion, allowing the constrained value to diverge after transformation
- **State and invariant violations** — workflow bypasses where security-critical operations proceed without required preconditions, missing state guards on multi-step processes
- **Resource management** — unbounded allocations from attacker-controlled input, missing rate limiting on sensitive endpoints

## Determination Criteria

Flag an issue only when ALL of these hold:

1. It is a concrete security weakness, not a theoretical concern or defense-in-depth suggestion
2. The vulnerability is discrete and actionable (not a general architecture issue)
3. The vulnerable code path is reachable with attacker-controlled input or attacker-influenced state
4. The author would likely fix the issue if aware of the security implications
5. The issue is demonstrable through a specific attack scenario, not speculation

## Priority Levels

- **P0** — Exploitable by remote unauthenticated attacker with immediate impact (RCE, auth bypass, credential theft)
- **P1** — Exploitable with preconditions (authenticated attacker, specific configuration, race condition)
- **P2** — Security weakness that increases attack surface or weakens defense-in-depth
- **P3** — Minor security hygiene issue with minimal direct impact

## What to Ignore

- Style and naming unless it creates a security-relevant ambiguity
- Defense-in-depth suggestions when the primary defense demonstrably holds (not just exists)
- Vulnerabilities in test code that cannot be reached in production

**Extra metadata:** `**Category:** <vulnerability class>` and `**Sink:** <sink line, verbatim> in <enclosing function or method>`

The sink is the line where attacker-influenced data reaches the dangerous operation. Quote it inside a code span so source punctuation survives rendering. Omit the `**Sink:**` field for findings with no data flow behind them, such as a weak algorithm choice, an insecure default, a hardcoded credential, or a dependency CVE.

**Verdict label:** `Security: <secure | concerns found>`
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall