Skip to content
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

feat!: Only collect ip addresses with sendDefaultPii: true #15084

Merged
merged 6 commits into from
Jan 21, 2025

Conversation

lforst
Copy link
Member

@lforst lforst commented Jan 20, 2025

Copy link
Contributor

github-actions bot commented Jan 20, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 22.99 KB +0.05% +10 B 🔺
@sentry/browser - with treeshaking flags 22.88 KB +0.03% +7 B 🔺
@sentry/browser (incl. Tracing) 35.71 KB +0.1% +36 B 🔺
@sentry/browser (incl. Tracing, Replay) 72.51 KB +0.06% +41 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 66.06 KB +0.05% +31 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 76.77 KB +0.07% +48 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 88.76 KB +0.03% +23 B 🔺
@sentry/browser (incl. Feedback) 39.2 KB +0.03% +9 B 🔺
@sentry/browser (incl. sendFeedback) 27.63 KB +0.07% +17 B 🔺
@sentry/browser (incl. FeedbackAsync) 32.39 KB +0.07% +21 B 🔺
@sentry/react 25.66 KB +0.03% +6 B 🔺
@sentry/react (incl. Tracing) 38.49 KB +0.09% +34 B 🔺
@sentry/vue 27.06 KB +0.1% +27 B 🔺
@sentry/vue (incl. Tracing) 37.45 KB +0.04% +14 B 🔺
@sentry/svelte 23.11 KB +0.04% +8 B 🔺
CDN Bundle 24.38 KB +0.07% +16 B 🔺
CDN Bundle (incl. Tracing) 36.02 KB +0.08% +27 B 🔺
CDN Bundle (incl. Tracing, Replay) 70.66 KB +0.03% +20 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 75.8 KB +0.03% +17 B 🔺
CDN Bundle - uncompressed 71.2 KB +0.07% +45 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 106.89 KB +0.07% +72 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 217.74 KB +0.04% +72 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 230.27 KB +0.04% +72 B 🔺
@sentry/nextjs (client) 38.6 KB +0.06% +23 B 🔺
@sentry/sveltekit (client) 36.23 KB +0.07% +23 B 🔺
@sentry/node 156.21 KB +0.03% +34 B 🔺
@sentry/node - without tracing 97.35 KB +0.03% +25 B 🔺
@sentry/aws-serverless 106.76 KB +0.03% +26 B 🔺

View base workflow run

Copy link

codecov bot commented Jan 20, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
691 1 690 297
View the top 1 failed tests by shortest run time
errors.client.test.ts client-side errorscaptures error thrown on click
Stack Traces | 30s run time
errors.client.test.ts:5:3 captures error thrown on click

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

@@ -85,19 +85,23 @@ export class BrowserClient extends Client<BrowserClientOptions> {
}

this.on('postprocessEvent', event => {
addAutoIpAddressToUser(event);
if (this._options.sendDefaultPii) {
Copy link
Member

Choose a reason for hiding this comment

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

hmm, I wonder if we can just conditionally not add both of these hooks at all here if this is not on? 🤔 a bit simpler, you loose the ability to flip this option later, but is this something we want to/need to support?

Copy link
Member Author

Choose a reason for hiding this comment

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

uh totally. Mutating options is kinda not something we intentionally support. Whenever it works it is usually by accident.

const { sdkProcessingMetadata = {} } = event;
const { normalizedRequest, ipAddress } = sdkProcessingMetadata;

if (normalizedRequest) {
addNormalizedRequestDataToEvent(event, normalizedRequest, { ipAddress }, include);
addNormalizedRequestDataToEvent(event, normalizedRequest, { ipAddress }, include, client);
Copy link
Member

Choose a reason for hiding this comment

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

l: This is also fine, but what if we mutated include here instead? IMHO the addNormalizedRequestDataToEvent does not need to know of the client etc, we could do:

addNormalizedRequestDataToEvent(event, normalizedRequest, { ipAddress }, { ip: client.getOptions().sendDefaultPii, ...include });

or something like this? (not quite, as ip is set by default, but logic wise something like this...)

But I'm also OK with leaving it as it is here!

@lforst lforst requested a review from mydea January 21, 2025 14:48
@lforst lforst marked this pull request as ready for review January 21, 2025 14:48
@lforst lforst requested a review from a team as a code owner January 21, 2025 14:48
@lforst lforst merged commit 254a501 into develop Jan 21, 2025
153 checks passed
@lforst lforst deleted the lforst-set-auto-ip-address-only-when-defaultpii branch January 21, 2025 15:47
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