- Notifications
You must be signed in to change notification settings - Fork 324
Description
Both of these types potentially contain secrets in a Vec<u8>.
Deriving Debug means the secret is printed when using that impl. It can easily happen that this type is in some other struct, which is contained in some other struct, which is then logged accidentally. And suddenly you have leaked secrets in your log file. I would recommend manually deriving Debug and not including the actual secret value. For exampled secrecy::Secret prints REDACTED instead.
The derived PartialEq will result in a non-constant-time algorithm. While unlikely, if the key is ever compared to some value that an attacker can supply, then the attacker can employ a timing attack to extract the secret. I am not sure if the PartialEq impl is ever used. If not, I would recommend removing it. Otherwise, the derived impl should be replaced with a constant-time algorithm.