You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 derivingDebug
and not including the actual secret value. For exampledsecrecy::Secret
printsREDACTED
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 thePartialEq
impl is ever used. If not, I would recommend removing it. Otherwise, the derived impl should be replaced with a constant-time algorithm.The text was updated successfully, but these errors were encountered: