pub struct OperationalContextPolicy {
pub redact_emails: bool,
pub redact_phone_numbers: bool,
pub allow_sensitive_raw: bool,
pub allow_sensitive_command_persistence: bool,
pub custom_secret_patterns: Vec<String>,
}Expand description
Runtime policy for Operational Context redaction.
Fields§
§redact_emails: boolRedact email addresses only when explicitly configured.
redact_phone_numbers: boolRedact phone numbers only when explicitly configured.
allow_sensitive_raw: boolPermit raw artifact persistence for sensitive commands.
allow_sensitive_command_persistence: boolPermit permanent persistence for records associated with sensitive commands.
custom_secret_patterns: Vec<String>Extra repo/session patterns that must be redacted.
Implementations§
Source§impl OperationalContextPolicy
impl OperationalContextPolicy
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Build policy from environment variables.
Supported booleans:
ENGRAM_OC_REDACT_EMAILSENGRAM_OC_REDACT_PHONE_NUMBERSENGRAM_OC_ALLOW_SENSITIVE_RAWENGRAM_OC_ALLOW_SENSITIVE_COMMAND_PERSISTENCE
Sourcepub fn from_params(params: &Value) -> Self
pub fn from_params(params: &Value) -> Self
Build policy from env plus per-call/session parameters.
Callers may pass overrides either top-level or in one of:
operational_context_policy, context_policy, or redaction_policy.
Sourcepub fn redact_text(&self, input: &str) -> Result<RedactedText, PolicyError>
pub fn redact_text(&self, input: &str) -> Result<RedactedText, PolicyError>
Redact a single text field. Errors must be treated as fail-closed by callers.
Sourcepub fn analyze_command(&self, command: Option<&str>) -> SensitiveCommandAnalysis
pub fn analyze_command(&self, command: Option<&str>) -> SensitiveCommandAnalysis
Analyze a command string for sensitive Operational Context handling.
Sourcepub fn force_ephemeral(&self, analysis: &SensitiveCommandAnalysis) -> bool
pub fn force_ephemeral(&self, analysis: &SensitiveCommandAnalysis) -> bool
Sensitive commands must be persisted only as ephemeral records unless overridden.
Sourcepub fn allow_raw_for(&self, analysis: &SensitiveCommandAnalysis) -> bool
pub fn allow_raw_for(&self, analysis: &SensitiveCommandAnalysis) -> bool
Sensitive commands must not persist raw artifacts unless overridden.
Trait Implementations§
Source§impl Clone for OperationalContextPolicy
impl Clone for OperationalContextPolicy
Source§fn clone(&self) -> OperationalContextPolicy
fn clone(&self) -> OperationalContextPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OperationalContextPolicy
impl Debug for OperationalContextPolicy
Source§impl Default for OperationalContextPolicy
impl Default for OperationalContextPolicy
Source§fn default() -> OperationalContextPolicy
fn default() -> OperationalContextPolicy
impl Eq for OperationalContextPolicy
Source§impl PartialEq for OperationalContextPolicy
impl PartialEq for OperationalContextPolicy
Source§fn eq(&self, other: &OperationalContextPolicy) -> bool
fn eq(&self, other: &OperationalContextPolicy) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for OperationalContextPolicy
Auto Trait Implementations§
impl Freeze for OperationalContextPolicy
impl RefUnwindSafe for OperationalContextPolicy
impl Send for OperationalContextPolicy
impl Sync for OperationalContextPolicy
impl Unpin for OperationalContextPolicy
impl UnsafeUnpin for OperationalContextPolicy
impl UnwindSafe for OperationalContextPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more