pub struct Redactor { /* private fields */ }Expand description
Configurable redaction builder for secrets and legacy field names.
Redactor encapsulates redaction policy and custom secret field names.
Build with Redactor::new(), configure via builder methods, then pass to
redaction functions like redacted_value or redact_url_secrets.
Implementations§
Source§impl Redactor
impl Redactor
Sourcepub fn secret_names<I: IntoIterator<Item = S>, S: Into<String>>(
self,
names: I,
) -> Self
pub fn secret_names<I: IntoIterator<Item = S>, S: Into<String>>( self, names: I, ) -> Self
Set custom field names to treat as secrets in addition to _secret suffixes.
Matching is exact field-name equality at any nesting level. The same
list also matches URL query-parameter names inside _url fields.
Builder style: returns self.
Sourcepub fn policy(self, policy: RedactionPolicy) -> Self
pub fn policy(self, policy: RedactionPolicy) -> Self
Set the redaction policy (default: full redaction).
Builder style: returns self.
Sourcepub fn value(&self, value: &Value) -> Value
pub fn value(&self, value: &Value) -> Value
Redact a JSON value copy using this redactor’s policy and secret names.
Sourcepub fn url(&self, url: &str) -> String
pub fn url(&self, url: &str) -> String
Redact secret components of a URL string using this redactor’s settings.
A query parameter is redacted iff its (form-decoded) name ends in
_secret/_SECRET or matches an exact entry in secret_names. The
userinfo password (scheme://user:pass@host) is always redacted as a
structural rule. Only the secret spans are replaced with ***; every
other byte is preserved. A string that is not a single, whitespace-free,
scheme-prefixed URL (including a URL embedded in surrounding prose) is
returned unchanged.