fix(sentry): gate includeLocalVariables and drop sendDefaultPii#2710
Merged
fix(sentry): gate includeLocalVariables and drop sendDefaultPii#2710
Conversation
includeLocalVariables uses Node's debugger inspector to attach every local variable in scope at the moment an error throws. In production that scope can include DB rows, auth tokens being validated, request bodies, and session state — far broader than sendDefaultPii. Off in prod, on in dev/test where the debugging value justifies the exposure. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…knob sendDefaultPii was originally added to make session replay text readable, but that's actually controlled by replayIntegration's maskAllText / blockAllMedia (handled in #2709). With replays already showing real text, the only thing sendDefaultPii adds is per-event IP addresses and User-Agent — useful triage signal but not worth the sub-processor data exposure for a compliance product. Errors still carry full stack traces, breadcrumbs, source-mapped frames, and replay context; only the IP/UA metadata layer goes away. Removing across all six init files (server, edge, client × app, portal). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
🎉 This PR is included in version 3.38.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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
Two related tightenings of Sentry server-side data exposure, prompted by cubic.dev review on PR #2707.
1. Gate
includeLocalVariablesto non-productionThe Sentry SDK uses Node's debugger inspector to attach every local variable in scope at the moment an error throws. In production that scope can include DB rows, auth tokens being validated, request bodies, and session state — broader than
sendDefaultPii. Off in prod, on in dev/test where the debugging value justifies it.2. Drop
sendDefaultPiientirelyOriginally added on the assumption it would unblur replay text — it doesn't. Replay masking is controlled by
replayIntegration({ maskAllText, blockAllMedia })(handled in PR #2709). With replays already showing real text, allsendDefaultPiiadds is per-event IP and User-Agent. Useful triage signal, but not worth the sub-processor data exposure for a compliance product.What still works without it:
Sentry.setUser({ id })explicitlyWhat goes away:
request.ip_addressUser-Agent/RefererheadersCookie/Authorization)Files
apps/{app,portal}/sentry.server.config.ts,apps/{app,portal}/sentry.edge.config.ts,apps/{app,portal}/src/instrumentation-client.tsTest plan
appandportalrequest.ip_addressfield🤖 Generated with Claude Code