A3S Docs
A3S Common

Privacy

Sensitivity levels, regex rules, classification results, keyword matching, redaction, and TEE flags in A3S Common.

Common Privacy

a3s_common::privacy provides reusable classification primitives. It is a library layer, not a global privacy policy.

Sensitivity Levels

SensitivityLevel is ordered from lowest to highest:

LevelMeaning
PublicSafe public data.
NormalOrdinary working data.
SensitiveData that should trigger extra care.
HighlySensitiveData that generally requires stronger handling.
CriticalHighest-risk match class.

The classifier marks requires_tee when the overall level is at least Sensitive.

Regex Classification

ClassificationRule carries:

FieldRole
nameRule identifier.
patternRegex pattern compiled by RegexClassifier::new.
levelSensitivity assigned to each match.
descriptionHuman-readable description.

RegexClassifier::classify(text) returns ClassificationResult with the overall level, all ClassificationMatch records, and the TEE flag. Each match records the rule name, level, start/end offsets, and matched text.

Redaction

RedactionStrategy supports:

StrategyBehavior
MaskReplace known match types with masked forms, or [REDACTED] for generic matches.
RemoveRemove the matched text.
HashReplace the match with a length-based placeholder.

RegexClassifier::redact(text, strategy) classifies first, then replaces matches in reverse offset order so earlier replacements do not shift later spans.

Keyword Matching

KeywordMatcherConfig supports normal keywords, sensitive keywords, case-sensitive matching, and a tee_threshold. KeywordMatcher::classify returns the configured threshold when a sensitive keyword matches, Normal for regular keyword matches, and Public when no keyword matches.

Boundary

Common detects and transforms text. Product components still decide what a match means for authorization, logging, tool execution, routing, or TEE enforcement.

On this page