NextAuth Auth.js debug: true logs tokens in production
Rule ID: vetkit.js.auth.debug-enabled
The Auth.js / NextAuth config sets debug: true unconditionally. Debug mode logs provider tokens, session payloads and callback data to the server console in production.
Last updated:
Suite: Security
javascript, typescript
The Auth.js / NextAuth config sets debug: true unconditionally. Debug mode logs provider tokens, session payloads and callback data to the server console in production.
Category: SECURITY · Engine rule severity: WARNING
How to fix it
Tie debug logging to the environment, e.g. debug: process.env.NODE_ENV !== 'production' or debug: process.env.AUTH_DEBUG === 'true', and remove it before deploying.
References
Source: packages/engine/rules/sast/javascript.yml.
Related checks
- NextAuth allowDangerousEmailAccountLinking enabled
- NextAuth Auth.js hardcoded secret in source code
- JavaScript eval() with a dynamic argument: code injection
- Node.js code injection: request input loads a module
- Node.js child_process command injection from user input
- Node.js child_process exec with a dynamic command string
Check your own repository for this
vetkit runs this rule as part of a repository audit, alongside secret scanning, dependency vulnerabilities, code quality and AI code risk checks. It reads a temporary checkout and never executes your code.
Start with the free Security Quick Scan · See how the platform works
Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.