An AI Search System Can Retrieve a Document You’re Not Allowed to Read

Conceptual illustration of an archive cabinet with an open service door and an exposed document folder behind a closed reader-access window. RAG
A locked source document does not guarantee that its indexed passages are protected. AI search must preserve the requester’s permissions across retrieval, model context and cached answers.

The source file says “Access denied.” The AI answer still includes information from it.

That is possible when the search service can read a document but the person asking the question cannot. If the application retrieves indexed passages using the service’s broader privileges and fails to apply the user’s permissions, the answer can expose content the original document system would have withheld.

The model does not need to break into anything. The application may have handed it the text through an authorised service connection used on behalf of the wrong audience.

The document’s front door is not the only copy

Retrieval-augmented generation, or RAG, supplies a model with material found in an external knowledge source. A common pipeline extracts a document’s text, divides it into passages and stores searchable records. Those records can contain the text itself alongside vectors and metadata.

A link back to the original file might still enforce its permissions perfectly. But following that link is a separate operation from returning a passage already stored in an index. Blocking the link cannot retract text that has reached the answer.

Microsoft’s engineering account of propagating SharePoint permissions into RAG describes the problem directly: downstream storage and retrieval layers need an explicit mapping of the source’s document permissions. Copying content does not automatically reproduce its access rules.

This is related to why deleting an original file need not remove every searchable copy. The index has its own stored state. Here, the critical state includes who is allowed to receive each passage.

Relevance and permission answer different questions

A similarity score estimates whether a passage is relevant to a query. It does not establish whether the requester may read it. An embedding—the numerical representation used for matching—does not replace an access-control decision.

Authentication establishes who the requester is. Authorisation decides which records that identity may access. A successful organisation login is not, by itself, a grant to every document indexed for that organisation.

Azure AI Search illustrates the distinction with its security-filter pattern. The application includes user or group identifiers in a filter that excludes nonmatching records. Microsoft explicitly notes that this pattern compares strings; the filter itself does not authenticate those identities. The trusted application must obtain them from the authenticated session, rather than accept whatever identity the caller supplies.

A relevant passage can still be excluded

An illustrative permission record. Assume access is granted only by the group shown, with no additional grants.

The search service has indexed this passage.
Source
Forecast.pdf · passage 003
Allowed group
Finance
Authenticated requester
Member of Sales, not Finance
The requester’s permissions do not match. Exclude from model context
Fictional document, groups and record; not a vendor schema. The service’s ability to index the content is distinct from the requester’s permission to receive it. A production decision must account for the source’s full rules, including relevant inheritance, direct grants and other policy conditions.

The index must retain enough permission information for the records it actually returns. If a document becomes many independently searchable passages, protecting only a parent record leaves a gap unless the retrieval system reliably enforces that parent’s policy for every passage.

Azure also documents built-in identity-aware approaches to document-level access. Several ACL ingestion and query-time enforcement capabilities are currently marked preview. Their availability and supported sources must be checked for the selected API and deployment; “uses Azure” is not evidence that a particular application has configured them.

Hiding the citation comes too late

Once restricted text is included in model context, the application has already supplied it to the generation component. Removing its citation from the interface does not stop the answer from paraphrasing the text.

A system prompt saying “only answer from documents this user may read” is not an adequate substitute for an enforced access decision. OWASP’s guidance on sensitive-information disclosure warns that prompt restrictions may not be honoured.

This failure does not require a malicious instruction hidden in retrieved content. An ordinary question can trigger it if the permitted search universe is too broad. Prompt injection and missing authorisation are different failures, even when they appear in the same application.

The relevant boundary comes before content reaches components not permitted to process it for that requester. That includes a downstream reranking service or answer cache where applicable, not just the final chat bubble. A candidate identifier processed inside a trusted search engine is different from sending the candidate’s full text to another service.

Revoking access does not necessarily update the index

Suppose a document’s direct access grant to a user is removed. The source system now denies that user, but yesterday’s indexed permission record still contains the old grant. Content freshness and permission freshness are separate concerns. Stale user-group membership can create a similar problem at the identity layer.

Microsoft’s SharePoint implementation account identifies this limitation: materialised permissions do not automatically inherit later changes. A revoked user can continue receiving indexed content until the permissions are refreshed. Its mitigations include periodic re-ingestion and event-triggered refreshes to reduce the staleness window.

Cached answers add another copy to consider. As a design consequence, reusing an answer solely because the question matches is insufficient when access differs between users or has changed since the answer was stored. Cache reuse needs an authorisation scope and an invalidation or revalidation policy that reflects those changes.

Isolation helps, but configuration still defines the boundary

Separate tenant datasets reduce the opportunity for cross-customer retrieval. Pinecone’s serverless multitenancy guidance, for example, uses one namespace per tenant, with reads and writes targeting a namespace.

The application still has to select the correct namespace from trusted identity information. And tenant isolation does not answer every permission question inside one company: Finance and Sales may share a tenant while having different document access.

Effective permissions also depend on how grants combine. Elasticsearch documents an important example: document-level security queries from multiple roles are combined with OR. If one applicable role grants unrestricted index access, adding a restricted role does not narrow that broader grant. Reviewing the restrictive rule alone can therefore create false confidence.

The strongest evidence is a permission difference that survives retrieval

A useful validation compares authorised test identities with different access to the same known document. Inspect which document and passage identifiers reach the generation context, not merely whether the model happens to quote them in one answer. Then repeat after a permission change and through the cache path.

OWASP’s vector and embedding guidance identifies misaligned access controls and cross-context leakage as RAG risks, recommending permission-aware stores and dataset partitioning. The implementation must make those boundaries observable.

An unauthorised answer can be perfectly accurate. The failure is that the application used knowledge for someone who was not entitled to receive it. A trustworthy search system must establish both relevance and permission before turning a passage into an answer.

Sources

Rate article
Add a comment