Skip to content

feat(js/replay): Opt-in options for unmask and unblock #9422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 13, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions platform-includes/replay/privacy-configuration/javascript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ Sentry.replayIntegration({
});
```

Starting with v8, the options `unblock` and `unmask` do not add default DOM selectors anymore. If you want to keep the default behavior of previous versions, then we recommend you to explicitly specify them in your configuration:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Starting with v8, the options `unblock` and `unmask` do not add default DOM selectors anymore. If you want to keep the default behavior of previous versions, then we recommend you to explicitly specify them in your configuration:
Starting with v8, the options `unblock` and `unmask` do not add default DOM selectors anymore. If you want to keep the default behavior of previous versions, then you should explicitly specify them in your configuration:


```javascript
Sentry.replayIntegration({
unblock: ['.sentry-unblock, [data-sentry-unblock]'],
unmask: ['.sentry-unmask, [data-sentry-unmask]'],
})
```

The following is a complete list of options that can be used in `replayIntegration({})`:

| key | type | default | description |
Expand All @@ -19,5 +28,5 @@ The following is a complete list of options that can be used in `replayIntegrati
| blockAllMedia | `boolean` | `true` | Block _all_ media elements (`img`, `svg`, `video`, `object`, `picture`, `embed`, `map`, `audio`). |
| ignore | `string[]` | `['.sentry-ignore', '[data-sentry-ignore]']` | Ignores all events on the matching input fields. See [Ignoring](#ignoring) above for an example. |
| maskFn | `(text: string) => string` | `(s) => '*'.repeat(s.length)` | Function to customize how text content is masked before sending to server. By default, masks text with `*`. |
| unblock | `string[]` | `['.sentry-unblock', '[data-sentry-unblock]']` | Don't redact any elements that match the DOM selectors. Used to unblock specific media elements that are blocked with `blockAllMedia`. This doesn't affect sensitive elements such as `password`. |
| unmask | `string[]` | `['.sentry-unmask', '[data-sentry-unmask]']` | Unmask all elements that match the given DOM selectors. Used to unmask specific elements that are masked with `maskAllText`. |
| unblock | `string[]` | `[]` | Don't redact any elements that match the DOM selectors. Used to unblock specific media elements that are blocked with `blockAllMedia`. This doesn't affect sensitive elements such as `password`. |
| unmask | `string[]` | `[]` | Unmask all elements that match the given DOM selectors. Used to unmask specific elements that are masked with `maskAllText`. |