Guide
What you get: A read-only security audit of routes and code that ranks findings by impact with file:line evidence and a concrete fix for each. Best for Developers about to release, or who just touched auth, user input or a write endpoint..
Before you start
- Code to audit in the repo
- Claude Code with .claude/agents/ (or Codex with .codex/agents/)
- Fill in project_name and audit_command
- Fill in audit_command (for example npm audit); the agent may now run it, plus git log and git grep, but never edits files
Worked example (Oct 17, 2026, Claude Code 2.1.296; Codex 0.151.0 (gpt-5.6-sol))
Input
Planted route src/app/api/notes/route.ts (fake, local): GET puts the `q` query parameter into SQL and straight into a text/html response; DELETE builds SQL by string concatenation from the request body and has no auth check. Request: "Use the security-auditor subagent to audit the notes API in src/app/api/notes/route.ts."
Result
Claude Code: the security-auditor subagent (Read/Grep/Glob only) reported, ranked: anyone can delete any note (no login or ownership check), SQL injection in DELETE (route.ts:15) and GET (route.ts:6), reflected XSS in GET (route.ts:7), plus validation, rate limits and headers, each with a fix. It said it could not run `npm audit --omit=dev` or search git history because it has no shell. Codex: the security-auditor agent reported missing auth, reflected XSS and SQL injection in both handlers, then validation and rate limiting. Both left the repo unchanged (`git status` clean).
Test project: fresh create-next-app (Next.js 16.4.2, TypeScript), Node 24.14.1. Blanks filled with project_name = "demo-app (Next.js 16 + TypeScript)". Claude Code: body saved as .claude/agents/<name>.md, run headless with `claude -p "Use the <name> subagent to ..." --permission-mode acceptEdits`. Codex: converted to .codex/agents/<name>.toml (name, description, developer_instructions) and run with `codex exec -m gpt-5.6-sol -s workspace-write "Use the <name> agent to ..."`. Subagent use was confirmed from Claude Code's stream-json log (Agent call with subagent_type) and from Codex session logs (spawn_agent with agent_type, and the agent's instructions present in the child session). Claude Code: no extra tools allowed. All three planted issues were found by both tools. In Codex the agent ran shell commands (git history scan, `npm audit`, which failed offline in the sandbox) because the TOML has no tool restriction; it did not modify files. After this test it may run read-only commands (the audit command, git log, git grep); before, it was told to run them without permission to.
How to check it worked
- Check each finding points at a real file:line and try the exploit locally if it is cheap
- Run the dependency audit command yourself; the Claude Code version cannot run it
- Run `git status` afterwards to confirm nothing was changed
Common problems
- With only Read, Grep and Glob it cannot run `npm audit` or search git history, even though the instructions ask for both
- It can report many lower-priority items; fix the top-ranked ones first
- In Codex the read-only tool list is not carried over
Log in to join the discussion.