pub struct SecretRedactor { /* private fields */ }Expand description
Central exact-value and structured-field redactor.
Registered patterns are held in SecretBytes and are therefore neither
debug-formatted nor serialized. Register every secret before starting the
child process or provider request that may emit it.
Implementations§
Source§impl SecretRedactor
impl SecretRedactor
Sourcepub fn register_secret(&mut self, secret: &Secret) -> Result<(), RedactionError>
pub fn register_secret(&mut self, secret: &Secret) -> Result<(), RedactionError>
Register a UTF-8 secret without taking ownership from its caller.
§Errors
Returns RedactionError::EmptySecret for an empty value.
Sourcepub fn register_secret_bytes(
&mut self,
secret: &SecretBytes,
) -> Result<(), RedactionError>
pub fn register_secret_bytes( &mut self, secret: &SecretBytes, ) -> Result<(), RedactionError>
Register arbitrary secret bytes without taking ownership from its caller.
§Errors
Returns RedactionError::EmptySecret for an empty value.
Sourcepub fn stream(&self) -> StreamingRedactor<'_>
pub fn stream(&self) -> StreamingRedactor<'_>
Create an independent chunk-safe stream redactor.
Sourcepub fn command_output(&self) -> CommandOutputRedactor<'_>
pub fn command_output(&self) -> CommandOutputRedactor<'_>
Create independent stdout and stderr redaction state.
Sourcepub fn redact_bytes(&self, input: &[u8]) -> Vec<u8> ⓘ
pub fn redact_bytes(&self, input: &[u8]) -> Vec<u8> ⓘ
Redact registered values from one complete byte buffer.
Sourcepub fn redact_text(&self, input: &str) -> String
pub fn redact_text(&self, input: &str) -> String
Redact registered values from one complete UTF-8 string.
Sourcepub fn redact_arguments(&self, arguments: &[String]) -> Vec<String>
pub fn redact_arguments(&self, arguments: &[String]) -> Vec<String>
Redact command arguments by exact value and by sensitive option name.
Sourcepub fn redact_environment(
&self,
environment: &BTreeMap<String, String>,
) -> BTreeMap<String, String>
pub fn redact_environment( &self, environment: &BTreeMap<String, String>, ) -> BTreeMap<String, String>
Redact environment values by exact value and by sensitive variable name.
Sourcepub fn redact_json_value(&self, value: &mut Value)
pub fn redact_json_value(&self, value: &mut Value)
Recursively redact known values and structurally sensitive JSON fields.
Secret-reference fields remain visible because they carry opaque, validated identifiers rather than secret material.