Documentation
¶
Overview ¶
Package redact provides utilities for redacting sensitive information from URLs and errors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BasicAuthUser ¶
BasicAuthUser redacts the password from a basic auth credential string. "user:password" -> "user:REDACTED"
func ProxyPath ¶
ProxyPath redacts API key segments from proxy paths. /proxy/{api-key}/... -> /proxy/REDACTED/...
func String ¶
String redacts sensitive query parameter values in any string using regex. Also redacts userinfo passwords and proxy path segments. This is useful for sanitizing error messages that may contain URLs or URL fragments.
func URLError ¶
URLError wraps a *url.Error (if present) with a redacted URL. If err is or wraps *url.Error, returns a cloned error with the URL redacted. Otherwise returns err unchanged.
func URLString ¶
URLString redacts sensitive query parameter values in a URL string. Also redacts passwords in userinfo (user:pass@host) and proxy path segments. If the URL can be parsed, it replaces values of known sensitive parameters with REDACTED. If parsing fails, it uses a regex fallback to perform the same redaction.
Types ¶
This section is empty.