Skip to content
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
Copy link
Member

Choose a reason for hiding this comment

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

Should we name it Privacy similar to the JS sdk? https://docs.sentry.io/platforms/javascript/session-replay/privacy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I dont know, should we?

Copy link
Member

Choose a reason for hiding this comment

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

I would also add here the resume/pause functionality, and I think in this case it'd make sense to rename it as it's not only custom redaction/masking anymore. Maybe Privacy Controls or something like that would do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I will improve in another doc. This is waiting for too long

sidebar_order: 5501
notSupported:
description: "Learn how to redact parts of your app's data in Session Replay."
---

<Alert>

If you custom redact your Session Replays, you may accidentally expose sensitive customer data. Be sure to double-check what you choose to expose.

</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 to redact by using the different options listed below.


## Redact by View Class

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:

```swift
options.experimental.sessionReplay.redactViewClasses = [MyCustomView.self]
options.experimental.sessionReplay.ignoreViewClasses = [MyCustomLabel.self]
```

## Redact by View Instance

You can also choose to redact or ignore a specific view instance by using the [replay API](/api/replays/) or view extensions like this:

```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:

```swift
var body: some View {
Text("Hello, World!")
.sentryReplayRedact()
}
```

<Note>
Disabling the default redaction options will expose all text and images in the session replay.
Make sure to redact them manually.
</Note>

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 aggressively records and redacts all text and images.
Please don't turn it off if you have sensitive data in your app.
If you want to manually redact parts of your app's data, read our guide on [custom redaction](/platforms/apple/guides/ios/session-replay/customredact).

<Note>

Expand Down