Composite scenario, not a real company. Assembled from common industry patterns; every number is illustrative and its assumptions are listed at the end.
This case belongs to Diagramming AI systems.
Context
- A software vendor sells a multi-tenant B2B product. Each customer organisation is a tenant; its administrators contact support about configuration, billing and open tickets.
- A support assistant inside the product answers in plain language and looks up that tenant's tickets and settings through a few tools.
- One shared Document store holds the data, with a tenant identifier on every record. One shared Tool server exposes the lookup tools.
- The design comes to review as a container diagram only: no sequence diagrams, no trust boundaries.
Problem statement
The review asks: where does the tenant identity come from at each step, and who checks it? The container diagram cannot answer, so the reviewers ask for the runtime sequence of one tool call. Drawing it takes ten minutes and shows the problem.
Figure 1. Runtime sequence as first designed (flawed)
How to read this: time runs downward, and the two notes mark where tenant identity is decided and where it is not checked.
The tenant identifier is an argument the model writes, and anything in its context can influence it: the administrator's message, an earlier ticket, a pasted log. The Tool server trusts the argument and can read every tenant. The missing item is a trust boundary between the Orchestrator and the Tool server, with a control on it.
Goal: a tool call reads only the logged-in tenant's data, whatever the model writes, and the review can point to the control that guarantees it.
Constraints
- One shared Tool server and one shared Document store; separate stacks per tenant are out of budget.
- Answers stay interactive, so any added control has a small latency budget.
- Administrators may paste arbitrary text, including logs and emails.
- Audit: every tool call is attributable to a tenant and a user.
- The model provider receives no credentials.
Why the traditional approach fell short
| Approach | Where it fell short |
|---|---|
| Help centre search plus a ticket form | Public articles cannot answer "why was my invoice higher this month?": the answer is in the tenant's own data |
| Rules engine mapping fixed questions to fixed lookups | Administrators phrase questions in open-ended ways and the rule set never ends |
| Manual handling | Correct and slow |
Options considered
| Option | Idea | Why accepted or rejected |
|---|---|---|
| A. Validate in the Orchestrator | Keep the design, add a check that the tenant id in the tool request equals the session's tenant | Rejected as the only control: one check in one place, the Tool server can still read every tenant, and a new tool may skip it |
| B. Tenant-scoped credential, enforced below the model | The tool schema has no tenant parameter. The gateway sets the tenant; the Policy engine returns a short-lived credential scoped to it. The Tool server and Document store enforce it | Accepted: the model cannot widen access, and two layers must both fail for a leak |
| C. No tenant-data tools (non-AI) | The assistant answers only from public documentation and offers a ticket form | Kept as the fallback for tenants that decline tool access, and the simplest option for rare lookups |
The default is B: authority must never live in a value the model writes. Option C is not a failure; for a small feature set it is cheaper and safer.
Solution architecture
Figure 2. Container view with trust boundaries
How to read this: zones are shaded boxes, arrows whose label starts B1 to B5 cross a trust boundary and name the control applied there, the other solid arrows stay inside a zone, and the dashed arrow is asynchronous.
Figure 3. Runtime sequence of the corrected tool call
How to read this: the alt block has an allowed path and a denied path, and in both the Orchestrator ends by publishing an audit event.
How AI solved it, step by step
Step through one request, then compare "Without the fix".
Every decision in the corrected path is made by code the model cannot influence: the gateway (who), the Policy engine (may they), the Tool server and store (enforce).
Under the hood
A model's output is shaped by every token in its context, including text the team did not write: the user's message, retrieved documents, tool results. A tool argument is part of that output. So any value that grants authority (tenant id, user id, file path root) is attacker-influenced if the model can set it.
| Layer | Control |
|---|---|
| Schema | Remove the parameter: no tool takes a tenant argument |
| Identity | Supply the value from a verified channel: the gateway sets tenant and user |
| Enforcement | Enforce it again where the data is read: the Tool server and the Document store |
The trust-boundary section of Diagramming AI systems shows how to mark these crossings; the course's security lesson will cover the attack chains.
What went wrong / failure modes
| Failure | Mitigation |
|---|---|
| A new tool is added later with a tenant parameter | Tool schema review is on the design checklist, and the Tool server rejects calls without a credential whatever the arguments say |
| A cache is keyed by ticket reference only, so one tenant's record could be served to another | Every cache key includes the tenant; the review asks of each store, "what is its key?" |
| The credential is longer-lived than the request | A short lifetime and a scope of one tenant and one tool |
| Audit gaps if the Event bus is down | The Orchestrator buffers events locally and retries; a tool call whose audit event cannot be buffered is refused |
| Policy engine unavailable | Fail closed and tell the user the lookup is unavailable |
Results
These are illustrative targets, not measurements.
| Measure | Target |
|---|---|
| Cross-tenant reads in a pre-release adversarial set of 300 prompts (pasted text naming another tenant, requests to "ignore the account", ticket text containing an instruction) | Zero |
| Added latency from the Policy engine call | 30 ms at the median |
| Audit coverage | 100% of tool calls produce an audit event carrying tenant, user and tool |
| What-if sizing: a 0.1% wrong-tenant error rate | 10 wrong-tenant reads a day across 10,000 daily tool calls (25,000 requests x 40%) |
Qualitative outcome: the missing boundary was found before any tenant data was exposed, because a sequence diagram was drawn.
Tradeoffs and when NOT to use this approach
- Option B adds a Policy engine call and credential handling to every tool call. For a read-only assistant over public data it is not worth it.
- A shared Tool server remains a concentration of access. Contractual isolation requirements may need separate stacks, and no in-process check replaces that.
- This is not a fix for prompt injection. It limits what an injected instruction can reach; it does not stop the model from being steered.
Design rules extracted
- Authority never lives in a value the model writes: tenant, user and permission come from a verified channel.
- Draw the runtime sequence of one tool call before approving a design; the container diagram alone hides where identity is decided.
- Enforce at two layers, the tool tier and the data tier, so that one missed check is not a leak.
- Keys of caches, indexes and logs include the tenant.
- When the policy check or the audit path is down, fail closed.
Assumptions
- 400 tenants, 25,000 assistant requests per day, and 40% of requests call a tool, which gives 25,000 x 0.40 = 10,000 tool calls per day.
- A what-if used in the review: an error rate of 0.1% on 10,000 daily tool calls would be 10 wrong-tenant reads per day. The 0.1% is a what-if, not an observed rate.
- The adversarial test set of 300 prompts, the 60-second credential lifetime and the 30 ms latency target are chosen for illustration.
- The vendor, product and tenant ids (such as t-17) are invented.
Last verified: 2026-10-21