Skip to content

Conversation

lucas-zimerman
Copy link
Collaborator

@lucas-zimerman lucas-zimerman commented Aug 13, 2025

Based on getsentry/sentry-javascript#17364

original context;

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 https://github.com/getsentry/sentry-javascript/issues/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 https://github.com/getsentry/sentry-javascript/issues/17351
closes https://github.com/getsentry/sentry-javascript/issues/16252

Instead of bumping o V10, the fix was patched on the current release.

@lucas-zimerman lucas-zimerman marked this pull request as ready for review August 13, 2025 10:47
@lucas-zimerman lucas-zimerman requested a review from antonis August 13, 2025 10:47
@lucas-zimerman
Copy link
Collaborator Author

image

This is how the event will look like when you set sendDefaultPii as false

@kahest kahest requested a review from Lms24 August 13, 2025 11:56
Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

Awesome work @lucas-zimerman 🚀
The changes LGTM. Thank you adding unit test and test data in the comments.

Added a couple of questions but nothing blocking.

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this! Looks good to me!

I'm thinking that the SDK might still set user.ip_address: '{{auto}}' in case setDefaultPii: true. In case it does, we could still still clean this up but it's not the end of the world either way. sdk.settings.infer_ip overrules the other field in both cases.

@lucas-zimerman
Copy link
Collaborator Author

Thanks for fixing this! Looks good to me!

I'm thinking that the SDK might still set user.ip_address: '{{auto}}' in case setDefaultPii: true. In case it does, we could still still clean this up but it's not the end of the world either way. sdk.settings.infer_ip overrules the other field in both cases.

I have removed the auto ip here 49d6b67

@lucas-zimerman lucas-zimerman requested a review from Lms24 August 13, 2025 15:37
@lucas-zimerman
Copy link
Collaborator Author

PR test error is unrelated to the added code and will be fixed on another PR

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

thanks!

@lucas-zimerman lucas-zimerman merged commit 1276dfb into main Aug 14, 2025
26 of 29 checks passed
@lucas-zimerman lucas-zimerman deleted the lz/study/cherry-pick-ip branch August 14, 2025 12:26
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.

3 participants