Secure Landing Page for a Multi-Tenant Cloud Dashboard
System DesignModel answerLast updated
Design the post-login home screen of a multi-tenant cloud dashboard, covering authentication, scoped permissions, tenant isolation, tamper-resistant audit logging, and low-latency scaling.
Problem
You are designing the first screen a user lands on after signing in to a cloud platform's web dashboard, similar to the landing view of a major public cloud provider. Security is the main concern: how users prove identity, what they are allowed to see, and how sensitive activity is recorded.
Functional requirements
- The landing page is personalized and shows:
- The projects, accounts, or tenants the user can access.
- A summary of key resources (virtual machines, databases, storage buckets) that the user is permitted to view.
- Optionally, recent activity and notifications.
- Tenant isolation is strict. A user must never see data from a tenant they have no access to.
- Permissions support at least role-based access control (for example Owner, Admin, Viewer). Ideally roles can also be scoped to a single project or resource.
- Security-relevant events produce audit records, at minimum:
- Sign-in, sign-out, and token issuance or refresh.
- Views of sensitive pages or listings (you must state your own policy on this).
- Role and permission changes.
- Create, update, and delete actions started from the dashboard.
Non-functional requirements
- Home page p95 latency roughly 500-1000 ms.
- Availability of 99.9% or better.
- Secure by default: least privilege and robust session handling.
- Audit records are tamper-resistant and searchable by security and compliance staff.
What to deliver
- The end-to-end flow from sign-in to a rendered home page.
- The main services and their APIs.
- Where and how permission checks are enforced.
- The audit pipeline: what is recorded, where it flows, and how it is protected.
- Key data models and scaling considerations.
State your scale assumptions up front.
Hints
Hint 1
Start by stating scale numbers and an explicit policy on which reads are audited. Logging every list call at full fidelity is costly, so decide what counts as sensitive.
Hint 2
Avoid running a permission check per resource. Think about an operation that returns the set of scopes a user can read, then query an inventory index filtered by those scopes.
Hint 3
Enforce authorization in several layers (edge, each service, and the data layer), and keep tenant IDs derived from authorized scopes rather than taken from the client.
Hint 4
For audit integrity, think about guaranteeing that a mutation cannot happen without its record (outbox), plus append-only storage, hash chaining, and separate access control for the log.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Framing
The home page is a read-heavy aggregation problem. The real test is whether identity, authorization, and audit are built into the structure of the design rather than bolted on. Push enforcement down to the data layer and treat the audit log as a security product in its own right.
1. Requirements and assumptions
- 10M registered users, 1M daily active. Peak about 2K logins/s and 5K home loads/s.
- Users belong to 1-50 tenants. A large tenant may have 10K projects and 1M resources.
- Audit volume: up to about 50K events/s at peak, a few TB/day raw.
- Latency: p95 under 800 ms for first meaningful render. Non-critical widgets load progressively.
- Audit stance: always log reads of sensitive data (secrets, keys, IAM policies, billing). Routine home-page list calls are sampled or aggregated per session to control cost. Tenants can opt in to full read logging.
2. End-to-end flow
- Sign-in. The browser is redirected to an identity provider using OIDC Authorization Code with PKCE. The IdP handles passwords, MFA, federation to corporate IdPs, and conditional access. It emits
auth.login.successorauth.login.failure. - Session. A Backend-for-Frontend (BFF) exchanges the code for tokens and keeps them server-side. The browser gets only an opaque cookie (
HttpOnly; Secure; SameSite=Lax). Access tokens are short-lived (5-15 min). Refresh tokens rotate on every use, and reuse of an old one revokes the entire token family. Events:token.issued,token.refreshed. - Home request.
GET /api/homehits the BFF, which validates the session and fans out in parallel to the tenant/project service, the resource summary service, and the activity service. - Render. Each widget has its own timeout (about 300 ms). Slow ones return placeholders and finish client-side, so one slow dependency never blocks the page. The response flags missing parts, for example
"partial": ["notifications"].
3. Components and APIs
| Component | Role | Key APIs |
|---|---|---|
| Identity provider | Authentication, MFA, federation, tokens | authorize, token, revoke, JWKS |
| Console BFF | Session, aggregation, CSRF, rate limiting | GET /api/home |
| Authorization service | Policy decisions | Check(principal, action, resource), ListAccessible(principal, action, type) |
| Tenant/project service | Hierarchy and membership | GET /tenants, GET /tenants/{id}/projects |
| Resource inventory | Denormalized, indexed resource view | GET /resources/summary?scopes=... |
| Audit service | Ingest, store, query | internal POST /audit/events, GET /audit/query |
4. Authorization
Model. Hierarchical RBAC: tenant, folder, project, resource. A role is a bundle of permissions such as compute.vm.read. An assignment is (principal, role, scope) and is inherited downward. Deny rules and attribute conditions (for example tags) are optional extensions. Storing assignments as relationship tuples (Zanzibar-style) makes both "can X do Y?" and "what can X see?" efficient.
Enforcement in layers.
- Gateway/BFF: verify token signature, audience, and expiry. No authorization beyond "authenticated."
- Each backend service: call
Checkor useListAccessibleoutput before returning data. Never trust a client-supplied tenant ID. - Data layer: every query is keyed by a
tenant_idderived from the authorized scope set, backed by row-level security or per-tenant partitions so a query bug cannot cross tenants.
Efficient listing. Never call Check on 1M resources. Instead:
ListAccessible(user, read)returns a compact set of scopes (a handful of project IDs).- Query the inventory with
scope_id IN (...). - Resource-level grants are rare, so do a small second lookup and merge.
Caching. Cache the permitted-scope set per principal for 30-60 s. Invalidate on a role.assignment.changed event. Use a consistency token so a just-granted user sees access immediately. Revocation must win: short TTLs, push invalidation, and a revocation list for disabled users.
5. Data models
Principal(id, type, home_tenant, status)
Tenant(id, name, parent_id) Project(id, tenant_id, folder_id)
RoleDefinition(id, name, permissions[])
RoleAssignment(id, principal_id, role_id, scope_type, scope_id, created_by, created_at)
Resource(id, tenant_id, scope_id, type, region, status, tags)
Session(id, principal_id, refresh_family_id, ip, ua, expires_at)
AuditEvent(event_id, ts, tenant_id, actor, action, target, decision, result,
request_id, before_hash, after_hash, prev_hash, sig)
6. Audit pipeline
What to log: auth events (including failures), role and policy changes with before/after state, control-plane mutations, sensitive reads, and authorization denials (high signal for attack detection).
Pipeline.
- Emit from a shared library. Mutations use a transactional outbox, so the audit record commits in the same transaction as the change and no mutation exists without a record. Reads use async emission.
- Transport through a durable log (Kafka or similar), partitioned by
tenant_id, replication factor 3,acks=all. - Store in append-only, immutable storage (object storage with write-once retention) plus a searchable index for recent data. Hash-chain records (
prev_hash) and periodically sign and anchor the chain head in a separate trust domain, so tampering is detectable. - Secure. Writers have append-only permission. Readers are separate roles. Even tenant admins cannot delete. Encrypt with per-tenant keys, and redact secrets from payloads (log that a secret was read, never its value).
- Query via a restricted API with its own authorization, and stream to the customer's SIEM.
7. Scaling and availability
- Stateless BFF behind a load balancer, multi-AZ, with session state in a replicated store.
- Inventory is an eventually consistent, denormalized index fed by change events. Pre-aggregate per-scope counts so the home page reads small summaries.
- Per-widget timeouts, circuit breakers, and graceful degradation. Auth failing closed is correct, but notifications failing open to a placeholder is fine.
- Audit ingestion is decoupled with buffering, so an audit backlog never slows the page. For mutations, fail the action if the outbox write fails.
Trade-offs and common mistakes
- Doing permission checks per resource instead of listing accessible scopes.
- Storing tokens in browser local storage rather than server-side with an opaque cookie.
- Enforcing authorization only in the UI or gateway.
- Long permission cache TTLs with no invalidation, so revoked users keep access.
- Auditing every read (cost explosion) or none (compliance gap) without a stated policy.
- Logging secret values, or letting audit admins edit the log.