MATIH Platform is in active MVP development. Documentation reflects current implementation status.
3. Security & Multi-Tenancy
Compliance Patterns

Compliance Patterns

The MATIH Platform is designed to support compliance with major regulatory frameworks including SOC 2, HIPAA, and GDPR. This section maps the platform's technical controls to specific compliance requirements and describes the operational patterns that organizations can use to maintain their compliance posture.


Compliance Overview

FrameworkFocusKey RequirementsMATIH Controls
SOC 2Security, availability, processing integrity, confidentiality, privacyAccess controls, logging, encryption, change managementRBAC, audit trail, AES-256 encryption, CI/CD pipeline
HIPAAProtected Health Information (PHI)Access controls, audit trails, encryption, breach notificationTenant isolation, per-tenant encryption, audit logging
GDPRPersonal data of EU residentsConsent management, data subject rights, data minimization, breach notificationPrivacy dashboard, consent management, DSR handling

SOC 2 Controls

SOC 2 compliance is organized around five Trust Services Criteria. The following table maps MATIH's technical controls to each criterion.

Security (Common Criteria)

ControlSOC 2 RequirementMATIH Implementation
CC6.1Logical and physical access controlsJWT authentication, RBAC, Kubernetes RBAC, namespace isolation
CC6.2User provisioning and deprovisioningIAM service user lifecycle, role assignment, access revocation
CC6.3Role-based accessRbacService with hierarchical roles, PermissionEvaluator
CC6.6Encryption in transitTLS 1.2+ on all endpoints, mTLS for service mesh
CC6.7Encryption at restAES-256-GCM, per-tenant keys, cloud KMS integration
CC6.8Vulnerability managementContainer image scanning, dependency scanning in CI/CD
CC7.1Security monitoringPrometheus metrics, Grafana alerting, anomaly detection
CC7.2Security incident responseAudit trail, LoginAnomalyDetector, alert escalation
CC7.3Incident communicationNotification service, webhook alerts, audit exports

Availability

ControlSOC 2 RequirementMATIH Implementation
A1.1System availability commitmentsKubernetes self-healing, pod autoscaling, multi-AZ deployment
A1.2Recovery proceduresDisaster recovery scripts, database backup/restore, Velero snapshots
A1.3Recovery testingHealth check scripts, platform status monitoring

Processing Integrity

ControlSOC 2 RequirementMATIH Implementation
PI1.1Processing accuracyInput validation (InputValidation class), data quality service
PI1.2Error handlingStructured error responses, retry policies, dead letter queues
PI1.3Output completenessQuery result verification, dashboard data validation

Confidentiality

ControlSOC 2 RequirementMATIH Implementation
C1.1Confidential information identificationData classification tags, sensitivity labels
C1.2Confidential information disposalTenant data purge on deprovisioning, secure deletion

Privacy

ControlSOC 2 RequirementMATIH Implementation
P1.1Privacy noticeConfigurable privacy policies per tenant
P2.1ConsentConsent management service
P3.1Personal information collectionData minimization policies, purpose limitation
P4.1Use of personal informationUsage tracking, purpose-based access controls
P6.1Data subject rightsGDPR DSR handling (see below)

Audit Logging

The audit trail is the backbone of compliance monitoring. Every security-relevant action is recorded as an immutable AuditEvent.

AuditEvent Structure

public record AuditEvent(
    String eventId,          // Unique event identifier
    String eventType,        // e.g., "AUTH_LOGIN", "DATA_ACCESS", "ROLE_CHANGE"
    String userId,           // Who performed the action
    String tenantId,         // Which tenant context
    String resourceType,     // e.g., "dashboard", "query", "user"
    String resourceId,       // Specific resource identifier
    String action,           // e.g., "CREATE", "READ", "UPDATE", "DELETE"
    String outcome,          // "SUCCESS" or "FAILURE"
    String ipAddress,        // Client IP address
    String userAgent,        // Client user agent
    Map<String, Object> metadata,  // Additional context
    Instant timestamp        // When the event occurred
)

Audited Events

Event CategoryEvent TypesTrigger
AuthenticationAUTH_LOGIN, AUTH_LOGOUT, AUTH_REFRESH, AUTH_MFA_VERIFYLogin, logout, token refresh, MFA verification
AuthorizationAUTH_DENIED, PERMISSION_CHECK, ROLE_CHANGEAccess denied, permission evaluation, role assignment
Data AccessDATA_READ, DATA_WRITE, DATA_DELETE, QUERY_EXECUTEAny data operation
ConfigurationCONFIG_CHANGE, SECRET_ROTATION, POLICY_UPDATESettings, secrets, policy modifications
User ManagementUSER_CREATE, USER_UPDATE, USER_DELETE, USER_LOCKUser lifecycle events
ImpersonationIMPERSONATION_START, IMPERSONATION_ENDAdmin impersonation sessions
API KeysAPI_KEY_CREATE, API_KEY_REVOKE, API_KEY_ROTATEAPI key lifecycle

Audit Logging Usage

AuditLogger auditLogger = new AuditLogger();
 
auditLogger.log(AuditEvent.builder()
    .eventType("DATA_ACCESS")
    .userId("user-123")
    .tenantId("acme-corp")
    .resourceType("dashboard")
    .resourceId("dash-456")
    .action("READ")
    .outcome("SUCCESS")
    .ipAddress("203.0.113.42")
    .metadata(Map.of("queryCount", 5))
    .build());

Audit Trail Storage

EnvironmentStorageRetention
DevelopmentPostgreSQL audit_events table30 days
StagingPostgreSQL + Loki90 days
ProductionPostgreSQL + Loki + Cloud Object Storage (S3/Blob)7 years

Audit logs are append-only and protected against modification. In production, logs are streamed to immutable cloud storage for long-term retention.


HIPAA Compliance Patterns

For organizations handling Protected Health Information (PHI), MATIH provides additional safeguards.

Technical Safeguards

HIPAA RequirementMATIH Implementation
Access control (164.312(a)(1))RBAC with minimum necessary access, per-tenant isolation
Audit controls (164.312(b))Comprehensive audit trail with 7-year retention
Integrity controls (164.312(c)(1))AES-256-GCM authenticated encryption, data checksums
Transmission security (164.312(e)(1))TLS 1.2+ on all communications
Authentication (164.312(d))JWT + MFA, API key authentication

Administrative Safeguards

HIPAA RequirementPlatform Support
Security officer designationRole: security_officer with audit read access
Workforce trainingAudit trail of user activity for training verification
Access managementAutomated provisioning/deprovisioning, access request workflow
Incident proceduresAnomaly detection, alert routing, audit trail for investigation

Physical Safeguards

HIPAA RequirementPlatform Support
Facility accessKubernetes on cloud infrastructure (provider responsibility)
Workstation securityPod security policies, read-only filesystems
Device and media controlsEncrypted persistent volumes, secure volume deletion

Business Associate Agreements

When MATIH processes PHI on behalf of a covered entity, Business Associate Agreements (BAAs) must be established with:

  • Cloud infrastructure providers (Azure, AWS, GCP)
  • Managed database services
  • Third-party AI/ML services (OpenAI, etc.)

The platform's configuration supports BAA-compliant deployment through dedicated infrastructure options and data residency controls.


GDPR Compliance Patterns

Data Subject Rights

MATIH provides built-in support for GDPR data subject rights through the privacy dashboard and consent management services:

RightGDPR ArticleImplementation
Right of accessArt. 15Data export endpoint, privacy dashboard
Right to rectificationArt. 16User profile update APIs
Right to erasureArt. 17Tenant data purge, user data deletion
Right to restrictionArt. 18Data processing flags, consent withdrawal
Right to portabilityArt. 20Data export in standard formats (JSON, CSV)
Right to objectArt. 21Processing opt-out mechanisms

Data Subject Request (DSR) Handling

Data Subject submits request
        |
        v
[Privacy Dashboard] -- Log DSR in audit trail
        |
        v
[Identity Verification] -- Verify requester identity
        |
        v
[DSR Processing] -- Execute the requested action
        |
        v
[Confirmation] -- Notify data subject of completion
        |
        v
[Audit Record] -- Record DSR completion for compliance

Consent Management

The consent management service tracks user consent for data processing activities:

{
  "userId": "user-123",
  "tenantId": "acme-corp",
  "consents": [
    {
      "purpose": "analytics",
      "granted": true,
      "grantedAt": "2026-01-15T10:00:00Z",
      "expiresAt": "2027-01-15T10:00:00Z",
      "version": "v2.1"
    },
    {
      "purpose": "marketing",
      "granted": false,
      "withdrawnAt": "2026-02-01T08:30:00Z"
    }
  ]
}

Data Classification

MATIH supports data classification tagging for GDPR compliance:

ClassificationDescriptionProcessing Rules
PERSONALPersonally identifiable information (PII)Subject to GDPR, consent required
SENSITIVESpecial categories (Art. 9)Explicit consent, additional safeguards
ANONYMIZEDIrreversibly anonymized dataNot subject to GDPR
PSEUDONYMIZEDPseudonymized dataStill subject to GDPR, reduced risk

Data Processing Records

The platform maintains records of processing activities as required by GDPR Article 30:

FieldDescription
Processing purposeWhy the data is processed
Data categoriesTypes of personal data involved
Data subjectsCategories of individuals
RecipientsWho receives the data
Transfer safeguardsProtections for cross-border transfers
Retention periodHow long data is kept
Security measuresTechnical and organizational measures

Compliance Monitoring Dashboard

The platform provides a compliance monitoring dashboard that aggregates security metrics:

MetricDescriptionAlert Threshold
Failed login attemptsPer user, per tenantMore than 5 in 10 minutes
Authorization denialsUnexpected access attemptsSpike above baseline
Secret rotations pendingKeys past rotation dateAny key past rotation date
MFA adoption ratePercentage of users with MFABelow 90% for production tenants
Audit log gapsMissing or delayed audit eventsAny gap longer than 5 minutes
Certificate expirationTLS certificates nearing expiryWithin 30 days of expiration
Data subject requestsPending DSR requestsAny request older than 30 days

Compliance Certifications Roadmap

CertificationStatusTarget
SOC 2 Type IControls designedQ2 2026
SOC 2 Type IIControls operatingQ4 2026
HIPAABAA-ready deploymentQ3 2026
GDPRPrivacy controls implementedCurrent
ISO 27001Planned2027
FedRAMPUnder evaluation2027

Next Steps

This concludes the Security and Multi-Tenancy chapter. Continue to Chapter 4: Installation and Setup to learn how to deploy the MATIH Platform in your environment.