Skip to content
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

Merged
merged 11 commits into from
Oct 14, 2024
66 changes: 66 additions & 0 deletions docs/platforms/apple/guides/ios/session-replay/customredact.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: Using custom redact for Session Replay
brustolin marked this conversation as resolved.
Show resolved Hide resolved
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.
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.
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.
Show resolved Hide resolved

## Redact by View class
brustolin marked this conversation as resolved.
Show resolved Hide resolved

You can choose which type of view you want to redact or ignore by using the `redactViewClasses` or `ignoreViewClasses` options.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

h: After reading this and the whole document, I'm still unsure of the difference between redact and ignore. Can we add a short explanation, please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The document was updated. Please take another look


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.
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.
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.
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 often be over-redacted. A modifier like `background` uses the same element as an `Image`.
In order to control the SwiftUI redact process, you first need to disable the default redaction options:

```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.
Show resolved Hide resolved

```swift
var body: some View {
Text("Hello, World!")
.sentryReplayRedact()
brustolin marked this conversation as resolved.
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.
Show resolved Hide resolved

4 changes: 3 additions & 1 deletion docs/platforms/apple/guides/ios/session-replay/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ Sampling begins as soon as a session starts. `sessionSampleRate` is evaluated fi

## Privacy

The SDK is recording and aggressively redacting all text and images. We plan to add fine controls for redacting, but in this version, we just allow either on or off. The default is on. Please don’t turn it off if you have sensitive data in your app. Before the Beta is complete, we'll give you the controls you need.
The SDK is recording and aggressively redacting all text and images.
Please don't turn it off if you have sensitive data in your app.
If you want to manually choose which part of your app's data to redact, read our guide on [custom redaction](/platforms/apple/guides/ios/session-replay/customredact).
brustolin marked this conversation as resolved.
Show resolved Hide resolved

<Note>

Expand Down
Loading