-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat!: Only collect ip addresses with sendDefaultPii: true
#15084
Conversation
size-limit report 📦
|
❌ 1 Tests Failed:
View the top 1 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
packages/browser/src/client.ts
Outdated
@@ -85,19 +85,23 @@ export class BrowserClient extends Client<BrowserClientOptions> { | |||
} | |||
|
|||
this.on('postprocessEvent', event => { | |||
addAutoIpAddressToUser(event); | |||
if (this._options.sendDefaultPii) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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!
Ref: #5347 (comment)