Skip to main content

RedactionPolicy

Struct RedactionPolicy 

Source
pub struct RedactionPolicy { /* private fields */ }
Expand description

Immutable field classification, masking, format, and resource policy.

A disabled policy intentionally restores original values while retaining resource limits. It is a deliberate debugging escape hatch whose authorization belongs to downstream code.

§Warning

Disabling this policy opts out of confidentiality redaction. Every supported format, derived field mode, and redaction-specific skip path may publish its original value. Resource limits and diagnostic control-character escaping still apply, but they do not make the output redacted. The framework faithfully executes the chosen policy; it cannot and does not attempt to prevent downstream code from deliberately or accidentally disabling redaction. Callers own the authorization, environment, timing, and consequences of that choice. They can observe it through crate::RedactionSummary::is_redaction_disabled and crate::RedactionInspection::is_redaction_disabled.

§Examples

use qubit_redact::RedactionPolicy;

let mut policy = RedactionPolicy::disabled();
assert!(policy.is_disabled());
policy.set_disabled(false);
assert!(!policy.is_disabled());

Implementations§

Source§

impl RedactionPolicy

Source

pub fn standard() -> Self

Returns the fixed built-in standard policy.

Its application rules are empty and its explicit floor is RedactionFloor::standard, so it never observes later process-wide default installations.

Source

pub fn strict() -> Self

Returns a strict boundary policy whose unknown fields are masked at Sensitivity::Secret in addition to the standard floor.

This preset is intended for untrusted external boundaries. It is more protective than Self::standard but may reduce diagnostic detail.

Source

pub fn disabled() -> Self

Returns the standard policy with confidentiality redaction globally disabled.

§Warning

Outputs produced with this policy may contain every original value. Limits and control-character escaping remain active, but masking and redaction-specific field decisions do not. This deliberate debugging capability transfers confidentiality responsibility to the caller.

Source

pub const fn is_disabled(&self) -> bool

Returns whether this policy publishes original values while retaining limits and control-character escaping.

A true result means confidentiality redaction is disabled.

Source

pub fn set_disabled(&mut self, disabled: bool) -> &mut Self

Changes the global redaction switch and returns this policy for chaining.

§Warning

Passing true allows every supported redaction entry to publish its original value. The caller owns authorization and operational controls; the framework does not distinguish debugging use from misuse.

Source

pub fn builder() -> RedactionPolicyBuilder

Creates a deterministic builder with no application rules and the standard minimum-protection floor.

Source

pub fn to_builder(&self) -> RedactionPolicyBuilder

Creates a builder that exactly copies self.

The copy includes application rules, limits, and the attached floor.

Source

pub const fn limits(&self) -> &RedactionLimits

Returns all static limits used by this policy.

Source

pub fn http(&self) -> &HttpPolicy

Returns the unified HTTP context policy.

Source

pub fn uri(&self) -> &UriPolicy

Returns the unified URI context policy.

Source

pub const fn unkeyed_json_value_policy(&self) -> UnkeyedJsonValuePolicy

Returns the behavior for root and array JSON scalar values.

Source

pub const fn rules(&self) -> &RedactionRules

Returns the immutable field rules without diagnostic resource limits.

Source

pub fn floor(&self) -> Option<&RedactionFloor>

Returns the attached minimum floor, or None when it was explicitly disabled.

Source

pub fn with_floor(self, floor: RedactionFloor) -> Self

Replaces the floor for this immutable policy.

Source

pub fn disable_floor(self) -> Self

Disables every floor for this immutable policy.

§Security

This explicitly removes minimum protection inherited from any source.

Source

pub fn classify_field<'a>(&'a self, field: &str) -> FieldClassification<'a>

Explains application-rule matching for field without applying the floor.

This is useful for diagnostics about configured application rules. Use Self::sensitivity_for for the final security decision.

Source

pub fn sensitivity_for(&self, field: &str) -> Option<Sensitivity>

Returns the final sensitivity for field after applying application rules and the enabled floor.

Returns None only when neither layer classifies the field as sensitive.

Source

pub fn matching(&self) -> FieldNameMatching

Returns the application layer’s field-name matching mode.

An attached floor may use a different matching mode for its independent classification.

Source

pub fn unknown_field_policy(&self) -> UnknownFieldPolicy

Returns the application layer’s fallback for unclassified fields.

An attached floor applies its own fallback independently.

Source

pub fn masking(&self) -> &MaskingPolicy

Returns the single mask table used by every sensitivity decision.

Field classification determines the effective sensitivity; this table determines how that sensitivity is rendered. Floors never own a second mask table.

Source

pub fn application_sensitive_rules( &self, ) -> impl Iterator<Item = SensitiveFieldRule<'_>>

Iterates sensitive rules configured in the application layer only.

Use Self::floor to inspect the independent minimum-protection rules.

Source

pub fn application_allow_rules(&self) -> impl Iterator<Item = AllowRule<'_>>

Iterates allow rules configured in the application layer only.

These rules never bypass an enabled floor.

Trait Implementations§

Source§

impl Clone for RedactionPolicy

Source§

fn clone(&self) -> RedactionPolicy

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RedactionPolicy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RedactionPolicy

Source§

fn default() -> Self

Clones the fixed standard policy.

Source§

impl Eq for RedactionPolicy

Source§

impl PartialEq for RedactionPolicy

Source§

fn eq(&self, other: &RedactionPolicy) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RedactionPolicy

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.