redaction
Masks credentials in text bound for logs and error reports.
Error messages often quote whatever a failure carried: an SDK exception that prints the headers it sent, a URL signed for one download, a provider body echoing the key it rejected. redact_secrets masks the credential and keeps the rest, so a message still says what went wrong.
It masks three things:
The value of any
name=valueorname: valuepair, quoted or not, whose name marks a credential (api_key,Authorization,X-Amz-Signature,apiKey…). This covers query strings, printed header dicts and plain prose alike. An exception class name followed by its message (KeyError: ...) is not a credential name.A URL’s password (
scheme://user:password@host).Tokens recognizable by their format alone: provider key prefixes, AWS access key IDs and JWTs.