Skip to main content
HighAI codeOWASP A05:2021CWE-489

How to fix: Debug or Test Endpoint Exposed in Production

An internal debug, test, or health-check endpoint was found exposed with diagnostic information. AI-generated applications frequently include /debug, /test, /__health, or /api/debug routes that were never removed before deployment.

Why it matters

Debug endpoints can expose environment variables, database credentials, internal service URLs, memory dumps, query logs, and system information. They are often unauthenticated by design ('it's just for debugging').

AI tools generate debugging endpoints for development convenience. These endpoints frequently include environment variable dumps, database connection status, internal configuration, and request/response logging, all invaluable to an attacker.

How to fix it

  1. 1Remove all debug endpoints before deployment, or gate them behind strong authentication + IP allowlist.
  2. 2Use environment-specific middleware to disable debug routes in production.
  3. 3Check NODE_ENV === 'production' and return 404 for any debug endpoint.
  4. 4Audit all /debug, /test, /info, /status, /__health, /api/test routes.

Code examples

Gate debug endpoints

TypeScript
// Only expose in non-production environments
export async function GET(req: Request) {
  if (process.env.NODE_ENV === 'production') {
    return new Response('Not Found', { status: 404 });
  }
  return Response.json({
    env: process.env,
    // debug info...
  });
}

References

Detected automatically by VulnRadar. The check id is vibe-debug-endpoint, stable across every scan so you can filter or diff on it.

See every ai code check

Questions

How severe is Debug or Test Endpoint Exposed in Production?
VulnRadar rates this high severity in the ai code category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id vibe-debug-endpoint, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Debug or Test Endpoint Exposed in Production map to?
It maps to CWE-489. In the OWASP Top 10 it falls under A05:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for debug or test endpoint exposed in production

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

Debug or Test Endpoint Exposed in Production fix | VulnRadar