The interview problem

Practice prompt

A document service has 200,000 active principals, 400 serving gateways and 20,000 concurrent download streams. An administrator must revoke 50,000 selected principals in one tenant within ten seconds, including when a region loses connectivity to the control plane. Design the revocation API, propagation mechanism and enforcement behavior. Explain what the deadline means for active streams and cached content.

Original system-design practice, not a reported company interview. Numbers and protocol are hypothetical. Primary authorization references retrieved September 27, 2026.

Quick answer

Bounded revocation requires every data-release path to stop accepting old authority within the promised window. Cache eviction alone is insufficient when a stale upstream service can issue fresh-looking permissions. Define a trusted policy revision or authority expiry, and check it at the last enforceable release boundary.

1. Define what must stop

Choose an emergency tenant-scoped deny: each selected principal must lose every protected access path in this tenant, even if another group still grants access. Removing one membership has different semantics and might leave direct or inherited grants intact. Scope the administrator's authority and validate the submitted principal identities before changing anything.

Let t0 be the atomic durable commit of the deny operation in the authoritative control store. By t0 + 10 seconds, controlled gateways must stop releasing new protected bytes for the selected principals. Measure release at the final controlled output boundary. This does not recall downloaded files, screenshots or bytes already sent beyond that boundary. A promise merely to reject requests that start after the deadline would allow an old stream to continue indefinitely.

Separate upload and validation of a large target list from the commit. Return a preparation identifier while validation is pending, then a committed operation identifier and timestamp. Bound and monitor preparation latency separately; do not hide it by advertising the ten-second enforcement target as end-to-end administrator latency.

2. Put a short authority lease at the serving boundary

authorized administrator → prepare immutable deny set
                                      ↓
                atomic commit: tenant epoch + set reference + outbox
                                      ↓
             regional distributors → gateways install complete snapshot
                                      ↑
                    serialized authority-lease issuer
                                      ↓
request → ordinary document permission → live lease + emergency deny → output

The control store retains the tenant epoch, immutable deny-set reference and operation ID. Persist the complete immutable set durably before publishing its reference; gateways unable to fetch it must fail closed rather than use a partial substitute. New revocations merge with the existing deny set, rather than replacing it with only the latest targets. Commit the new reference, epoch and durable event together. A regional distributor copies snapshots or validated deltas to gateways. The epoch and complete set become visible atomically; a half-installed set must never authorize traffic.

The lease issuer serializes issuance against revocation commits. It may use a linearizable transaction or an equivalent proven protocol, but it cannot renew an old epoch from a stale regional replica. A lease binds tenant, epoch, deny-set digest, gateway identity and expiry. A gateway must possess the matching validated set before using that lease. Authentication and integrity protection prevent a client from inventing or altering leases.

Push invalidation improves the usual case. Short lease expiry supplies the fallback when events are lost or a region is isolated. After expiry, affected protected traffic fails closed until the gateway obtains current policy and authority. Unaffected tenants can continue under their own valid leases. Within the affected tenant, a disconnected gateway may temporarily deny even principals who were not selected; disclose this availability cost rather than claiming perfectly selective service during a partition.

3. Prevent a delayed renewal from extending stale authority

Suppose an issuer reads epoch 17, a revocation commits epoch 18, and the issuer then signs an epoch-17 lease with a fresh six-second lifetime. A linearizable read alone did not serialize the whole issuance operation. The design must bind expiry to the serialized issuance point, or revalidate the epoch in the transaction that records issuance. Signing and network delivery afterward cannot reset that expiry.

Likewise, a gateway cannot start a six-second timer when a delayed response arrives. The response might have been in transit for a minute. Validate absolute expiry with a justified clock-error bound and convert conservatively to a local deadline, or use a protocol that conservatively accounts for issuance age. This exercise assumes such a bound exists. If clocks or pause behavior violate it, the claimed deadline is unproven.

Restarting a gateway does not renew a persisted lease. Require fresh authority before serving after restart, and recheck deadlines on resume from a process pause. Use a time source whose suspend behavior is understood. A background expiry timer is insufficient: the output path itself must reject expired authority.

4. Work through the worst-case deadline

Assume every lease issued before t0 has at most six seconds of nominal remaining authority at t0. Allow 0.5 seconds for the combined expiry and clock uncertainty. Finally, suppose at most 0.2 seconds can pass from a successful final output check to releasing the corresponding bytes.

latest stale release − t0 ≤ L + ε + B
                         ≤ 6 + 0.5 + 0.2
                         = 6.7 seconds

This leaves 3.3 seconds of margin under the ten-second contract. These are engineering assumptions to implement and test, not guarantees inherited from a database or authorization library.

EventRequired behavior
Old lease issued just before t0Expiry remains tied to that issuance point.
Revocation commits; push event is lostOld lease may remain usable only until its bounded expiry.
Region cannot renewStop releasing protected output when authority expires.
Output check occurs immediately before expiryRelease only within the bounded final-check interval B.
Gateway pauses after checkingRecheck before release if the B deadline has passed.

A fixed 64 KiB chunk limits bytes in one approved chunk but does not bound scheduling delay. The final output component needs a deadline-aware check, and it must not queue approved chunks indefinitely. Define whether kernel or proxy buffering is inside the controlled boundary. If those components can emit later without another check, include their delay or move the boundary explicitly.

Do not add push delay to this bound when lease expiry already caps stale service. Conversely, do not take the maximum of several cache TTLs if stale upstream state can refresh a downstream cache: that can create a serial sum or an unbounded extension.

5. Close paths that bypass the gate

An ungated fifteen-minute signed download URL violates the ten-second contract even if application caches expire every six seconds. Route protected delivery through the gate, give the downstream delivery service equivalent enforcement, or change the stated guarantee. A CDN cache hit is still a protected response and must not skip the check.

Check each output chunk of a long stream and every resumed range request. Revalidate queued exports at delivery, not just enqueue time. Apply the same rule to thumbnails, search snippets, cached assistant responses and document previews. A service credential used by a worker does not replace the end-user authorization context.

The live lease proves freshness of this emergency deny policy only. It does not itself grant document access. Ordinary authorization must also succeed under its own consistency requirements. Bind caches to tenant, principal, action and resource context; never treat a valid tenant lease as permission to read every object.

6. Use authorization revisions without trusting the revoked client

AuthZed documents an at_least_as_fresh option that evaluates at or beyond a supplied revision token. Its exact-snapshot option has different semantics. A check's snapshot also cannot include mutations committed after that snapshot. Treat tokens as opaque and respect datastore-specific behavior.

These mechanisms can support ordinary permission checks, but handing the revocation token only to the administrator does not update every other request. A revoked client has no incentive to supply the newest token. The server must enforce the required freshness context or use the emergency gate described here. A revision token is not a broadcast invalidation system or an expiry lease.

Google's Zanzibar research provides context for causally consistent authorization across permission and content changes. The protocol and numerical deadline in this guide are an original exercise, not a claim about Google's production revocation behavior.

7. Size control traffic separately from content checks

400 gateways / 3-second renewal interval ≈ 133.33 renewals/second
50,000 principal IDs × 16 bytes = 800,000 raw bytes
800,000 bytes × 400 gateways = 320,000,000 raw fanout bytes
20,000 streams × 4 checks/second = 80,000 local checks/second

The lease calculation assumes one active lease per gateway for this affected tenant. With many active tenant-gateway pairs, count those pairs instead. Add protocol overhead, retries and capacity margin; jitter renewals to avoid synchronized bursts. A failed renewal grants no additional grace period.

The raw 320 MB fanout excludes set indexes, metadata, replicas and transport overhead. Use regional distribution and immutable snapshots to reduce repeated origin work. Deltas need a known base version, integrity checks and a full-snapshot recovery path. If a gateway cannot install the new set in time, expiry still stops stale service, but availability suffers.

Keep stream checks local against the installed set and lease. Four checks per second is an illustrative workload, not a universal consequence of chunk size; faster streams need more checks. At 64 KiB per chunk, each approved chunk contains 65,536 bytes. An aggregate exposure-byte estimate additionally requires throughput and concurrency bounds; the time calculation alone does not supply it.

8. Report completion honestly

Expose prepared, committed, propagation-observed, deadline-elapsed and verification states. A commit acknowledgment means the operation is durable. It does not mean every gateway has stopped. A partitioned gateway may never acknowledge installation; safety depends on its existing authority expiring, not on waiting forever for its acknowledgment.

Track every serving gateway and bootstrap path. New gateways cannot start with stale policy, and retired gateways must not continue serving through forgotten routes. Record lease issuance, epoch, expiry and policy-installation evidence. Canary principals can test actual denial across routes, but a few successful probes do not prove all delivery paths are covered.

Concurrent revoke operations merge under serialized state updates. Preserve deny provenance per operation or reason: if both operation A and operation B deny Alice, canceling A must leave B effective. The installed set is the union of active deny records, not a Boolean that any restoration can clear. An explicit restoration creates a newer audited version and removes only authorized deny entries; it must not restore unrelated permissions or erase another operation's deny. Client request IDs make retries idempotent. Define who can restore access and re-evaluate ordinary permissions before serving.

9. Test the proof, not just the happy path

  • Stale issuer: force a regional replica behind the commit and verify it cannot issue fresh old-epoch authority.
  • Delayed response: hold a renewal response past expiry; delivery must not restart its lifetime.
  • Pause and restart: suspend a process after its output check and restart one with persisted state; neither may resume stale release.
  • Lost or reordered events: expiry remains effective, and an older snapshot cannot replace a newer installed epoch.
  • Incomplete distribution: reject mismatched digest/version pairs and deny when installation fails.
  • Bypass routes: exercise direct object URLs, CDN hits, range requests, exports and cached snippets.
  • Overlapping operations: revoke two sets, retry both and restore only one authorized subset without resurrecting other denied users.

Measure commit-to-last-controlled-release, rejected expired leases, installation lag and unavailable requests by tenant. If the assumed clock or release-delay bounds cannot be enforced on the platform, change the architecture or weaken the contract explicitly. A percentile latency chart does not prove a worst-case deadline.

10. Trade-offs, follow-ups and self-review

A tenant epoch simplifies proof and invalidation but affects many cached decisions. Per-principal epochs reduce invalidation scope while increasing metadata and lookup cost. Longer leases improve partition availability but worsen emergency revocation delay. Online authoritative checks reduce cached staleness but still need precise treatment of checks racing with output and add a dependency on the control plane.

Follow-ups: What changes for one million principals? Can unrelated tenants share an issuer safely? How would you handle offline desktop clients? What if a regional administrator cannot reach the commit quorum? Which data can remain available during a control-plane outage? How would a malicious or compromised gateway change the trust model?

  • State emergency-deny semantics, tenant scope and t0 precisely.
  • Distinguish controlled release from completed receipt and already downloaded copies.
  • Serialize lease issuance with revocation and prevent delayed delivery from extending it.
  • Derive the bound with explicit clock and output assumptions.
  • Cover every serving path, including streams and direct URLs.
  • Explain partition, restart and incomplete-snapshot behavior.
  • Separate commit acknowledgment, propagation and verified enforcement.
  • Quantify capacity and disclose the availability trade-off.

Two cache TTLs do not imply the shorter bound

Suppose an authorization service caches allow decisions for 30 seconds and a gateway caches the service’s response for six seconds. A permission is revoked immediately after the service caches an allow. At t = 29 seconds, the gateway refreshes from that stale service and starts a new six-second local TTL. It may keep allowing until t = 35 seconds.

A claim of “revocation within six seconds” is therefore false. In the worst alignment, the two cache lifetimes can approach 36 seconds. A local refresh must not reset the lifetime of stale authority. Propagate an authority-issued expiry tied to the original decision, or require a revision/freshness guarantee from the authoritative policy service before extending access.

Include clock uncertainty and the final release step in the bound. If the authority cannot be reached, explicitly choose between failing closed and weakening the revocation guarantee; silently extending the lease does the latter. Already delivered bytes remain outside the revocation mechanism.

Original worked follow-up, reviewed October 7, 2026. Reference: SpiceDB: consistency.

Sources and attribution

Retrieved September 27, 2026. No interview date applies. The prompt, emergency-deny lease design, calculations and failure exercises are original practice material.

Continue your preparation

Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.