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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
url | string | URL | Absolute URL string or URL instance to sanitize. |
Returns
Section titled “Returns”string
A loggable URL string, or REDACTED when the value cannot be parsed as a URL (an unparsable value may still embed credentials).