Skip to content

Commit

Permalink
feat: Set event.user.ip_address = "{{auto}}" if `sendDefaultPii !==…
Browse files Browse the repository at this point in the history
… false`
  • Loading branch information
timfish committed Jan 14, 2025
1 parent c314fc2 commit 79abc31
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/main/integrations/electron-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ export const electronContextIntegration = defineIntegration(() => {
delete event.request.headers['User-Agent'];
}

const { release = getDefaultReleaseName(), environment = getDefaultEnvironment() } = client.getOptions();
const { release = getDefaultReleaseName(), environment = getDefaultEnvironment(), sendDefaultPii } = client.getOptions();

if (sendDefaultPii !== false && typeof event.user?.ip_address === 'undefined') {
event.user = event.user || {};
event.user.ip_address = event.user.ip_address || '{{auto}}';
}

return mergeEvents(
{
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/test-apps/javascript/main-error/event.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"event.environment": "javascript",
"event.origin": "electron",
"event.process": "browser"
}
},
"user": { "ip_address": "{{auto}}" }
}
}

0 comments on commit 79abc31

Please sign in to comment.