Skip to main content

redact_host

Function redact_host 

Source
pub fn redact_host(host: &str) -> String
Expand description

Redact a bare host value for logs (ADR-0076, lint-log-redaction). A bare host carries no // authority window, so redact_url is a semantic no-op on it; this helper masks everything before the LAST @ instead (***@host). The host grammar carries no userinfo, but the value can be externally influenced (a config field the URI parser can route user:pass@host into), so userinfo-shaped input is masked defensively — through the LAST @, because over-masking is safe and under-masking is not. Clean hosts pass through unchanged for diagnosability. Canonical single source: components log host fields through this helper, not crate-local twins (bd rc-8bxeo).