No debug routes active in production
Why it matters
Debug routes left without environment gates are live attack surface. They commonly dump internal state — full user tables, environment variables, session stores, database query results — to anyone who discovers them. OWASP A05:2021 (Security Misconfiguration) and CWE-489 (Active Debug Code) both cover this: the misconfiguration is shipping development tooling as production infrastructure. Discovery is trivial: common debug path patterns (/api/debug, /api/test, /playground) are in every web scanner wordlist, and AI-generated projects tend to follow identical naming conventions.
Severity rationale
Medium because the exploitability depends on what data the route exposes, but debug routes in AI projects frequently dump database contents or internal config without authentication.
Remediation
Either delete the route file entirely, or add an explicit production gate as the first statement in the handler. In app/api/debug/route.ts or app/playground/page.tsx:
export async function GET() {
if (process.env.NODE_ENV === 'production') {
return new Response(null, { status: 404 })
}
// debug logic below
}
Prefer deletion over gating — a 404 in prod still confirms the route exists to a scanner. Walk all route files matching /api/debug, /api/test, /api/__dev__, /api/dev, /debug, /playground, and /dev-tools path segments and either remove them or verify they are gated at the middleware layer (src/middleware.ts) with a hard NODE_ENV check.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the WIP-in-Production Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-489 — Active Debug Code
- owasp:2021 · A05
- soc2:2017 · CC6.6 — Protection against threats from outside system boundaries
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-slop-half-finished·automated
- 2026-07-06·v1.0.1·Add SOC 2 TSC mapping (CC6.6) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2