A support assistant answers a question accurately and still leaks data if the answer came from another customer’s documents. Retrieval quality and authorization are separate properties. A high similarity score says a passage is relevant; it says nothing about whether the current user may read it.

Review the full path from ingestion to the final answer. The same document can be protected correctly in its source system and exposed later through a vector index, cache, citation endpoint, or exported transcript.

Establish the caller’s scope before retrieval

Derive the tenant, user, and task from authenticated application state. Do not let a model choose its scope by providing a tenantId in a tool call. Validate document IDs and query options as untrusted arguments within the scope already established.

Tenant membership may not be enough. A company can have separate HR, finance, and support permissions. Preserve the relevant document-level rules rather than treating every employee of one tenant as equivalent.

If a background job performs retrieval, carry a verified task identity and recheck whether its access remains valid. A saved prompt containing yesterday’s permissions is not an authorization record.

Enforce scope before results reach the model

Apply authorization constraints to the retrieval operation. Filtering an answer after the model has already received unauthorized passages is too late to claim those passages were never disclosed to the model or its provider.

Stage Check to establish
Ingestion Source owner, tenant, and permission metadata are trusted
Index query Current caller’s allowed scope constrains the search
Document fetch The original record still exists and remains authorized
Answer and citation Every returned excerpt and link respects the same scope

A shared index can be appropriate when its filtering guarantees meet your requirements. Separate indexes can reduce some mistakes but do not replace authorization: the application can still select the wrong index or use a broadly privileged credential.

Keep permission changes attached to documents

Define what happens when a document is deleted, moved, or made private. Index updates may lag behind the source system. Recheck source authorization before returning sensitive material where that lag would be unacceptable.

Document chunks need enough trusted metadata to trace them to the source and its current rules. Do not ask the model to infer ownership from filenames or content. A document can mention another tenant without belonging to it.

Test revocation during long tasks. If an agent retrieved a document before access was revoked, preventing the next read does not erase text already in its context. Decide whether to cancel the task and discard its working context, and document that limit.

Treat caches and citations as data access

A cache keyed only by query text can return one tenant’s answer to another. Include the relevant authorization scope and revision in the cache design, or avoid sharing cached sensitive responses. An invalidation policy must cover permission changes as well as document updates.

Citation links should pass through the same access checks as normal document viewing. Guess-resistant IDs are useful but do not establish permission. A public file URL embedded in an otherwise protected answer can bypass the intended control.

Also inspect logs and conversation exports. Even correct retrieval may create an unauthorized copy if its passages are recorded in a place with broader readership. The audit logging guide explains how to preserve evidence without collecting unnecessary text.

Test a pair of tenants, not just one

Create synthetic tenants with documents that use similar titles and overlapping IDs. Verify that the same query returns only the permitted tenant’s material. Then try a known document ID from the other tenant, a revoked task, and a document whose permissions changed after indexing.

Inspect the passages sent to the model, not only the final answer. Check cache hits, citation downloads, and denied-read logs separately. For unauthorized or nonexistent documents, avoid error details that reveal whether another tenant owns a matching record.

A passing test should establish where scope is enforced and which data actually crossed the boundary. Keep that evidence with the agent’s test plan so a future indexing or caching change cannot quietly weaken it.