Skip to main content

SecretRedactor

Struct SecretRedactor 

Source
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

Source

pub fn new() -> Self

Create a redactor with no registered values.

Source

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.

Source

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.

Source

pub fn stream(&self) -> StreamingRedactor<'_>

Create an independent chunk-safe stream redactor.

Source

pub fn command_output(&self) -> CommandOutputRedactor<'_>

Create independent stdout and stderr redaction state.

Source

pub fn redact_bytes(&self, input: &[u8]) -> Vec<u8> ⓘ

Redact registered values from one complete byte buffer.

Source

pub fn redact_text(&self, input: &str) -> String

Redact registered values from one complete UTF-8 string.

Source

pub fn redact_arguments(&self, arguments: &[String]) -> Vec<String>

Redact command arguments by exact value and by sensitive option name.

Source

pub fn redact_environment( &self, environment: &BTreeMap<String, String>, ) -> BTreeMap<String, String>

Redact environment values by exact value and by sensitive variable name.

Source

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.

Trait Implementations§

Source§

impl Default for SecretRedactor

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.