Table of Contents

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

input string

The input string to mask.

rules MaskingRules

The 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

input string

The 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

obj T

The object to mask.

Returns

T

A copy of the object with sensitive data masked.

Type Parameters

T

The 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.