Skip to content

redactUrlForLogging

function redactUrlForLogging(url: string | URL): string;

Defined in: src/logging/redaction.ts:95

Strips credentials and query/fragment content from a URL before logging.

Query strings routinely carry bearer material - SigV4 X-Amz-Signature values, SAS tokens, signed-URL parameters - so the entire search and hash segments are replaced rather than filtered key-by-key. Embedded user:password@ userinfo is removed. Origin and pathname are preserved because they are what operators need to correlate a failing request.

ParameterTypeDescription
urlstring | URLAbsolute URL string or URL instance to sanitize.

string

A loggable URL string, or REDACTED when the value cannot be parsed as a URL (an unparsable value may still embed credentials).