Skip to content

Commit 254a501

Browse files
author
Luca Forstner
authored
feat!: Only collect ip addresses with sendDefaultPii: true (#15084)
Ref: #5347 (comment)
1 parent 03e0d02 commit 254a501

File tree

34 files changed

+169
-76
lines changed

34 files changed

+169
-76
lines changed

dev-packages/browser-integration-tests/suites/feedback/attachTo/test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ sentryTest('should capture feedback with custom button', async ({ getLocalTestUr
5757
event_id: expect.stringMatching(/\w{32}/),
5858
environment: 'production',
5959
tags: {},
60-
user: {
61-
ip_address: '{{auto}}',
62-
},
6360
sdk: {
6461
integrations: expect.arrayContaining(['Feedback']),
6562
version: expect.any(String),

dev-packages/browser-integration-tests/suites/feedback/captureFeedback/test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ sentryTest('should capture feedback', async ({ getLocalTestUrl, page }) => {
6969
'User-Agent': expect.stringContaining(''),
7070
},
7171
},
72-
user: {
73-
ip_address: '{{auto}}',
74-
},
7572
platform: 'javascript',
7673
});
7774
});

dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@ sentryTest('should capture feedback', async ({ forceFlushReplay, getLocalTestUrl
103103
'User-Agent': expect.stringContaining(''),
104104
},
105105
},
106-
user: {
107-
ip_address: '{{auto}}',
108-
},
109106
platform: 'javascript',
110107
});
111108
});

dev-packages/browser-integration-tests/suites/feedback/captureFeedbackCsp/test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ sentryTest('should capture feedback', async ({ getLocalTestUrl, page }) => {
6969
'User-Agent': expect.stringContaining(''),
7070
},
7171
},
72-
user: {
73-
ip_address: '{{auto}}',
74-
},
7572
platform: 'javascript',
7673
});
7774
const cspViolation = await page.evaluate<boolean>('window.__CSPVIOLATION__');

dev-packages/browser-integration-tests/suites/manual-client/browser-context/test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ sentryTest('allows to setup a client manually & capture exceptions', async ({ ge
3434
'User-Agent': expect.any(String),
3535
}),
3636
},
37-
user: {
38-
ip_address: '{{auto}}',
39-
},
4037
timestamp: expect.any(Number),
4138
environment: 'local',
4239
release: '0.0.1',
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Sentry.captureException(new Error('woot'));
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { expect } from '@playwright/test';
2+
import type { Event } from '@sentry/core';
3+
4+
import { sentryTest } from '../../../../utils/fixtures';
5+
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';
6+
7+
sentryTest('should default user to {{auto}} on errors when sendDefaultPii: true', async ({ getLocalTestUrl, page }) => {
8+
const url = await getLocalTestUrl({ testDir: __dirname });
9+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
10+
expect(eventData.user?.ip_address).toBe('{{auto}}');
11+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import * as Sentry from '@sentry/browser';
2+
3+
window.Sentry = Sentry;
4+
5+
Sentry.init({
6+
dsn: 'https://public@dsn.ingest.sentry.io/1337',
7+
tracesSampleRate: 1,
8+
sendDefaultPii: true,
9+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Sentry.startSpan({ name: 'woot' }, () => undefined);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { expect } from '@playwright/test';
2+
import { sentryTest } from '../../../../utils/fixtures';
3+
import {
4+
envelopeRequestParser,
5+
shouldSkipTracingTest,
6+
waitForTransactionRequestOnUrl,
7+
} from '../../../../utils/helpers';
8+
9+
sentryTest(
10+
'should default user to {{auto}} on transactions when sendDefaultPii: true',
11+
async ({ getLocalTestUrl, page }) => {
12+
if (shouldSkipTracingTest()) {
13+
sentryTest.skip();
14+
}
15+
16+
const url = await getLocalTestUrl({ testDir: __dirname });
17+
const req = await waitForTransactionRequestOnUrl(page, url);
18+
const transaction = envelopeRequestParser(req);
19+
expect(transaction.user?.ip_address).toBe('{{auto}}');
20+
},
21+
);

0 commit comments

Comments
 (0)