Skip to main content

Crate rtb_redact

Crate rtb_redact 

Source
Expand description

Free-form secret redaction for log lines, telemetry events, and diagnostic surfaces.

See docs/development/specs/2026-04-23-rtb-redact-v0.1.md for the full design and the seven-pass rule set.

use rtb_redact::string;

let scrubbed = string("connect to postgres://app:hunter2@db/mydb");
assert!(scrubbed.contains("[redacted]"));
assert!(!scrubbed.contains("hunter2"));

Statics§

SENSITIVE_HEADERS
Header names whose values must be redacted at DEBUG / TRACE log levels. Case-insensitive match via is_sensitive_header. phf::Set keeps lookup O(1) as the list grows.

Functions§

is_sensitive_header
Case-insensitive membership check against SENSITIVE_HEADERS.
redact_header_value
Unconditionally redact a header value. Callers invoke this for any header name matching is_sensitive_header.
string
Redact secrets in input, returning a borrowed Cow when no redactions apply and an owned String otherwise.
string_into
Same as string, but writes into a caller-supplied String. Useful for hot loops that want to reuse a buffer.