Redactor

interface Redactor

Removes sensitive data from captured network traffic before it is stored.

Applied at capture time so redacted values are never persisted. The default implementation (covering auth/cookie headers; token/key/secret/password/ auth-like URL query params, JSON fields, and form fields) lives in :lustro.

Lustro calls it on a background capture thread, so the app's HTTP calls don't wait for it. When capture falls behind, the threads making those calls run it instead, so an implementation must be thread-safe. WebSocket messages are redacted on a second capture thread, and never on a socket's own threads.

Functions

Link copied to clipboard
abstract fun redactBody(body: String, contentType: MediaType?): String

Returns body with sensitive fields redacted, using contentType to decide how to parse it (e.g. JSON vs. form-encoded), or null if unknown.

Link copied to clipboard
abstract fun redactHeaderValue(name: String, value: String): String

Returns the header value, or the placeholder "[REDACTED]" when the header name is considered sensitive.

Link copied to clipboard
abstract fun redactUrl(url: String): String

Returns url with sensitive query parameters redacted.

Link copied to clipboard

Returns the bytes of a binary WebSocket message to store, or null to store only its size.

Link copied to clipboard

Returns the text to store for a WebSocket text message, or null to store only its size.