-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Closed as duplicate of#37009
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.
Description
Lets say we have a struct like
#[derive(Debug, Display)]
struct PasswordResetRequest {
username: String,
password: String,
}
If this were logged or printed then we would be disclosing the user's password into logs or other output mediums.
Today one can avoid this by manually implementing Debug and Display on structs that may have sensitive data, but it would be simpler if we could opt-out of fields being displayed. For example
#[derive(Debug, Display)]
struct PasswordResetRequest {
username: String,
#[display(sensitive)]
password: String,
}
This would allow the password field to be skipped (or at least redacted) in outputs.
alternatives
A secretstring library that wraps all strings that should be redacted. To date I'm not aware of one, but I can see that this has value in std as a whole.
yaleman
Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.