pub fn redact_text(text: &str) -> StringExpand description
Redact every credential found in text.
Two passes run in order:
- URLs. In each
scheme://token the password of the userinfo (or the whole userinfo when it has nouser:part) becomesREDACTED. The userinfo ends at the last@before the end of the line or the nextscheme://, so a password holding an unencoded/ ? # @, space or quote is still hidden. A comma separated list of URLs is redacted URL by URL. key=valuepairs anywhere in the text: URL query parameters, libpq DSNs (password=x), ADO strings (;Pwd=x;) and the like. Whenis_secret_key(key)holds, the value becomesREDACTED. A quoted value is redacted up to its closing quote; an unquoted one up to whitespace,;or&.
Args: text: Free text that may hold connection strings.
Returns: The text with every recognised secret replaced.