Skip to content

Commit af38513

Browse files
authored
feat(replays): Enable pii scrubbing for urls field (#2143)
Fixes getsentry/sentry#49495
1 parent b54a7dc commit af38513

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
- Mark all URL transactions as `sanitized` when `txNameReady` flag is set. ([#2128](https://github.com/getsentry/relay/pull/2128), [#2139](https://github.com/getsentry/relay/pull/2139))
1414
- Tag incoming errors with the new `sampled` field in case their DSC is sampled. ([#2026](https://github.com/getsentry/relay/pull/2026))
15+
- Enable PII scrubbing for urls field ([#2143](https://github.com/getsentry/relay/pull/2143))
1516

1617
## 23.5.0
1718

relay-general/src/protocol/replay.rs

+12
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ pub struct Replay {
156156
pub replay_start_timestamp: Annotated<Timestamp>,
157157

158158
/// A list of URLs visted during the lifetime of the segment.
159+
#[metastructure(pii = "true", bag_size = "large")]
159160
pub urls: Annotated<Array<String>>,
160161

161162
/// A list of error-ids discovered during the lifetime of the segment.
@@ -553,6 +554,17 @@ mod tests {
553554
.get("credit-card");
554555

555556
assert_eq!(maybe_credit_card, Some("[Filtered]"));
557+
558+
// Assert URLs field scrubs array items.
559+
let maybe_url_0 = replay.value().unwrap().urls.value().unwrap().get(0);
560+
let maybe_url_1 = replay.value().unwrap().urls.value().unwrap().get(1);
561+
let maybe_url_2 = replay.value().unwrap().urls.value().unwrap().get(2);
562+
assert_eq!(
563+
maybe_url_0.map(|i| i.as_str()),
564+
Some(Some("sentry.io?ssn=[Filtered]"))
565+
);
566+
assert_eq!(maybe_url_1.map(|i| i.as_str()), Some(Some("[Filtered]")));
567+
assert_eq!(maybe_url_2.map(|i| i.as_str()), Some(Some("[Filtered]")));
556568
}
557569

558570
#[test]

relay-general/tests/fixtures/replays/replay.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"timestamp": 1597977777.6189718,
88
"replay_start_timestamp": 1597976392.6542819,
99
"urls": [
10-
"sentry.io"
10+
"sentry.io?ssn=111-11-1111",
11+
"4111-1111-1111-1111",
12+
"111-11-1111"
1113
],
1214
"error_ids": [
1315
"1",

0 commit comments

Comments
 (0)