Skip to content

Commit 9f469cd

Browse files
Marfuenclaude
andauthored
chore(sentry): unmask replay text and media with selective opt-out hooks (#2709)
Sentry session replay defaults to masking all text and blocking all media, which produces unreadable rows of asterisks on every replay. Turn both off so replays are actually useful for debugging, and add .sentry-mask / [data-sentry-mask] / [data-sentry-block] selectors so we can opt specific customer-sensitive elements (risk descriptions, secret values, policy markdown) back into masking as we identify them. <input type="password"> remains masked automatically by the SDK regardless. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3edfa98 commit 9f469cd

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

apps/app/src/instrumentation-client.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,16 @@ Sentry.init({
2424
process.env.NEXT_PUBLIC_SENTRY_DSN ??
2525
'https://331f1c3d4b08e9352dd1a2621e1ae845@o4509214247813120.ingest.us.sentry.io/4511304630927360',
2626

27-
integrations: [Sentry.replayIntegration()],
27+
integrations: [
28+
// Add `data-sentry-mask` (or `.sentry-mask`) to any element rendering
29+
// customer-confidential data; `data-sentry-block` to drop whole sections.
30+
Sentry.replayIntegration({
31+
maskAllText: false,
32+
blockAllMedia: false,
33+
mask: ['.sentry-mask', '[data-sentry-mask]'],
34+
block: ['[data-sentry-block]'],
35+
}),
36+
],
2837

2938
tracesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.1,
3039

apps/portal/src/instrumentation-client.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,16 @@ Sentry.init({
99
process.env.NEXT_PUBLIC_SENTRY_DSN ??
1010
'https://331f1c3d4b08e9352dd1a2621e1ae845@o4509214247813120.ingest.us.sentry.io/4511304630927360',
1111

12-
integrations: [Sentry.replayIntegration()],
12+
integrations: [
13+
// Add `data-sentry-mask` (or `.sentry-mask`) to any element rendering
14+
// customer-confidential data; `data-sentry-block` to drop whole sections.
15+
Sentry.replayIntegration({
16+
maskAllText: false,
17+
blockAllMedia: false,
18+
mask: ['.sentry-mask', '[data-sentry-mask]'],
19+
block: ['[data-sentry-block]'],
20+
}),
21+
],
1322

1423
tracesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.1,
1524

0 commit comments

Comments
 (0)