/useful-loops:security-auditfrom useful-loops
This command should be used when the user asks to 'run a security audit', 'check for OWASP vulnerabilities', 'find security issues', or 'harden the app'. Runs one iteration: systematically checks 1-2 OWASP categories, fixes issues, validates, PRs, runs CI, and merges.
Ships in useful-loops. Installing the plugin adds it to Claude Code.
You are performing one complete security audit iteration. Report progress at each phase.
Ensure you are on main with the latest code:
git checkout main && git pull origin main
Read docs/plans/security-audit-tracking.md to find the last iteration number. Your iteration is N+1. If no iterations exist yet, you are iteration 1. If the tracking file does not exist, create it:
# Security Audit Tracking
Automated OWASP-aligned security audit. 10 categories to cover.
---
## Iteration Log
Create an iteration branch:
git checkout -b security-audit/iteration-<N>
Review which categories were already audited in prior iterations. Pick the next 1-2 unaudited categories from the list below.
Work through 1-2 categories per iteration, thoroughly. Read every relevant file.
| # | Category | What to check | OWASP |
|---|---|---|---|
| 1 | Auth & Access Control | Every mutation requires authentication. Every query scopes data to the authenticated user/tenant. No privilege escalation paths. No way to access another user's data. | A01 |
| 2 | Input Validation | All user inputs validated before use (Zod, Joi, or equivalent). No raw string interpolation in queries. Max lengths enforced. Enum validation on constrained fields. | A03 |
| 3 | Authorization & Row-Level Security | Database-level authorization (RLS policies, tenant scoping) on every table. All CRUD operations have policies. Privacy filters on sensitive data. | A01 |
| 4 | Secret Management | No hardcoded secrets. No secrets in client bundles or public env vars. Secrets validated before use. Service keys restricted to server-only code. | A02 |
| 5 | Security Headers | CSP, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy present and restrictive. All responses include headers. | A05 |
| 6 | Dependency Vulnerabilities | Run npm audit (or equivalent). Check for known CVEs. Apply non-breaking fixes. Flag breaking changes as deferred. | A06 |
| 7 | Rate Limiting | Check all public-facing endpoints. Identify unprotected surfaces. Add rate limiting where straightforward. | A04 |
| 8 | Error Handling | No stack traces or internal details in error responses. Generic messages for auth failures. No database details leaked. | A09 |
| 9 | CSRF/Session | Auth cookies use HttpOnly + Secure + SameSite. No session tokens in URLs. Session refresh on every request. No session fixation vectors. | A07 |
| 10 | Data Exposure | No sensitive data in logs. No PII in URL parameters. Data export requires auth. Privacy flags respected in all queries. | A02 |
For each category:
Follow the Validate phase in references/common-lifecycle.md. Security fixes are particularly likely to break E2E tests — check for stale assertions on auth flows, headers, and redirects.
Append a new entry to docs/plans/security-audit-tracking.md:
### Iteration N (YYYY-MM-DD)
**Categories Audited:** [list]
**Findings:** X (Y HIGH, Z MEDIUM)
**Fixed:** A
**Deferred:** B
#### Fixed
- [x] Description (category: X, severity: HIGH/MEDIUM)
#### Deferred
- [ ] Description (category: X, severity: Y, reason)
#### Categories Remaining
- [list of unaudited categories]
If issues were found and fixed: follow the Ship phase in references/common-lifecycle.md with:
security-audit/iteration-<N>security: fix findings from security audit iteration NSecurity Audit: Iteration NAutomated OWASP security audit. See docs/plans/security-audit-tracking.md for details.If NO issues found AND all 10 categories audited: skip to Phase 8.
Follow the CI & Merge phase in references/common-lifecycle.md.
Completion requires BOTH conditions:
If both conditions met, output exactly:
<promise>NO_ISSUES</promise>
If either condition is NOT met, exit normally. If running in a Ralph Loop, the loop will re-invoke for the next iteration.
Only output this promise if you genuinely audited all categories and verified no actionable findings remain.
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub neonwatty/useful-loops --plugin useful-loops24 commands in this plugin
/beta-auditThis command should be used when the user asks to 'run a beta audit', 'check beta readiness', 'is the app ready for beta', or 'find beta-readiness gaps'. Runs one iteration: explores the app holistically for beta-readiness gaps, fixes code issues, collects manual to-dos, validates, PRs, runs CI, and merges./beta-audit-loopThis command should be used when the user asks to 'loop beta audit', 'keep auditing for beta readiness', or 'fix all beta issues'. Loops beta audit iterations until no HIGH/MEDIUM code findings remain. Requires ralph-loop plugin./ci-auditThis command should be used when the user asks to 'optimize CI', 'audit CI pipeline', 'speed up GitHub Actions', 'reduce CI time', 'make CI faster', or 'harden CI permissions'. Runs one iteration: analyzes 1-2 CI dimensions across multiple measurement axes (timing, billable minutes, hygiene, flakiness), applies fixes, re-measures, and merges./ci-loopThis command should be used when the user asks to 'loop CI audit', 'fully optimize CI', 'audit all CI dimensions', or 'do a full CI optimization sweep'. Loops CI audit iterations until all 9 dimensions are covered and no issues remain. Requires ralph-loop plugin./doc-refineThis command should be used when the user asks to 'refine a document', 'improve this doc', 'polish documentation', or 'apply a prompt to a document'. Runs one iteration: applies a prompt-driven analysis to a document, identifies improvements, and applies them./doc-refine-loopThis command should be used when the user asks to 'loop doc refine', 'keep refining a document', or 'iteratively improve documentation'. Loops doc-refine iterations until no further improvements are found. Requires ralph-loop plugin.Other plugins' commands for the same job