Severity: HIGH
Location
crates/wallet/src/keystore.rs line 886, crates/wallet/src/backup.rs line 107
Description
Public API functions accept passwords as &str. The caller's original String, readline buffer, or stack frame cannot be zeroed by this library — the plaintext password persists in heap allocations, CLI readline buffers, and stack frames across the process lifetime.
Fix
Accept SecretString or Zeroizing<String> at the API boundary:
use secrecy::{SecretString, ExposeSecret};
pub fn encrypt_keystore(data: &[u8], password: &SecretString) -> Result<EncryptedKeystore> {
let pass = password.expose_secret().as_bytes();
// password is automatically zeroized when SecretString is dropped
}
Severity: HIGH
Location
crates/wallet/src/keystore.rsline 886,crates/wallet/src/backup.rsline 107Description
Public API functions accept passwords as
&str. The caller's originalString, readline buffer, or stack frame cannot be zeroed by this library — the plaintext password persists in heap allocations, CLI readline buffers, and stack frames across the process lifetime.Fix
Accept
SecretStringorZeroizing<String>at the API boundary: