Skip to content

Commit 0ba0d6e

Browse files
committed
Guard Next route data behind default pii flag
1 parent bec58e0 commit 0ba0d6e

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

packages/nextjs/src/performance/client.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22

3+
import { getCurrentHub } from '@sentry/hub';
34
import { Primitive, TraceparentData, Transaction, TransactionContext } from '@sentry/types';
45
import {
56
extractTraceparentData,
@@ -93,6 +94,8 @@ let activeTransaction: Transaction | undefined = undefined;
9394
let prevTransactionName: string | undefined = undefined;
9495
let startTransaction: StartTransactionCb | undefined = undefined;
9596

97+
const client = getCurrentHub().getClient();
98+
9699
/**
97100
* Creates routing instrumention for Next Router. Only supported for
98101
* client side routing. Works for Next >= 10.
@@ -118,7 +121,7 @@ export function nextRouterInstrumentation(
118121
name: prevTransactionName,
119122
op: 'pageload',
120123
tags: DEFAULT_TAGS,
121-
...(params && { data: params }),
124+
...(params && client && client.getOptions().sendDefaultPii && { data: params }),
122125
...traceParentData,
123126
metadata: {
124127
source,

packages/nextjs/test/performance/client.test.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,6 @@ describe('client', () => {
9797
tags: {
9898
'routing.instrumentation': 'next-router',
9999
},
100-
data: {
101-
user: 'lforst',
102-
id: '1337',
103-
q: '42',
104-
},
105100
metadata: {
106101
source: 'route',
107102
baggage: [{ environment: 'myEnv', release: '2.1.0' }, '', true],
@@ -129,7 +124,6 @@ describe('client', () => {
129124
tags: {
130125
'routing.instrumentation': 'next-router',
131126
},
132-
data: {},
133127
metadata: {
134128
source: 'route',
135129
baggage: [{ environment: 'myEnv', release: '2.1.0' }, '', true],
@@ -151,7 +145,6 @@ describe('client', () => {
151145
tags: {
152146
'routing.instrumentation': 'next-router',
153147
},
154-
data: {},
155148
metadata: {
156149
source: 'route',
157150
},

packages/types/src/options.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,11 @@ export interface ClientOptions<TO extends BaseTransportOptions = BaseTransportOp
153153
tunnel?: string;
154154

155155
/**
156-
* Important: This option is currently unused and will only work in the next major version of the SDK
157-
*
158156
* Controls if potentially sensitive data should be sent to Sentry by default.
159157
* Note that this only applies to data that the SDK is sending by default
160158
* but not data that was explicitly set (e.g. by calling `Sentry.setUser()`).
161-
* Details about the implementation are TBD.
162159
*
163160
* Defaults to `false`.
164-
*
165-
* @ignore
166161
*/
167162
sendDefaultPii?: boolean;
168163

0 commit comments

Comments
 (0)