Skip to main content

Module url_redact

Module url_redact 

Source
Expand description

Shared URL-userinfo redaction for logs and diagnostics.

The upstream_url field is validated to only require an http(s):// scheme, so an operator whose provider requires HTTP Basic auth (a common pattern with self-hosted litellm/proxy shims) can legitimately put credentials in the URL as https://user:pass@host/…. Every tracing/log statement that renders that field then ships the credentials to OTLP/SIEM. avctl doctor already redacts it; this helper is the shared implementation so every log site can do the same.

Semantics: keep the scheme + host(:port)(+ path/query/fragment) intact so log correlation still works; replace any user[:pass] segment with ***. Handle comma-separated cluster lists (Redis Cluster style: redis://user:pass@host1,host2,host3) without splitting on commas that belong to a password.

Functions§

redact_userinfo
Redact URL userinfo. Non-URL inputs are returned verbatim.