Security Audit
Run a security audit with OWASP, STRIDE, supply chain and platform-specific checks.
This playbook audits a codebase starting from infrastructure (secrets, dependencies, CI/CD) and then code patterns.
Best for: Before releases, after incidents, onboarding a new codebase Time estimate: 15 to 30 minutes Skills used: mk:cso, mk:vulnerability-scanner Agents involved: security (joins automatically on auth, payments and similar risk surfaces)
Two levels of scanning
mk:vulnerability-scanner does code-level analysis: OWASP Top 10 and supply-chain checks. mk:cso is the fuller audit. It starts with secrets, dependencies and the CI/CD pipeline, then adds OWASP and STRIDE threat modeling.
Step 1: Choose the depth
/mk:vulnerability-scanner # code-level scan
/mk:cso # daily mode: all phases, 8/10 confidence threshold, little noise
/mk:cso --comprehensive # monthly deep scan: 2/10 bar, surfaces more
/mk:cso --scope auth # focused audit of one domain
/mk:cso --diff # only what changed on this branch--infra, --code, --skills, --supply-chain and --owasp limit the audit to one area; at most one of them can be used at a time, and each combines with --diff.
Step 2: What the audit covers
| Phase | What it checks |
|---|---|
| 0 and 1 | Stack detection, architecture and attack surface |
| 2 and 3 | Secrets in git history and .env files, dependency supply chain |
| 4 to 6 | CI/CD pipelines, Docker and infrastructure as code, webhooks |
| 7 and 8 | LLM and AI security, skill supply chain |
| 9 to 11 | OWASP Top 10, STRIDE threat model, data classification |
| 12 | False-positive filtering |
| 13 and 14 | Report and saved JSON, with remediation roadmap |
Phases 0, 1, 12, 13 and 14 always run.
Step 3: Read the findings
Each finding states the vulnerability, the file and line, the root cause, the impact and a specific fix:
CRITICAL: Hardcoded AWS key in src/config/aws.ts:12
Impact: full AWS account access if leaked
Fix: move it to an environment variable and rotate the exposed key
HIGH: SQL query built with string interpolation in src/api/users.ts:45
Fix: use a parameterized queryStep 4: Platform rules
The patterns in .claude/rules/security-rules.md are blocked when new code is written and flagged as warnings when existing code is reviewed. Examples:
| Platform | Checks |
|---|---|
| NestJS | Auth guards on every route, ConfigService instead of raw process.env |
| Vue | No v-html with user content, no localStorage for auth tokens |
| Swift | Keychain instead of UserDefaults for sensitive data, default certificate validation |
| Supabase and PostgreSQL | Row Level Security enabled, service_role key only on the server |
BLOCK verdicts
If the security agent finds a critical vulnerability, it issues a BLOCK verdict and states the findings and the required fix. Under the agent's rules, no other agent clears a BLOCK: after you fix the issue, the security agent audits again and only then lifts it. A BLOCK is a verdict in the workflow, not a hook. The ship check at commit and push time covers lint, related tests and type-check only.
Next
Refactoring covers safely improving existing code.