Skip to content

fix(browser): Ensure IP address is only inferred by Relay if sendDefaultPii is true #17364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 11, 2025

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Aug 8, 2025

This PR fixes a long-standing problem in the SDK where it would set incorrect information about when Relay should (not) infer IP addresses from sent envelope requests.

Previously, this was thought to be controlled by setting event.user.ip_address: '{{auto}}'. However, after an incident in Relay, it was determined that this is in fact not a reliably way to control IP inference. Instead, SDKs should set event.sdk.settings.infer_ip: 'auto' | 'never' (see closes #16252).
Unfortunately, this wasn't implemented immediately but is taken care of in this PR.

(FWIW, the only reason why Relay continued to infer IP addresses for the JS SDK was because it is excempt from logic that would infer IP addresses only if user.ip_address was set to '{{auto}}'. This is necessary to backwards compatibility with older SDKs.)

Follow-ups: We likely also need to adjust the logic in Electron and Lynx (at the very least remove setting user.ip_address).

closes #17351
closes #16252

@Lms24 Lms24 requested a review from a team as a code owner August 8, 2025 15:01
cursor[bot]

This comment was marked as outdated.

@Lms24 Lms24 self-assigned this Aug 8, 2025
Copy link
Contributor

github-actions bot commented Aug 8, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.16 kB +0.2% +46 B 🔺
@sentry/browser - with treeshaking flags 22.73 kB +0.23% +52 B 🔺
@sentry/browser (incl. Tracing) 39.87 kB +0.12% +44 B 🔺
@sentry/browser (incl. Tracing, Replay) 77.99 kB +0.09% +69 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 67.83 kB +0.1% +62 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 82.69 kB +0.08% +61 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 94.79 kB +0.07% +64 B 🔺
@sentry/browser (incl. Feedback) 40.83 kB +0.15% +61 B 🔺
@sentry/browser (incl. sendFeedback) 28.81 kB +0.13% +36 B 🔺
@sentry/browser (incl. FeedbackAsync) 33.7 kB +0.14% +46 B 🔺
@sentry/react 25.88 kB +0.19% +49 B 🔺
@sentry/react (incl. Tracing) 41.86 kB +0.15% +62 B 🔺
@sentry/vue 28.64 kB +0.2% +55 B 🔺
@sentry/vue (incl. Tracing) 41.69 kB +0.13% +52 B 🔺
@sentry/svelte 24.18 kB +0.19% +44 B 🔺
CDN Bundle 25.66 kB +0.18% +46 B 🔺
CDN Bundle (incl. Tracing) 39.76 kB +0.1% +39 B 🔺
CDN Bundle (incl. Tracing, Replay) 75.82 kB +0.08% +54 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 81.27 kB +0.1% +81 B 🔺
CDN Bundle - uncompressed 74.96 kB +0.1% +70 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 117.59 kB +0.06% +70 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 231.88 kB +0.04% +92 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 244.48 kB +0.04% +92 B 🔺
@sentry/nextjs (client) 43.89 kB +0.14% +57 B 🔺
@sentry/sveltekit (client) 40.32 kB +0.13% +51 B 🔺
@sentry/node-core 47.8 kB +0.06% +25 B 🔺
@sentry/node 146.68 kB +0.02% +21 B 🔺
@sentry/node - without tracing 91.9 kB +0.03% +24 B 🔺
@sentry/aws-serverless 103.33 kB +0.03% +23 B 🔺

View base workflow run

@Lms24 Lms24 requested review from mydea and cleptric August 8, 2025 15:36
cursor[bot]

This comment was marked as outdated.

@@ -63,7 +63,10 @@ export { hasSpansEnabled } from './utils/hasSpansEnabled';
export { isSentryRequestUrl } from './utils/isSentryRequestUrl';
export { handleCallbackErrors } from './utils/handleCallbackErrors';
export { parameterize, fmt } from './utils/parameterize';
export { addAutoIpAddressToSession, addAutoIpAddressToUser } from './utils/ipAddress';

export { addAutoIpAddressToSession } from './utils/ipAddress';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we leave this on purpose iun-deprecated - is this still needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for now, let's leave it undeprecated. Checked with @cleptric and @Dav1dde and there are no PII-related concerns. The reason being that there's no special-casing Relay-side for JS that in the absence of '{{auto}}' IP addresses are still inferred.

However, after updating the SDK, events (errors, traces, replays, etc.) sent from the browser, will only include
user IP addresses, if you set `sendDefaultPii: true` in your `Sentry.init` options.

We apologize for any inconvenience caused!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great changelog message ❤️

cursor[bot]

This comment was marked as outdated.

@Lms24 Lms24 merged commit 508afcc into develop Aug 11, 2025
187 checks passed
@Lms24 Lms24 deleted the lms/fix-browser-sdk-settings-infer_ip branch August 11, 2025 09:22
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.

React sentry events contains user's IP address by default Use settings.infer_ip instead of ip_address: {{auto}}
3 participants