pub fn redact(text: &str) -> Cow<'_, str>Expand description
Scrub credential patterns from text. Returns Cow::Borrowed (no allocation)
when nothing matched, so the common case is cheap. The regex crate is
linear-time, so this is safe on adversarial/large input.
The result is a fixpoint: a marker can complete a match for an earlier rule
(its [ supplies the trailing \b an AWS key lacked when a bearer token
followed it directly), so after any match the rules sweep again until the
text stops changing. Callers can redact once and rely on
redact(redact(x)) == redact(x).