You inspect a Node server.js containing process.env.OPENAI_API_KEY || "sk-live-..." and an unauthenticated /api/debug-env endpoint. Why is this an instant P0 fail and how do you fix it?
Committed fallback credentials remain readable to anyone cloning the repo, and /api/debug-env leaks live database passwords and API secrets over HTTP. Delete debug routes immediately, scrub git history / rotate compromised keys, fail fast on startup if required secret env vars are absent, and load credentials cleanly from IAM/Secrets Manager.
// BAD: secret fallback + public leak
const key = process.env.OPENAI_API_KEY || "sk-live-HARDCODED";
// GOOD: fail-fast startup + zero debug exposure
const key = process.env.OPENAI_API_KEY;
if (!key) throw new Error("Missing required OPENAI_API_KEY");/api/debug-env behind a weak URL query password.