Quiz: Multi-Tenancy & Delegation¶
Review first: Multi-Tenancy & Delegation
Question 1
A multi-tenant API reads the tenant from an X-Tenant-ID header set by the frontend and filters queries by it. What's the right fix? Select ALL that apply:
Question 2
Service A receives a user's access token (audience api-a, scopes orders:read orders:write payments:refund) and needs to call service B to read the user's orders. What's the recommended approach?
Question 3
With PostgreSQL row-level security, each request runs SET app.tenant_id = '<tenant>' on a pooled connection, outside any transaction. Occasionally a request sees another tenant's data. Why?
Question 4
You enabled row-level security on invoices, but tests show the application still reads every tenant's rows. Which could explain it? Select ALL that apply:
Question 5
A nightly worker generates invoice exports from a queue. Since you enabled row-level security, the exports are either empty or contain every tenant's data. What's the root cause?
Question 6
Support wants a "log in as user" feature to debug customer issues. Which controls should it have? Select ALL that apply: