Skip to content

Commit bd26846

Browse files
committed
opt-in for unmask and unblock
1 parent 88d41ea commit bd26846

File tree

6 files changed

+39
-21
lines changed

6 files changed

+39
-21
lines changed

MIGRATION.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,22 @@ The SDK no longer filters out health check transactions by default. Instead, the
777777
by the Sentry backend by default. You can disable dropping them in your Sentry project settings. If you still want to
778778
drop specific transactions within the SDK you can either use the `ignoreTransactions` SDK option.
779779

780+
#### Change of Replay default options (`unblock` and `unmask`)
781+
782+
The Replay options `unblock` and `unmask` now have `[]` as default value. This means that if you want to use these
783+
options, you have to explicitly set them like this:
784+
785+
```js
786+
Sentry.init({
787+
integrations: [
788+
Sentry.replayIntegration({
789+
unblock: '.sentry-unblock, [data-sentry-unblock]',
790+
unmask: '.sentry-unmask, [data-sentry-unmask]',
791+
}),
792+
],
793+
});
794+
```
795+
780796
# Deprecations in 7.x
781797

782798
You can use the **Experimental** [@sentry/migr8](https://www.npmjs.com/package/@sentry/migr8) to automatically update

packages/replay/MIGRATION.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Sentry Replay is now out of Beta. This means that the usual stability guarantees apply.
44

5+
> For further migration changes please refer to the [general SDK migration notes](../../MIGRATION.md).
6+
57
Because of experimentation and rapid iteration, during the Beta period some bugs and problems came up which have since been fixed/improved.
68
We **strongly** recommend anyone using Replay in a version before 7.39.0 to update to 7.39.0 or newer, in order to prevent running Replay with known problems that have since been fixed.
79

packages/replay/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,17 @@ The following options can be configured as options to the integration, in `Sentr
195195
196196
The following options can be configured as options to the integration, in `Sentry.replayIntegration({})`:
197197
198-
| key | type | default | description |
199-
| ---------------- | ------------------------ | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
200-
| maskAllText | boolean | `true` | Mask _all_ text content. Will pass text content through `maskFn` before sending to server. |
201-
| maskAllInputs | boolean | `true` | Mask values of `<input>` elements. Passes input values through `maskInputFn` before sending to server. |
202-
| blockAllMedia | boolean | `true` | Block _all_ media elements (`img, svg, video, object, picture, embed, map, audio`) |
203-
| maskFn | (text: string) => string | `(text) => '*'.repeat(text.length)` | Function to customize how text content is masked before sending to server. By default, masks text with `*`. |
204-
| block | Array<string> | `.sentry-block, [data-sentry-block]` | Redact any elements that match the DOM selectors. See [privacy](#blocking) section for an example. |
205-
| unblock | Array<string> | `.sentry-unblock, [data-sentry-unblock]`| Do not redact any elements that match the DOM selectors. Useful when using `blockAllMedia`. See [privacy](#blocking) section for an example. |
206-
| mask | Array<string> | `.sentry-mask, [data-sentry-mask]` | Mask all elements that match the given DOM selectors. See [privacy](#masking) section for an example. |
207-
| unmask | Array<string> | `.sentry-unmask, [data-sentry-unmask]` | Unmask all elements that match the given DOM selectors. Useful when using `maskAllText`. See [privacy](#masking) section for an example. |
208-
| ignore | Array<string> | `.sentry-ignore, [data-sentry-ignore]` | Ignores all events on the matching input fields. See [privacy](#ignoring) section for an example. |
198+
| key | type | default | description |
199+
| ---------------- | ------------------------ |----------------------------------------| -------------------------------------------------------------------------------------------------------------------------------------------- |
200+
| maskAllText | boolean | `true` | Mask _all_ text content. Will pass text content through `maskFn` before sending to server. |
201+
| maskAllInputs | boolean | `true` | Mask values of `<input>` elements. Passes input values through `maskInputFn` before sending to server. |
202+
| blockAllMedia | boolean | `true` | Block _all_ media elements (`img, svg, video, object, picture, embed, map, audio`) |
203+
| maskFn | (text: string) => string | `(text) => '*'.repeat(text.length)` | Function to customize how text content is masked before sending to server. By default, masks text with `*`. |
204+
| block | Array<string> | `.sentry-block, [data-sentry-block]` | Redact any elements that match the DOM selectors. See [privacy](#blocking) section for an example. |
205+
| unblock | Array<string> | [] | Do not redact any elements that match the DOM selectors. Useful when using `blockAllMedia`. See [privacy](#blocking) section for an example. |
206+
| mask | Array<string> | `.sentry-mask, [data-sentry-mask]` | Mask all elements that match the given DOM selectors. See [privacy](#masking) section for an example. |
207+
| unmask | Array<string> | [] | Unmask all elements that match the given DOM selectors. Useful when using `maskAllText`. See [privacy](#masking) section for an example. |
208+
| ignore | Array<string> | `.sentry-ignore, [data-sentry-ignore]` | Ignores all events on the matching input fields. See [privacy](#ignoring) section for an example. |
209209
210210
#### Deprecated options
211211
In order to streamline our privacy options, the following have been deprecated in favor for the respective options above.

packages/replay/src/util/getPrivacyOptions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function getPrivacyOptions({
7474
const defaultBlockedElements = ['base[href="/"]'];
7575

7676
const maskSelector = getOption(mask, ['.sentry-mask', '[data-sentry-mask]'], maskTextClass, maskTextSelector);
77-
const unmaskSelector = getOption(unmask, ['.sentry-unmask', '[data-sentry-unmask]']);
77+
const unmaskSelector = getOption(unmask, []);
7878

7979
const options: GetPrivacyReturn = {
8080
// We are making the decision to make text and input selectors the same
@@ -87,7 +87,7 @@ export function getPrivacyOptions({
8787
blockClass,
8888
blockSelector,
8989
),
90-
unblockSelector: getOption(unblock, ['.sentry-unblock', '[data-sentry-unblock]']),
90+
unblockSelector: getOption(unblock, []),
9191
ignoreSelector: getOption(ignore, ['.sentry-ignore', '[data-sentry-ignore]', 'input[type="file"]'], ignoreClass),
9292
};
9393

packages/replay/test/integration/rrweb.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ describe('Integration | rrweb', () => {
3535
"maskTextSelector": ".sentry-mask,[data-sentry-mask]",
3636
"onMutation": [Function],
3737
"slimDOMOptions": "all",
38-
"unblockSelector": ".sentry-unblock,[data-sentry-unblock]",
39-
"unmaskTextSelector": ".sentry-unmask,[data-sentry-unmask]",
38+
"unblockSelector": "",
39+
"unmaskTextSelector": "",
4040
}
4141
`);
4242
});

packages/replay/test/unit/util/getPrivacyOptions.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ describe('Unit | util | getPrivacyOptions', () => {
2222
"blockSelector": ".custom-block,.sentry-block,[data-sentry-block],base[href=\\"/\\"]",
2323
"ignoreSelector": ".custom-ignore,.sentry-ignore,[data-sentry-ignore],input[type=\\"file\\"]",
2424
"maskTextSelector": ".custom-mask,.sentry-mask,[data-sentry-mask]",
25-
"unblockSelector": ".custom-unblock,.sentry-unblock,[data-sentry-unblock]",
26-
"unmaskTextSelector": ".custom-unmask,.sentry-unmask,[data-sentry-unmask]",
25+
"unblockSelector": ".custom-unblock",
26+
"unmaskTextSelector": ".custom-unmask",
2727
}
2828
`);
2929
});
@@ -48,8 +48,8 @@ describe('Unit | util | getPrivacyOptions', () => {
4848
"blockSelector": ".custom-block,.deprecated-block-selector,.sentry-block,[data-sentry-block],base[href=\\"/\\"],.deprecated-block-class",
4949
"ignoreSelector": ".custom-ignore,.sentry-ignore,[data-sentry-ignore],input[type=\\"file\\"],.deprecated-ignore-class",
5050
"maskTextSelector": ".custom-mask,.deprecated-mask-selector,.sentry-mask,[data-sentry-mask],.deprecated-mask-class",
51-
"unblockSelector": ".custom-unblock,.sentry-unblock,[data-sentry-unblock]",
52-
"unmaskTextSelector": ".custom-unmask,.sentry-unmask,[data-sentry-unmask]",
51+
"unblockSelector": ".custom-unblock",
52+
"unmaskTextSelector": ".custom-unmask",
5353
}
5454
`);
5555
});
@@ -73,8 +73,8 @@ describe('Unit | util | getPrivacyOptions', () => {
7373
"ignoreSelector": ".custom-ignore,.sentry-ignore,[data-sentry-ignore],input[type=\\"file\\"]",
7474
"maskTextClass": /deprecated-mask-\\*/,
7575
"maskTextSelector": ".custom-mask,.sentry-mask,[data-sentry-mask]",
76-
"unblockSelector": ".custom-unblock,.sentry-unblock,[data-sentry-unblock]",
77-
"unmaskTextSelector": ".custom-unmask,.sentry-unmask,[data-sentry-unmask]",
76+
"unblockSelector": ".custom-unblock",
77+
"unmaskTextSelector": ".custom-unmask",
7878
}
7979
`);
8080
});

0 commit comments

Comments
 (0)