01

A correct answer can still disclose restricted data

Suppose a sales employee asks an internal assistant why a customer received a discount. The answer cites a document in a restricted finance folder. The employee cannot open that document, but the assistant has already disclosed its contents.

Retrieval augmented generation, or RAG, brings selected documents into a model’s context so it can answer a question. That gives users another way to access information. The retrieval path must enforce source permissions for the current caller before text reaches the model, including after those permissions change.

02

Follow the document through the system

A source file may become hundreds of searchable chunks. Those chunks can appear in retrieval results, reranking requests, prompts, citations, logs, and cached answers. A permission check on the final citation leaves earlier stages exposed.

Every chunk needs a stable source identifier and the relevant access metadata. The index should record which source version and permission version it holds. When a document moves between folders, establish whether its permissions are inherited or explicitly assigned. If the connector drops that distinction, later components cannot reliably determine who may read the copied text.

The application should authenticate the user and resolve their current identity and group membership through trusted services. A name or role supplied in the question has no authority. Tenant boundaries also need explicit enforcement, including for users who belong to several organizations.

A newly ingested file with an unresolved owner should stay unavailable until the connector can establish who may read it. The team needs an explicit policy for missing access metadata. If the connector has not resolved a document’s permissions, treating its empty access list as public can expose the document to unauthorized users.

Derived content needs the same attention. Suppose the ingestion process produces a summary from three files. That summary can disclose information from all three, even if its own storage location is broadly accessible. Before adding summaries to the search index, the team needs to decide how to protect them. Either preserve enough source lineage to authorize every contributing document or keep the summary within a conservatively restricted set of permissions.

03

Enforce access before building the prompt

Restrict retrieval to documents the caller may read, then pass only authorized content to the model. Apply the same rule to keyword search, vector search, and any secondary retrieval the assistant performs. Microsoft’s document access guidance describes both indexed permission metadata and query filtering; application-managed filters depend on the application supplying trustworthy identity information. 1

A system prompt asking the model to respect confidentiality cannot replace those checks. The retrieval service makes the access decision and passes only the permitted material to the model.

If the authorization service is unavailable, returning an answer from unrestricted search would turn the outage into an access bypass. A safer response explains that the requested information cannot currently be retrieved and leaves the restricted content outside the prompt.

Filtering after a broad retrieval also creates a relevance problem. If the highest-ranked results are mostly inaccessible, removing them can leave an authorized employee with an empty answer even though useful permitted documents exist. Test retrieval quality within the caller’s allowed collection, and keep authorization separate from relevance ranking so changes to ranking cannot weaken access controls.

A reranker, tracing system, or support console may also receive document text. Define which service identities may process it and which people may inspect it. Giving every developer access to full prompts would create another route around the source permissions, even if ordinary chat users were correctly restricted.

04

Treat revocation as a live operation

Agree with the information owner how quickly access should be revoked when an employee leaves a project. Design permission synchronization and cache expiry to meet that interval. For especially sensitive sources, check the current permissions with the authoritative service before using retrieved text.

Cached answers need equivalent protection. An answer generated for a finance manager may contain information another employee cannot see. Key caches by the relevant authorization context, or reauthorize their underlying sources before reuse. Retained conversation history needs checking too: a new response can disclose old restricted material by summarizing an earlier exchange.

When a conversation remains open while an employee changes teams, the application may still hold retrieved passages in session memory. On the next turn, it should resolve the current authorization context and exclude material that is no longer permitted. Hiding the old citation leaves the passage available for the model to reuse.

Revocation controls future retrieval and disclosure; it cannot erase information the person already saw. Explain that limit to information owners when agreeing the revocation interval. Deleting a source also needs to be distinguished from deleting retained copies. Search chunks, cached answers, and diagnostic records may have different lifetimes and need their own removal procedures.

05

Test the same question under different identities

Tests should cover access changes. Run the same question as an authorized employee, an unrelated colleague, a user in another tenant, and someone whose access was just removed. Include mixed-source answers and documents with inherited permissions. Check retrieved chunks and model inputs as well as the visible answer.

Keep an audit trail connecting the caller, authorization decision, source identifiers, and answer. Limit access to those records because they may themselves contain sensitive information. Before release, the team should be able to explain why each source in a response was available to that particular user at that particular time.

Pause the permissions connector while document ingestion continues. The application should recognize that its authorization view has become stale and apply the agreed restriction. Monitor permission updates separately from document updates. Newly indexed content may still have outdated access rules.

The sales employee asking about the discount may receive an answer based on permitted sales material, or an explanation that the assistant lacks accessible information. The finance manager may receive a different answer. Neither response should expose restricted titles, snippets, or source names merely to explain that access was denied.

06

Run a permission-change exercise

Use a synthetic document with a distinctive sentence and two test users. Let one user retrieve it, then revoke that user's access while leaving the other user's access intact. Check direct questions, paraphrased questions, follow-up messages, and cached answers. Search for the distinctive sentence in responses and in any diagnostic output the denied user can access.

Record when the source permission changed and when each retrieval path stopped returning the content. Compare that interval with the agreed revocation target. Repeat after a group change and after moving the document to another folder. The permitted user should still receive the expected answer. A system that avoids disclosure by denying every request has failed its useful-access requirement.

07

Keep authorization decisions traceable without copying the document

Define a small diagnostic record before adding more retrieval logs. For an illustrative access decision, retain the request identifier, authenticated subject identifier, source document identifier, permission version, policy result, and decision time. The record should explain why a particular source was eligible without storing its restricted text in another system. Decide who can inspect those records and how long they are retained. A support engineer investigating a denied answer may need to see that a group lookup failed, while having no reason to read the underlying finance document. Treat access to diagnostic records as a separate permission decision.

Follow one denied request across the retrieval stages. Check that the search result excluded the restricted chunk, the reranker did not receive it, and the final context did not contain an older cached copy. Use identifiers and controlled test content to compare stages. A refusal in the final answer cannot establish that earlier stages respected the boundary. Also check the permitted path: a user with valid access should receive a useful answer with a citation they can open. Otherwise, a retrieval configuration that silently discards most documents can appear secure while failing the workflow it was built to support.

Make the failure response specific enough to support recovery without disclosing hidden material. The assistant can say that authorized sources are temporarily unavailable; it should avoid naming an inaccessible document or confirming that a restricted transaction exists. Give the operator a request identifier and an actionable failure category. During a revocation incident, identify which permission version was used and which cached answers may contain affected content. Define who can invalidate those entries and when service can resume. Include that recovery path in the exercise with the synthetic document. The acceptance decision then covers both useful authorized retrieval and the ability to contain a permission failure after it is discovered.

08

References

Microsoft Learn · Document level access control in Azure AI Search

09

Related

Where to read next on the same subject.