-
-
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 9 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,82 @@ | ||
| --- | ||
| title: Using Custom Masking for Session Replay | ||
| sidebar_order: 5501 | ||
| notSupported: | ||
| description: "Learn how to mask parts of your app's data in Session Replay." | ||
| --- | ||
|
|
||
| <Alert> | ||
|
|
||
| If you choose to use custom masking in your Session Replays, you may accidentally expose sensitive customer data. Be sure to double-check what you choose to expose. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's because for that they must disable the default masking, right? @lizokm might have ideas?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just an extra reminder, so the user understands the severity of it. |
||
|
|
||
| </Alert> | ||
|
|
||
| By default, our Session Replay SDK masks all text content, images, and user input. This helps ensure that no sensitive data will be exposed. You can also manually choose which parts of your app's data you want to mask by using the different options listed below. | ||
|
|
||
|
|
||
| ## Mask by View Class | ||
|
|
||
| You can choose which type of view you want to mask or ignore by using the `maskedViewClasses` or `unmaskedViewClasses` options. | ||
brustolin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Let's say you have a custom view that you want to mask and a `UILabel` subclass (which normally would be masked) that you doesn't want to mask. You can set the options like this: | ||
brustolin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```swift | ||
| options.experimental.sessionReplay.maskedViewClasses = [MyCustomView.self] | ||
| options.experimental.sessionReplay.unmaskedViewClasses = [MyCustomLabel.self] | ||
| ``` | ||
|
|
||
| ## Mask by View Instance | ||
|
|
||
| You can also choose to mask or unmask a specific view instance by using the replay API (SentrySDK.replay) or view extensions like this: | ||
brustolin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```swift | ||
| SentrySDK.replay.maskView(view: view) | ||
| SentrySDK.replay.unmaskView(view: label) | ||
| ``` | ||
| or | ||
|
|
||
| ```swift | ||
| view.sentryReplayMask() | ||
| label.sentryReplayUnmask() | ||
| ``` | ||
|
|
||
| ## SwiftUI | ||
|
|
||
| Because of the way SwiftUI is transformed into UIKit, it will often be over-masked. A modifier like `background` uses the same element as an `Image`. | ||
| In order to control the SwiftUI masking process, you need to use the `sentryReplayUnmask` and/or `sentryReplayMask` modifiers. | ||
|
|
||
| In this example we want to show the message, but not the user name. | ||
| ```swift | ||
| @Binding var user: String | ||
|
|
||
| var body: some View { | ||
| VStack { | ||
| Text("Hello") | ||
| .sentryReplayUnmask() | ||
| Text("\(user)") | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| In this example, we need to unmask the VStack because its background element will be masked by default. | ||
| To hide the username, we need to mask it. | ||
|
|
||
| ```swift | ||
| @Binding var user: String | ||
|
|
||
| var body: some View { | ||
| VStack { | ||
| Text("Hello") | ||
| Text("\(user)") | ||
| .sentrtReplayMask() | ||
| } | ||
| .background(.blue) | ||
| .sentryReplayUnmask() | ||
| } | ||
| ``` | ||
|
|
||
| <Alert> | ||
|
|
||
| Before publising an App with Session Replay enabled, make sure to test it thoroughly to ensure that no sensitive data is exposed. | ||
brustolin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| </Alert> | ||
brustolin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.