securefmt

Crates.iosecurefmt
lib.rssecurefmt
version0.1.5
sourcesrc
created_at2021-03-20 16:10:56.20585
updated_at2024-09-14 09:12:49.916462
descriptionDrop-in replacement for the Debug derive macro that hides fields marked as sensitive.
homepage
repositoryhttps://gitlab.com/pfouilloux/securefmt
max_upload_size
id371407
size35,406
Pierre Fouilloux (pfouilloux)

documentation

README

securefmt

Build Status Latest Version Docs

Drop-in replacement for the Debug derive macro that hides fields marked as sensitive.

Example

The following code snippet

#[derive(Debug)]
struct SensitiveData {
    id: u8,
    #[sensitive]
    secret: u8
}

fn main() {
    println!("{:?}", SensitiveData { id: 1, secret: 42 })
}

will print:

SensitiveData { id: 1, secret: <redacted> }

If the [debug_mode] feature is active, the same code will print:

WARN - WARNING: securefmt debug_mode feature is active. Sensitive data may be leaked. It is strongly recommended to disable debug_mode in production releases.
SensitiveData { id: 1, secret: 42 }
Commit count: 32

cargo fmt