iOS SDK - Sanitize sensitive data
UI Components
Section titled UI ComponentsSanitized views will be blurred out in the resulting replay. You can add any UI component and it will be automatically removed (to preserve memory) as soon as its not on screen.
SwiftUI
Section titled SwiftUISimply add .sensitive()
modifier to desired component
import ORTracker
Text("Very important sensitive text")
.sensitive()
UIKit
Section titled UIKitimport ORTracker
ORTracker.shared.addIgnoredView(view)
Network Requests
Section titled Network RequestsTwo keys are exported to automatically trim the request/response data: ignoredKeys
for body and ignoredHeaders
for headers. Both, request and response will be sanitized, but body will only be affected if its a valid JSON.
Simply assign a list of strings that you would like to sanitize:
let networkListener = NetworkListener()
networkListener.ignoredHeaders = ["mySecretToken"]
networkListener.ignoredKeys = ["password"]
It is also possible to change the response data before passing it to the listener:
// ... request
var sanitizedData
if let data = data {
do {
let json = try JSONSerialization.jsonObject(with: data, options: [])
sanitizedData = customSanitizeFunction(data)
print(json)
} catch {
print("Error deserializing JSON: \(error)")
}
}
networkListener.finish(response: response, data: sanitizedData)
Have questions?
Section titled Have questions?If you have any questions about this process, feel free to reach out to us on our Slack or check out our Forum.