Interface IDataMasker
- Namespace
- Excalibur.Compliance
- Assembly
- Excalibur.Compliance.Abstractions.dll
Service for masking sensitive data (PII/PHI) in strings and objects.
public interface IDataMasker
Remarks
The data masker uses regex-based pattern matching to identify and mask sensitive data patterns including:
- Email addresses
- Phone numbers
- Social Security Numbers (SSN)
- Credit card numbers (PCI-DSS compliance)
- IP addresses
For object masking, the service uses reflection to discover properties marked with
PersonalDataAttribute or SensitiveAttribute
with MaskInLogs = true.
Methods
Mask(string, MaskingRules)
Masks sensitive data patterns in a string.
string Mask(string input, MaskingRules rules)
Parameters
inputstringThe input string to mask.
rulesMaskingRulesThe masking rules to apply.
Returns
- string
The masked string with sensitive data replaced.
MaskAll(string)
Masks sensitive data patterns in a string using default rules.
string MaskAll(string input)
Parameters
inputstringThe input string to mask.
Returns
- string
The masked string with all default patterns masked.
MaskObject<T>(T)
Masks sensitive properties in an object based on attributes and rules.
[RequiresUnreferencedCode("Object masking uses JSON serialization which may require preserved members for the runtime type.")]
[RequiresDynamicCode("Object masking uses JSON serialization which may require dynamic code generation.")]
T MaskObject<T>(T obj) where T : class
Parameters
objTThe object to mask.
Returns
- T
A copy of the object with sensitive data masked.
Type Parameters
TThe type of object to mask.
Remarks
Properties marked with [PersonalData(MaskInLogs = true)] or [Sensitive(MaskInLogs = true)] will have their values masked. The original object is not modified.