privacy/sanitizers library

Classes

DefaultSanitizer
Default, privacy-first sanitizer that masks known sensitive fields by key (e.g., "password", "token", "authorization", etc.) and optionally applies content-based masking for values that look like secrets (JWTs, access keys, long base64 tokens, card numbers).
FilterSanitizer
Bridge to apply a DataFilter as a Sanitizer.
MaskingStrategy
Strategy for masking strings while preserving limited structure.
MaxDepthSanitizer
Prunes nested structures beyond maxDepth. Replaces pruned nodes with a marker to signal redaction.
RegexValueSanitizer
Rewrites any string values that match a given regex to a replacement. Useful for emails/phones if you want to aggressively strip PII.
SanitizerChain
Compose sanitizers in order.
SensitiveFieldMatcher
Matches sensitive keys and/or path segments.
SizeBudgetSanitizer
Ensures the serialized JSON stays under maxBytes. If the payload exceeds the budget, the sanitizer drops entries heuristically (starting with the largest string/list/map values) until the size fits. You may pin keys that must be retained via pinnedTopLevelKeys.
TruncatingSanitizer
Caps string length, list length, and map entry count to prevent oversized payloads.

Mixins

Sanitizer
Base interface for sanitizers.

Extensions

ReportEventSanitizer on Sanitizer
Convenience to apply a sanitizer directly to a ReportEvent.