KatInterview

Secure Shared Analytics Service for Many Enterprise Customers

System DesignModel answer
MediumModel answerSystem Designmulti-tenancyabacaudit-logging

Last updated

Design a shared analytics service where enterprise customers run SQL on their own datasets with strict isolation, attribute-based access rules, tamper-evident auditing and erasure support.

Scenario

You are building a hosted analytics service for enterprise customers, referred to as tenants. Users from each tenant upload datasets, run analytical SQL against them and build charts and dashboards on top of the results. The business is regulated, so a tenant must never be able to read, or even detect the existence of, another tenant's data.

What the platform must do

  1. Isolation. Separate tenants so that data leakage across them cannot happen, whether the separation is physical or logical.
  2. Fine-grained access. Use attribute-based access control (ABAC) to limit which rows and columns a user may see. Decisions depend on user attributes such as role, and on sensitivity tags attached to data, such as PII or GDPR-restricted.
  3. Auditing. Record every query, data access and configuration change in a tamper-proof trail that supports forensic investigation.
  4. Scale. Serve thousands of concurrent users spread over hundreds of tenants, with workloads ranging from quick dashboard lookups to heavy joins.

Constraints

  • Total data volume is at petabyte scale.
  • Audit records are kept for 7 years and must be searchable within seconds.
  • "Right to be Forgotten" requests must be honored by removing a person's data from every storage layer.

What to cover

  • The overall architecture and the storage approach (shared versus siloed).
  • The design of the authorization layer that enforces ABAC on queries.
  • How data lineage is captured and used.
  • How you guarantee the integrity of audit logs.
  • How unauthorized access attempts are detected and how the system recovers from them.

State your assumptions about scale, justify trade-offs, and point out where the requirements pull against each other (for example, erasure versus immutable logs).

Hints

Hint 1

Rank your priorities first: a leak is worse than a slow query, which argues for fail-closed behavior and for isolation enforced in more than one layer.

Hint 2

Consider separating storage from compute: siloed storage with per-tenant keys and credentials, and pooled or dedicated compute depending on tenant size. Ask what still protects data if the SQL rewriter has a bug.

Hint 3

Place a policy enforcement point in front of the engine that rewrites the logical plan (masks, row predicates) and signs it. Capture lineage from that same plan.

Hint 4

Make audit logs tamper-evident with hash chains, signed checkpoints and write-once storage. Then work out how erasure can coexist with immutability, for example through crypto-shredding and by keeping subject identifiers out of the logs.