Skip to content

Commit 3ddbb5f

Browse files
authored
Fix remove route params from txn context, as they may leak PII data (#3487)
1 parent 59a53cb commit 3ddbb5f

File tree

5 files changed

+21
-14
lines changed

5 files changed

+21
-14
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Fixes
6+
7+
- Stop sending navigation route params for auto-generated transactions, as they may contain PII or other sensitive data ([#3487](https://github.com/getsentry/sentry-react-native/pull/3487))
8+
- Further details and other strategies to mitigate this issue can be found on our [trouble shooting guide page](https://docs.sentry.io/platforms/react-native/troubleshooting/#routing-transaction-data-contains-sensitive-information)
9+
310
## 5.15.1
411

512
### Fixes

src/js/tracing/reactnavigation.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,16 @@ export class ReactNavigationInstrumentation extends InternalRoutingInstrumentati
196196
route: {
197197
name: route.name,
198198
key: route.key,
199-
params: route.params ?? {},
199+
// TODO: filter PII params instead of dropping them all
200+
params: {},
200201
hasBeenSeen: routeHasBeenSeen,
201202
},
202203
previousRoute: previousRoute
203204
? {
204205
name: previousRoute.name,
205206
key: previousRoute.key,
206-
params: previousRoute.params ?? {},
207+
// TODO: filter PII params instead of dropping them all
208+
params: {},
207209
}
208210
: null,
209211
};

src/js/tracing/reactnavigationv4.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,16 @@ class ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation {
264264
route: {
265265
name: route.routeName, // Include name here too for use in `beforeNavigate`
266266
key: route.key,
267-
params: route.params ?? {},
267+
// TODO: filter PII params instead of dropping them all
268+
params: {},
268269
hasBeenSeen: this._recentRouteKeys.includes(route.key),
269270
},
270271
previousRoute: previousRoute
271272
? {
272273
name: previousRoute.routeName,
273274
key: previousRoute.key,
274-
params: previousRoute.params ?? {},
275+
// TODO: filter PII params instead of dropping them all
276+
params: {},
275277
}
276278
: null,
277279
};

test/tracing/reactnavigation.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ describe('ReactNavigationInstrumentation', () => {
123123
route: {
124124
name: route.name,
125125
key: route.key,
126-
params: route.params,
126+
params: {}, // expect the data to be stripped
127127
hasBeenSeen: false,
128128
},
129129
previousRoute: {

test/tracing/reactnavigationv4.test.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ describe('ReactNavigationV4Instrumentation', () => {
119119
route: {
120120
name: firstRoute.routeName,
121121
key: firstRoute.key,
122-
params: firstRoute.params,
122+
params: {}, // expect the data to be stripped
123123
hasBeenSeen: false,
124124
},
125125
previousRoute: null,
@@ -169,15 +169,13 @@ describe('ReactNavigationV4Instrumentation', () => {
169169
route: {
170170
name: action.routeName,
171171
key: action.key,
172-
params: action.params,
172+
params: {}, // expect the data to be stripped
173173
hasBeenSeen: false,
174174
},
175175
previousRoute: {
176176
name: 'Initial Route',
177177
key: 'route0',
178-
params: {
179-
hello: true,
180-
},
178+
params: {}, // expect the data to be stripped
181179
},
182180
},
183181
});
@@ -230,15 +228,13 @@ describe('ReactNavigationV4Instrumentation', () => {
230228
route: {
231229
name: action.routeName,
232230
key: action.key,
233-
params: action.params,
231+
params: {}, // expect the data to be stripped
234232
hasBeenSeen: false,
235233
},
236234
previousRoute: {
237235
name: 'Initial Route',
238236
key: 'route0',
239-
params: {
240-
hello: true,
241-
},
237+
params: {}, // expect the data to be stripped
242238
},
243239
},
244240
sampled: false,

0 commit comments

Comments
 (0)