massa icon indicating copy to clipboard operation
massa copied to clipboard

Secrets not kept secret "by default" within the code-base

Open Ben-PH opened this issue 2 years ago • 0 comments

There is currently no utilities being used to guard against mismanagement of secrets within the source code. Maintaining confidentiality is highly fragile, requiring all code dealing with secrets to not have any logic errors.

Ideally, we would be able to depend on the compiler to catch any errors we make, and to require a conscious decision to use an escape-hatch (such as using unsafe as appropriate. e.g.


// returns an error if entropy is too low
let secret = Password::new("hunter2")?;

// prints out "[redacted]", or something
println!("{}", secret);

//prints out "hunter2"
println!("{}", unsafe {secret.reveal()});

This example is specific to password. A better solution might involve a generic wrapper that provides a similar interface.

Ben-PH avatar Jan 04 '23 11:01 Ben-PH