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

Masking Audit

Every data masking operation is logged to an audit trail for compliance and monitoring purposes. The MaskingAuditService records which columns were masked, for which user, and what masking type was applied. Audit logs are queryable through the MaskingAuditController.


Audit Log Fields

Each masking audit entry records:

FieldDescription
idUnique audit log identifier
tenantIdTenant context
userIdUser whose results were masked
executionIdQuery execution identifier
tableNameTable containing the masked column
columnNameColumn that was masked
maskingTypeMasking algorithm applied
classificationIdData classification that triggered masking
rowsAffectedNumber of rows with masked values
wasExemptWhether the user was exempt from masking
exemptionReasonReason for exemption (if applicable)
timestampWhen the masking was applied

Querying Audit Logs

The MaskingAuditController exposes endpoints for querying masking audit history:

MethodEndpointDescription
GET/v1/masking/auditList masking audit logs (paginated)
GET/v1/masking/audit/:executionIdGet logs for a specific query
GET/v1/masking/audit/summaryGet masking statistics

Audit Log Storage

Masking audit logs are stored in the masking_audit_log table within the Query Engine's database. The entity is defined in MaskingAuditLog.java and managed by the MaskingAuditLogRepository.

MaskingAuditLog
  - id: UUID (primary key)
  - tenantId: UUID
  - userId: UUID
  - executionId: UUID
  - tableName: String
  - columnName: String
  - maskingType: String
  - classificationId: UUID
  - rowsAffected: Long
  - wasExempt: Boolean
  - exemptionReason: String
  - createdAt: Instant

Compliance Requirements

The masking audit trail supports the following compliance needs:

RequirementHow It Is Met
Access trackingEvery masked column access is logged
Exemption justificationExemptions are recorded with reasons
Data lineageAudit links to query execution and classification
RetentionAudit logs follow tenant retention policies
ReportingSummary statistics available for compliance reports

Integration with Platform Audit

Masking audit events are forwarded to the centralized audit service via Kafka for platform-wide audit reporting. The event payload includes tenant ID, user ID, classification reference, and masking details.