Don't implement Display
for @sensitive
string shapes and don't #[derive(Debug)]
#3604
Labels
Display
for @sensitive
string shapes and don't #[derive(Debug)]
#3604
We currently newtype constrained string shapes. When they are marked as
@sensitive
:We also implement
Display
:and derive
Debug
:Don't implement
Display
. ImplementingDisplay
is footgunny. If you have afn save_password_to_database(password: String)
, callingsave_password_to_database(password.to_string())
seems like would make sense, but would cause permanent data loss. Users should instead use the generatedpassword.into_inner()
, so it's better to point them in that direction by avoiding implementingDisplay
.Don't
#[derive(Debug)]
. WhileDebug
should format in a programmer-facing debugging context, debugging with the redaction should suffice.Debug
is implemented throughout smithy-rs e.g. theDebug
implementation for a structure shape that has member shapes that target@sensitive
string shapes will print the struct with redactions for the@sensitive
strings.sensitive.rs
; see RFC: Logging in the Presence of Sensitive Data.The text was updated successfully, but these errors were encountered: