Skip to main content

Module sensitive

Module sensitive 

Source
Expand description

Sensitive string type for fields that must never be exposed.

SensitiveString wraps a String but always serialises as "***REDACTED***". This provides compile-time guarantees that the value cannot leak through serialisation — not in the config registry, not in logs, not in debug output, not in API responses.

This module is always available (no feature gate) so that any module can use SensitiveString regardless of which features are enabled.

§Three layers of secret protection

LayerMechanismCatches
#[serde(skip_serializing)]Field absent from outputFields that should never appear
Heuristic auto-redactionField name pattern matchingCommon names: password, secret, token, key
SensitiveString typeValue always serialises as redactedNon-obvious fields: connection_string, dsn

§Usage

use hyperi_rustlib::SensitiveString;
use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize)]
struct DbConfig {
    host: String,
    port: u16,
    connection_string: SensitiveString,  // Always redacted
}

Structs§

SensitiveString
A string value that is always redacted when serialised.