Skip to main content

SafetyNet

Trait SafetyNet 

Source
pub trait SafetyNet: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn supported_locales(&self) -> &[LocaleTag];
    fn check(
        &self,
        clean_text: &str,
        context: SafetyNetContext<'_>,
    ) -> Result<Vec<LeakSuspect>, SafetyNetError>;
}
Expand description

Observer-only post-clean check (Pass 3 in the detection pipeline).

Runs against already-tokenized output. May report suspected missed PII via LeakReport but must not mutate the token manifest, the CleanDocument, or the restore path. Safety nets are additive defense-in-depth, not a replacement for Pass 1/2 detection.

Activate at runtime with Pipeline::with_safety_net (post-build) or PipelineBuilder::register_safety_net (during build), or via the CLI --safety-net=<name> flag.

If a safety net reports a suspected miss, the caller decides the response; the pipeline never silently re-cleans based on safety net output.

Required Methods§

Source

fn id(&self) -> &str

Stable backend identifier used in telemetry and audit rows.

Source

fn supported_locales(&self) -> &[LocaleTag]

Locale tags supported by this safety net. Empty means global.

Source

fn check( &self, clean_text: &str, context: SafetyNetContext<'_>, ) -> Result<Vec<LeakSuspect>, SafetyNetError>

Checks clean text for possible PII that the manifest did not cover.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§