Skip to content

Commit 9fd8c6f

Browse files
committed
feat: Flutter replay custom masking warning (#11778)
* feat: Flutte replay custom masking warning * update replay privacy docs * Update index.mdx
1 parent f4fc6d6 commit 9fd8c6f

File tree

1 file changed

+17
-3
lines changed
  • docs/platforms/flutter/session-replay

1 file changed

+17
-3
lines changed

docs/platforms/flutter/session-replay/index.mdx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,26 @@ Sampling allows you to control how much of your website's traffic will result in
5656
2. `onErrorSampleRate` - The sample rate for replays that are recorded when an error happens. This type of replay will record
5757
up to a minute of events prior to the error and continue recording until the session ends.
5858

59-
Sampling starts as soon as a session begins. The `sessionSampleRate` is then evaluated. If the session is sampled, replay recording will start immediately. If not, `onErrorSampleRate` will be evaluated. If the session is sampled at this point, the replay will be buffered and will only be uploaded to Sentry if an error occurs.
59+
Sampling starts as soon as a session begins. The <PlatformIdentifier name="replays-session-sample-rate" /> is then evaluated. If the session is sampled, replay recording will start immediately. If not, <PlatformIdentifier name="replays-on-error-sample-rate" /> will be evaluated. If the session is sampled at this point, the replay will be buffered and will only be uploaded to Sentry if an error occurs.
6060

6161
## Privacy
6262

63-
The SDK is recording and aggressively redacting (masking) all text and images, according to the configuration in `options.experimental.replay`.
64-
You can tune this and add custom masking rules to fit your needs. For example, you can explicitly mask or unmask widgets by type,
63+
The SDK is recording and aggressively redacting (masking) all `Text`, `EditableText`, and `Image` widgets.
64+
Masking in the Sentry Flutter SDK is based on Widget *types*, e.g. `Image`, not the string representation of the type (i.e. we check whether
65+
a `widgetInstance` should be masked by checking `if (widgetInstance is Image)` instead of `if (widgetInstance.runtimeType == 'Image')`).
66+
This means we can ensure masking works regardless of obfuscation in release builds and also works for subclasses.
67+
However, it also means we can only automatically mask widgets that are part of the Flutter SDK itself.
68+
69+
<Alert level="warning">
70+
We cannot mask widgets defined in various 3rd-party packages (because the type is not known in the Sentry Flutter SDK),
71+
even though many should be masked.
72+
73+
Therefore, you need to consider the widgets your application uses and ensure they're masked correctly with custom masking rules.
74+
Examples of widgets that usually should be masked include (but are not limited to): VideoPlayer, WebView, Chart, etc.
75+
</Alert>
76+
77+
You can tune this and add custom masking rules to fit your needs by adjusting the configuration in `options.experimental.replay`.
78+
For example, you can explicitly mask or unmask widgets by type,
6579
or you can even have a callback to decide whether a specific widget instance should be masked:
6680

6781
```dart

0 commit comments

Comments
 (0)