Skip to content

Fix: Prevent sensitive data from leaking into logs#260

Open
taheerahmed wants to merge 1 commit intoe2b-dev:mainfrom
taheerahmed:fix/logging-sensitive-data
Open

Fix: Prevent sensitive data from leaking into logs#260
taheerahmed wants to merge 1 commit intoe2b-dev:mainfrom
taheerahmed:fix/logging-sensitive-data

Conversation

@taheerahmed
Copy link
Contributor

Summary

Two fixes to prevent sensitive data from appearing in application logs.

Changes

1. Auth code removed from callback error log

File: src/app/api/auth/callback/route.ts (line 42)

 context: {
-  code,
+  hasCode: !!code,
   origin,
   returnTo,
   redirectTo,
 },

The full auth code was logged when exchangeCodeForSession failed. Changed to a boolean, consistent with how the same route already logs it at line 23:

// Line 23 — already uses boolean (correct)
context: {
  code: !!code,
  ...
}

2. Missing fields added to pino redaction paths

File: src/lib/clients/logger/logger.ts (lines 54-76)

Added access_token and signatureSecret at all 3 nesting levels.

Why these were missed: Pino redaction uses exact field name matching, not substring matching. The existing paths did not cover these because:

Existing path Catches Does NOT catch
accessToken { accessToken: "..." } { access_token: "..." }
*.secret { input: { secret: "..." } } { input: { signatureSecret: "..." } }

Supabase sessions use access_token (snake_case), and webhook actions use signatureSecret — both bypassed the existing redaction config.

What this does NOT change

The clientInput logging in src/lib/clients/action.ts:80 still logs full action inputs, but the newly added redaction paths now cover signatureSecret flowing through it. Whether to remove or allowlist clientInput logging entirely is a broader design decision best left to the maintainers.

Closes #259

- Replace full auth code with hasCode boolean in callback error log,
  consistent with the request log at line 23 of the same file
- Add access_token and signatureSecret to pino redaction paths at all
  nesting levels. These were missed because pino uses exact field name
  matching: accessToken does not match access_token, and secret does
  not match signatureSecret.

Closes e2b-dev#259
@vercel
Copy link

vercel bot commented Feb 27, 2026

@taheerahmed is attempting to deploy a commit to the E2B Team on Vercel.

A member of the Team first needs to authorize it.

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.

[Bug]: Sensitive data leaking into logs (auth code, signatureSecret, clientInput)

1 participant