Skip to content

Commit 2d4ca0a

Browse files
committed
opt-in for unmask and unblock
1 parent bb004f2 commit 2d4ca0a

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
@@ -827,6 +827,22 @@ The SDK no longer filters out health check transactions by default. Instead, the
827827
by the Sentry backend by default. You can disable dropping them in your Sentry project settings. If you still want to
828828
drop specific transactions within the SDK you can either use the `ignoreTransactions` SDK option.
829829

830+
#### Change of Replay default options (`unblock` and `unmask`)
831+
832+
The Replay options `unblock` and `unmask` now have `[]` as default value. This means that if you want to use these
833+
options, you have to explicitly set them like this:
834+
835+
```js
836+
Sentry.init({
837+
integrations: [
838+
Sentry.replayIntegration({
839+
unblock: '.sentry-unblock, [data-sentry-unblock]',
840+
unmask: '.sentry-unmask, [data-sentry-unmask]',
841+
}),
842+
],
843+
});
844+
```
845+
830846
#### Angular Tracing Decorator renaming
831847

832848
The usage of `TraceClassDecorator` and the `TraceMethodDecorator` already implies that those are decorators. The word

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
68
been fixed/improved. We **strongly** recommend anyone using Replay in a version before 7.39.0 to update to 7.39.0 or
79
newer, in order to prevent running Replay with known problems that have since been fixed.

packages/replay/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -197,17 +197,17 @@ The following options can be configured as options to the integration, in `Sentr
197197
198198
The following options can be configured as options to the integration, in `Sentry.replayIntegration({})`:
199199
200-
| key | type | default | description |
201-
| ------------- | ------------------------ | ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
202-
| maskAllText | boolean | `true` | Mask _all_ text content. Will pass text content through `maskFn` before sending to server. |
203-
| maskAllInputs | boolean | `true` | Mask values of `<input>` elements. Passes input values through `maskInputFn` before sending to server. |
204-
| blockAllMedia | boolean | `true` | Block _all_ media elements (`img, svg, video, object, picture, embed, map, audio`) |
205-
| 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 `*`. |
206-
| block | Array<string> | `.sentry-block, [data-sentry-block]` | Redact any elements that match the DOM selectors. See [privacy](#blocking) section for an example. |
207-
| 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. |
208-
| mask | Array<string> | `.sentry-mask, [data-sentry-mask]` | Mask all elements that match the given DOM selectors. See [privacy](#masking) section for an example. |
209-
| 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. |
210-
| ignore | Array<string> | `.sentry-ignore, [data-sentry-ignore]` | Ignores all events on the matching input fields. See [privacy](#ignoring) section for an example. |
200+
| key | type | default | description |
201+
| ---------------- | ------------------------ |----------------------------------------| -------------------------------------------------------------------------------------------------------------------------------------------- |
202+
| maskAllText | boolean | `true` | Mask _all_ text content. Will pass text content through `maskFn` before sending to server. |
203+
| maskAllInputs | boolean | `true` | Mask values of `<input>` elements. Passes input values through `maskInputFn` before sending to server. |
204+
| blockAllMedia | boolean | `true` | Block _all_ media elements (`img, svg, video, object, picture, embed, map, audio`) |
205+
| 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 `*`. |
206+
| block | Array<string> | `.sentry-block, [data-sentry-block]` | Redact any elements that match the DOM selectors. See [privacy](#blocking) section for an example. |
207+
| unblock | Array<string> | [] | Do not redact any elements that match the DOM selectors. Useful when using `blockAllMedia`. See [privacy](#blocking) section for an example. |
208+
| mask | Array<string> | `.sentry-mask, [data-sentry-mask]` | Mask all elements that match the given DOM selectors. See [privacy](#masking) section for an example. |
209+
| unmask | Array<string> | [] | Unmask all elements that match the given DOM selectors. Useful when using `maskAllText`. See [privacy](#masking) section for an example. |
210+
| ignore | Array<string> | `.sentry-ignore, [data-sentry-ignore]` | Ignores all events on the matching input fields. See [privacy](#ignoring) section for an example. |
211211
212212
#### Deprecated options
213213

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)