fix(auth): disable NextAuth debug mode in production#1748
Open
MinitJain wants to merge 3 commits into
Open
Conversation
Member
|
hey @greptileai please review |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…uest
console.log({ identifier, token }) and console.log({ email }) ran
unconditionally in the RESEND_API_KEY (production) path, writing raw
OTP codes and recipient emails to stdout on every auth request.
console.log("sendVerificationRequest") fired unconditionally.
All three are debug-only artifacts with no functional role. Dev fallback
path (!RESEND_API_KEY) is unchanged.
NODE_ENV !== "production" enables debug logging in test/staging/unset environments. === "development" restricts it strictly to local dev, preventing JWT/session data from appearing in staging logs. Addresses review suggestion from tembo.
2db8115 to
d995455
Compare
Contributor
Author
|
@richiemcilroy Typecheck CI is failing but these errors are pre-existing on Verified: the same 4 errors appear in the last CI run on
This PR only modifies |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
1. NextAuth debug flag
```ts
```
2. OTP logging in production email path
Removed from the `RESEND_API_KEY` (production) branch of `sendVerificationRequest`:
The dev fallback path (`!RESEND_API_KEY`) is unchanged — OTP codes still print to console in development.
Security Impact
NextAuth debug mode exposes session tokens and OAuth token data in stdout logs. In any hosted deployment, these logs are retained in log aggregation systems (Vercel, Datadog, CloudWatch, etc.), making every session token readable to anyone with log access.
The `console.log({ identifier, token })` statement had the same exposure profile: raw OTP code + user email written to prod stdout on every magic-link auth attempt.
Test plan