KatInterview

Keeping Tenants Apart in a Shared-Index LLM Assistant

System DesignModel answer
HardModel answerSystem Designmulti-tenancyragauthorization

Last updated

Design authorization boundaries so a multi-tenant document Q&A agent cannot leak data across tenants or sessions, or be steered by injected instructions in uploaded files.

You are building a hosted assistant where many customers upload documents and then ask questions about them. The service chunks and embeds the files into a shared vector cluster, retrieves relevant chunks at question time, feeds them to an LLM, and can optionally call external tools (for example search, email, ticketing or calendar APIs).

Design the trust boundaries that stop one tenant, user or session from seeing another's data, and that stop text hidden inside an uploaded file from taking control of the agent.

Assumptions

  • Sharing a vector cluster must not mean sharing access to every vector.
  • Arguments produced by the model, and the contents of uploaded documents, are untrusted when making authorization decisions.
  • No prompt-injection or content classifier is assumed to be perfect.
  • You must also account for sensitive-data exposure, jailbreak attempts and abusive request rates.

Questions you may want to raise first

  • Is access scoped by tenant, user, session, document, or a combination?
  • Which tools change external state, and which need explicit user confirmation?
  • Can collaborators share a session? How are revocation and document expiry propagated?
  • What may enter prompts, provider logs, result caches and telemetry?

Part 1 - Data isolation. Follow identity and permissions through upload, indexing, retrieval, context assembly and answer delivery. Explain how caches and asynchronous jobs keep the same boundary.

Part 2 - Guardrail placement. Assign responsibilities to the gateway, orchestrator, retrieval service, model-side checks and a tool broker. Explain how a malicious instruction inside a retrieved document is prevented from authorizing an unrelated action.

Expect a structured answer with trade-offs, failure modes and common mistakes.

Hints

Hint 1

Where does the identity used for a retrieval filter come from? It must never come from the prompt, the model, or the request body fields the client controls.

Hint 2

Think of each layer as having a different failure mode: gateway (who are you, how much), retrieval (which data), model (what looks suspicious), tool broker (what may be done). No layer should be the only defense.

Hint 3

A retrieved document is data, not a principal. Ask what would have to be true for a tool call to be allowed if the document text were deleted from the context.

Hint 4

Cache keys, embeddings of queries, object-store URLs, background re-index jobs and logs are all places where the tenant tag quietly gets lost.