MATIH Platform is in active MVP development. Documentation reflects current implementation status.
9. Query Engine & SQL
Security
Data Masking

Data Masking

Data masking protects sensitive information by transforming column values in query results before they are returned to the user. The QueryResultMaskingService applies masking rules based on data classifications from the governance service, ensuring that unauthorized users see obfuscated data while authorized users see the original values.


Masking Process

Query Results          QueryResultMaskingService       GovernanceServiceClient
     |                         |                              |
     |--- Raw results -------->|                              |
     |                         |--- Get masking rules ------->|
     |                         |<-- Classification rules -----|
     |                         |                              |
     |                         |--- Apply masking per column  |
     |                         |--- Check user exemptions     |
     |                         |                              |
     |<-- Masked results ------|                              |

Masking Types

TypeDescriptionExample
FULLReplace entire value with mask characters***
PARTIALMask portion of the valuejohn.***@example.com
HASHReplace with deterministic hasha1b2c3d4
REDACTRemove value entirely[REDACTED]
TOKENIZEReplace with reversible tokentok_abc123
NULLIFYReplace with nullnull
CUSTOMApply custom masking functionDefined per classification

Masking Rules

Masking rules are derived from data classifications in the governance service:

Classification PropertyEffect
requireMasking = trueColumn is masked for non-exempt users
maskingTypeDetermines the masking algorithm
sensitivityLevelHigher levels use stronger masking
allowedRolesUsers with these roles see unmasked data

Exemptions

Users may be exempt from masking based on:

CriteriaDescription
RoleUsers with DATA_ADMIN or governance roles see unmasked data
PurposeSpecific access purposes may grant temporary exemption
JustificationTime-limited access with documented justification

Performance Impact

  • Masking is applied post-query, so it does not affect query execution time
  • The masking service processes results in a streaming fashion to minimize memory overhead
  • Classification lookups are cached with configurable TTL
  • Masking of large result sets adds proportional processing time

Configuration

Masking behavior is configured at the classification level through the governance service. The Query Engine does not manage masking rules directly; it consumes them from the governance service via the GovernanceServiceClient.