Skip to content

fix(auth): redact PII from sign-in logs and gate debug to dev#4

Open
abdout wants to merge 1 commit into
mainfrom
fix/auth-redact-pii-logs
Open

fix(auth): redact PII from sign-in logs and gate debug to dev#4
abdout wants to merge 1 commit into
mainfrom
fix/auth-redact-pii-logs

Conversation

@abdout
Copy link
Copy Markdown
Contributor

@abdout abdout commented Apr 25, 2026

Summary

  • NextAuth callbacks logged `userId`/`email`/`provider` on every sign-in/link → PII in plaintext Vercel logs.
  • `debug: true` was hardcoded on (commented "Set to true for both dev and production").
  • Drops the three `console.log` blocks; switches `debug` to dev-only.
  • Auth flow logic is unchanged — only logging and debug flag.

Changes

  • `src/auth.ts` — removed `events.signIn` handler entirely (only purpose was logging), removed log lines from `events.linkAccount` and `callbacks.signIn`, gated `debug` to non-production.

Test plan

  • Sign in via credentials → success on /en and /ar
  • Sign in via Google OAuth → success
  • Tail `vercel logs` during sign-in → no email/userId in output
  • Trigger an auth error → still surfaces (debug works in dev only)

Closes #3

🤖 Generated with Claude Code

NextAuth callbacks were logging userId/email/provider to Vercel runtime
logs on every sign-in and account-link, with debug forced on in prod.
Removes the three console.log blocks and switches debug to
process.env.NODE_ENV !== "production".

Closes #3

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marketing Ready Ready Preview, Comment Apr 25, 2026 8:33am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(auth): redact PII from sign-in logs and gate debug to dev

1 participant