Skip to content
About
Main content

Scenarios

Longer problems, like those in senior system design interviews. A strong answer estimates with numbers first, names the mechanism, then recommends a fix and says what it costs.

Try each one before you open the answer.
1A finance lead wants the Northern finance team to see only Northern rows of a 40 TB table. Design it.Show the answer

Design

One table, with a row filter on a partition key (region), so pruning still works: a 40 TB scan falls to about 2 TB.

Enforce at the narrowest waist

Remove direct storage and have the catalog vend 15-minute credentials scoped to the query. Do not rely on a view alone.

Name the adversary

An authorized analyst who wants other regions' data, so also consider inference by subtraction, and exports.

Trade-offs

Availability now depends on the credential vendor, and the optimizer loses some freedom in planning.

Read moreRow- and column-level securityViews as security boundariesCredential vending

2A pipeline's token was pasted into a support ticket and used from outside the company six weeks later. Diagnose and fix.Show the answer

Diagnose

The token was a long-lived bearer secret, not bound to any audience.

Fix

attested by the scheduler, 15-minute tokens restricted to their intended audience, one per pipeline, and the requesting person recorded in the job's metadata.

What remains

A token can still be replayed within its lifetime. The number of live tokens is , so short lifetimes put the token issuer on the hot path.

Read moreAuthenticationDelegation chains

3The access-control system has 2,400 roles. What do you do?Show the answer

Check the structure

9 regions × 6 departments × 5 data classes × 2 purposes is 540 combinations: a sign of .

Redesign

Keep about 25 coarse roles, and move fine-grained access to attributes, with policy written as code.

The price

"Who can read X?" becomes a query that has to evaluate the policy.

Prevent drift

Grants that expire, and quarterly re-attestation, because controls drift towards permissive.

Read moreAuthorization modelsPolicy as codeGrants and privilege inheritance

4An auditor demands column encryption of national_id, and now analysts complain of 40-minute queries. Recommend a design.Show the answer

Explain

destroys statistics and pruning on that column: reading 2 TB instead of 40 GB, 50 times more.

Design

with a per file, and a key-service policy controlling who may . Avoid filtering on the encrypted column: join on a surrogate key instead.

Avoid unless you accept the leak

Deterministic or , which leak value frequencies or ordering.

Name the adversary

For every row of the threat table: whether a platform operator or a stolen backup is what this protects against.

Read moreThe price lands on the storage layersEncryption that preserves structureEnvelope encryption

5Design the erasure of one patient's data across a data lake and its backups, for 2.1 million patients.Show the answer

Design

A data key per patient, and : deleting one key turns every copy of that patient's data into noise, in constant time.

The prices

  • 2.1 million keys to manage.
  • Lost compression across blocks, since each patient's data is encrypted separately.
  • The key store must be extremely durable: losing it destroys data, yet backing up keys makes shredding unprovable.
  • Uncertain legal standing: treat it as strong , and confirm with the privacy officer.

Read moreCrypto-shredding

6A vendor demo needs realistic phone numbers. Choose between hashing, tokenization and static masking.Show the answer

Hashing

Fails: the space of phone numbers is small enough to enumerate.

Tokenization

A token from a vault cannot be reversed without the vault, and lookups can be rate-limited, but it is still a stable pseudonym, and so personal data.

Static masking

Gives a safe copy for non-production use, but the job must keep up with schema changes.

Recommend

Tokenization or ; if you use tokens, document the demo data as personal data.

Read moreHashing and salting identifiersMaskingTokenization and pseudonymization

7A hospital wants to give universities both a research extract and a patient-level dataset. Design the release policy.Show the answer

Reject k-anonymity as the main defence

It does not compose across releases (combining two extracts can re-identify people), groups are often homogeneous in diagnosis, and it collapses in high dimensions.

Aggregates

Serve them through a query interface with and an ε ledger per dataset per quarter: for example 1.0 in total at 0.1 per query gives 10 queries, then deny. Large counts cost almost nothing in accuracy.

Rare-disease studies

, so run those in a supervised environment on real data, under a data-use agreement, releasing only reviewed outputs.

Details and failure modes

Clamp sums, and protect at the level of users, not events. Analysts lose small slices. There is no principled way to set ε, and correlated records, such as families, weaken the guarantee.

Read moreFour ways k-anonymity failsThe budget is finiteHonest limits of DP

8A patient sends an erasure request. Walk through what you do, and what you cannot promise.Show the answer

Find everything

Build the list from the lineage graph: raw and derived tables, aggregates, caches, replicas, snapshots, backups (deleted when restored), exported files (found only by asking, since lineage does not see them), reverse-ETL targets, logs and models.

Delete

With delete vectors or file rewrites plus compaction, or by crypto-shredding where keys are per person.

Put in writing what is not guaranteed

Aggregates published before and after the deletion leak the difference; models need retraining, since removing one person's influence from a trained model is unsolved; backups rely on a procedure. Coverage is only as good as lineage coverage.

Ask

Whether that data should have been collected at all.

Read moreRight to be forgottenData minimization

9A partner wants to count how many of its customers are also your patients. Which design do you choose?Show the answer

The limit of private computation

or keeps each side's inputs private, but the output can identify people: an intersection of size one, or a partner probing with a one-person list.

Add

Differential privacy on the output, minimum aggregation thresholds, limits on the shape of queries, and rate limits on similar queries.

Honest cost

Multi-party computation costs orders of magnitude more compute and many rounds of messages, so offer a fixed function. Noise hurts exactly the small, targeted counts the partner wants.

Recommend

Multi-party computation plus differential privacy, with a contract as a backstop.

Read moreMulti-party computation and clean rooms

10A post-incident review finds that an authorized contractor copied 2.3 million rows to a USB drive, and nobody noticed for 11 weeks. What do you change?Show the answer

Recognize the limit

Access control cannot help: the read was authorized.

Change

Derive accounts from HR records, with expiry (for example 90 days without re-attestation); require two-person approval for exports above a size, say 10,000 rows; block removable media; put a perimeter around the data plane; and detect unusual export volumes.

Detection

Write the audit log to a store the team cannot edit, hash-chained, and set a time-to-detect target, say under 24 hours, tested monthly.

Trade-off

Friction on exports pushes people towards workarounds, so measure it: friction displaces risk rather than removing it.

Read moreThe identity gapsEgress and exfiltrationDetection and accountability

11Two departments ran the same dashboard query, and one of them saw the other's rows. Diagnose and fix.Show the answer

Diagnose

The result cache was keyed on the query text alone.

Fix

Include the user's roles and the policy version in the cache key. Treat everything shared between tenants as a possible channel: timing, error messages that reveal whether something exists, shared statistics. Add a test that deliberately attempts the forbidden read.

Also

Weigh the ladder of isolation (shared process, separate cluster, separate account) by cost against utilization, and state the decision cache's lifetime, say 5 minutes, as the revocation SLA.

Read moreMulti-tenancy as a confidentiality boundaryThe identity gaps

12The board asks: 'Are we secure?' How do you answer?Show the answer

Not with

"We are encrypted and use role-based access."

With a table per adversary

External attacker, malicious insider, careless insider, platform operator, authorized analyst: which controls stop each and which do not, the time to detect, and the position you chose.

State the residual risks

Backups against erasure and , third-party code in pipelines, copies held by partners, models that cannot forget, and phishing. Give friction an owner.

The frame

Security is a rate, how fast you detect and revoke, not a state.

Read moreName the adversary firstOutside the three surfaces

13A platform has 80 internal services and a compliance team. Where do you terminate TLS?Show the answer

Options

  • At the edge only: simple, one certificate, but plaintext inside, so the internal network is the trust boundary, a compliance risk.
  • End to end with mutual TLS: encrypted everywhere, with a cryptographic identity for each service. The cost is issuing, rotating and revoking certificates for 80 workloads, and CPU at every service.
  • Re-encrypt at the load balancer: routing plus encryption, at the cost of a decrypt-and-encrypt cycle at that hop and no zero-copy there.

Recommend

End-to-end mutual with short-lived certificates issued automatically (SPIFFE/SPIRE or a service mesh), long-lived pooled connections so handshakes are rare, and an alert on time to certificate expiry, since expiry, not compromise, is the likely outage. If brokers serve large stored volumes, evaluate kernel TLS or offload to the network card.

Read moreTLS termination and mutual TLSmTLS gives you identity