Expand description
Generic “never surfaced via Debug/Display” wrapper for in-memory secrets.
deps_core::github::AuthToken, deps_cargo::config::AuthToken,
deps_nuget::config::NuGetAuth, and deps_nuget::config::RedactedSecret each
hand-rolled the same single-field tuple struct: a private/crate-visible constructor, an
as_str() accessor documented “never logged, printed, or otherwise surfaced”, and
hand-written Debug/Display impls that print *** (#573). Redacted<T> is the one
place that pattern is implemented, so the four call sites cannot silently diverge on it
and a fifth ecosystem crate needing the same guarantee does not reinvent it a fifth time.
Placed beside crate::net_policy::redact_userinfo, which owns the adjacent “a
credential must not leak via a log line” concern for URLs specifically, while this module
owns it for an owned secret value held in memory.
Beyond redacting Debug/Display, Redacted<T> zeroizes its backing memory on drop
(issue #574) — after the value goes out of scope, a core dump or a read of freed/swapped
memory cannot recover the plaintext credential.
Structs§
- Redacted
- A secret value whose
Debug/Displayoutput is always***, and whose backing memory is zeroized when it is dropped.