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 information in any string. URLs found in the text get full URL redaction (query params, userinfo, path tokens); the remainder gets a regex pass for URL fragments. 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 userinfo passwords (user:pass@host), proxy path segments, credential-shaped path segments, and URLs nested in query values (magnet tr= announce URLs, redirect targets). If parsing fails, it uses a regex fallback to perform the same redaction.
Types ¶
This section is empty.