Skip to main content

Module masking

Module masking 

Source
Available on crate feature masking only.
Expand description

PII detection + column-level masking policies (issue #206): a declarative, destination-scoped policy that classifies sensitive fields — by field-name pattern, by value detector (email / card-with-Luhn / SSN / phone / IPv4), or by explicit field list — and rewrites them per action (redact / hash / tokenize / partial).

Ordering. The masking pass runs first in the page loop — before the quality, contract, and schema-drift passes and before every sink write. So every downstream consumer (those passes, the sink, the DLQ, and the sink-side lineage sample) observes only masked values; PII never leaks to a sink, a dead-letter queue, or a lineage facet. Masking is value-only and key-preserving, and it keeps determinism (equal inputs → equal masked outputs), non-null-ness, and per-key uniqueness, so the later quality / contract checks stay meaningful over masked data.

Masking never fails a run or quarantines a record: matching fields are rewritten in place. The pipeline wires metrics in instrumented_apply_masking.

Re-exports§

pub use compile::CompiledMasking;
pub use config::Detector;
pub use config::MaskAction;
pub use config::MaskRule;
pub use config::MaskingSpec;
pub use config::MatchSpec;

Modules§

compile
Compilation + fail-fast validation for the masking layer (issue #206). Turns a MaskingSpec into a CompiledMasking with pre-compiled regexes and a resolved Hasher, optionally scoped to a single destination sink. Bad regexes / empty rule sets surface as FaucetError::Config at config-load time, never mid-run.
config
Config-shaped types for the PII detection + column-masking layer (issue #206). Pure declarations — validation and compilation live in compile.rs, evaluation in the module root.

Structs§

MaskHit
One field-masking event, for metrics/observability.
MaskingOutcome
Result of masking one page.

Functions§

apply_masking
Apply the masking policy to one page. Pure: no metrics, no I/O, infallible.