Expand description
Redaction of credentials embedded in provider URLs. L1 RPC providers put the API key in the
path or query (https://host/v2/KEY), so the host is kept and everything after it dropped. A
credential in the hostname is not redactable.
scrub works on already-rendered text, which is the only handle available when the URL is
baked into someone elseโs Debug/Display (reqwest prints the full request URL in both).
redact_url takes a Url directly.
It handles two shapes that share no common substring. Urlโs own Debug is field-wise, with the
host and path: "/v2/KEY" as separate fields and no :// between them, so URL-shaped matching
misses it entirely. Structs holding a Url redact that field themselves; scrub_url_debug
is the net for one that does not.
Constantsยง
- REDACTED ๐
- URL_
DEBUG_ ๐PREFIX
Functionsยง
- ends_
url_ ๐token - Characters
Url::as_str()percent-encodes in every component, so they cannot occur inside a rendered URL. Nothing may be added here without that guarantee:),,,|and^are legal in a path, and`,{and}are legal in a query or fragment; ending a URL on any of them would leave the tail after it in the output. - redact_
url scheme://host[:port], with/***appended when anything was removed.- redact_
urls - scrub
- scrub_
url_ ๐debug - Collapses the body of every
url::Urlfield-wiseDebugintext, host included. Reaching this means a struct failed to redact aUrlfield, soUrl { *** }is a signal to fix that struct rather than output to read a host out of. - scrub_
urls ๐ - Replaces everything after the host of every URL in
textwith***.