-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(apple): Replay Redact #11418
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
feat(apple): Replay Redact #11418
Changes from 3 commits
c11fcc7
b2c94ff
059f1ee
461ee72
dd5d568
f9b2d64
2c9e40b
f08690d
f0819df
48c12d2
aaed0e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| --- | ||
| title: Using custom redact for Session Replay | ||
| sidebar_order: 5501 | ||
| notSupported: | ||
| description: "Learn how to choose which part of your app's data to redact in Session Replay." | ||
brustolin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| --- | ||
|
|
||
| <Note> | ||
|
|
||
brustolin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Using custom redaction for Session Replay can expose sensitive data. Make sure to double-check every part of your app's data that you choose to redact or not. | ||
|
|
||
| </Note> | ||
brustolin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| By default, our Session Replay SDK masks all text content, images, and user input, giving you heightened confidence that no sensitive data will leave the device. However, you can choose which parts of your app's data to redact or not by using some different options. | ||
|
|
||
brustolin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Redact by View class | ||
brustolin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| You can choose which type of view you want to redact or ignore by using the `redactViewClasses` or `ignoreViewClasses` options. | ||
|
||
|
|
||
| Let's say you have a custom view that you want to redact and a UILabel subclass (which normally would be redacted) that you want to ignore. You can set the options like this: | ||
|
|
||
brustolin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ```swift | ||
| options.experimental.sessionReplay.redactViewClasses = [MyCustomView.self] | ||
| options.experimental.sessionReplay.ignoreViewClasses = [MyCustomLabel.self] | ||
| ``` | ||
brustolin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## Redact View by instance | ||
brustolin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| You can also choose to redact or ignore a specific view instance by using the replay API or view extensions like this: | ||
brustolin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```swift | ||
| SentrySDK.replay.redactView(view: view) | ||
| SentrySDK.replay.ignoreView(view: label) | ||
| ``` | ||
| or | ||
|
|
||
| ```swift | ||
| view.sentryReplayRedact() | ||
| label.sentryReplayIgnore() | ||
| ``` | ||
|
|
||
| ## SwiftUI | ||
|
|
||
| Because of the way SwiftUI is transformed into UIKit, it will be often over-redacted. Modifier like `background` use the same element as an `Image`. | ||
brustolin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| In order to be able to control SwiftUI redact process, first you need to disable the default redaction options: | ||
brustolin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```swift | ||
| options.experimental.sessionReplay.redactAllText = false | ||
| options.experimental.sessionReplay.redactAllImages = false | ||
| ``` | ||
|
|
||
| Then you can manually choose which `View` you want to redact with the `replayRedact` modifier | ||
brustolin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```swift | ||
| var body: some View { | ||
| Text("Hello, World!") | ||
| .sentryReplayRedact() | ||
brustolin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| ``` | ||
|
|
||
| <Note> | ||
| Dissabling the default redaction options will expose all text and images in the session replay. | ||
| Make sure to redact them manually. | ||
| </Note> | ||
brustolin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.