feat!: Only collect ip addresses with sendDefaultPii: true#15084
feat!: Only collect ip addresses with sendDefaultPii: true#15084
sendDefaultPii: true#15084Conversation
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
|
|
||
| this.on('postprocessEvent', event => { | ||
| addAutoIpAddressToUser(event); | ||
| if (this._options.sendDefaultPii) { |
There was a problem hiding this comment.
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.
uh totally. Mutating options is kinda not something we intentionally support. Whenever it works it is usually by accident.
|
|
||
| if (normalizedRequest) { | ||
| addNormalizedRequestDataToEvent(event, normalizedRequest, { ipAddress }, include); | ||
| addNormalizedRequestDataToEvent(event, normalizedRequest, { ipAddress }, include, client); |
There was a problem hiding this comment.
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)