Your RAG system just found the perfect document for the question. It is the executive compensation file, and it is answering an intern.

Everything worked. Retrieval was accurate, ranking was sensible, the answer was well grounded. And you have a serious incident.

Relevant does not mean authorised.

A retrieval system should answer from the best evidence the current user is allowed to see, not the best evidence in the index.

The property that makes this dangerous

Semantic search has an uncomfortable habit of surfacing sensitive documents exactly when they are most relevant to whoever is asking.

The moment someone asks about salaries is the moment the compensation file ranks first. The moment someone asks about the acquisition is when the deal memo becomes the top hit. Relevance and sensitivity correlate, so this failure mode is common. The system is working precisely as designed and is aimed at the wrong audience.

Index-time filtering does not save you either. Permissions change: people switch teams, contractors roll off, documents get reclassified, regions impose new rules. An index built against last quarter's access model is enforcing last quarter's access model.

Enforcement has to happen in retrieval

A rule like this usually lives in one of two places, and they are not equivalent.

In the prompt: "Do not reveal salary information." This is a request to a probabilistic system that just read the salary information. It can be confused, talked around, or simply ignored under an unusual phrasing.

In the query: the retrieval call itself is scoped by the requesting user's identity, groups, region, and clearance, plus the document's classification and state, applied before anything is ranked (pre-filtering, in vector-search terms). The compensation file never enters the candidate set at all.

Only the second one is a control, because it makes the retrieval layer the policy enforcement point. Filtering the answer afterwards is a useful backstop, but by then the model has already read the file. If your RAG security story is "the model was instructed not to," you do not yet have a security story.

Two rules that follow from that:

  • Mirror your existing permissions; do not rebuild them. A parallel copy of your access model in the vector store will drift from the real one, and it will drift silently. Resolve permissions from the same source of truth your document system uses.
  • Fail closed. If permissions cannot be resolved for a request, return nothing. The alternative (degrading to unfiltered retrieval when the permission service times out) is an availability decision that quietly becomes a disclosure decision.

Neither rule is free. Resolving permissions from the source of truth puts the permission service in your critical path, and failing closed turns its outage into a retrieval outage. Pre-filtering has a quality cost too, because a restrictive filter on an approximate nearest-neighbour index can cost recall or latency for exactly the users with the least access.

The test to run this week

Take your least-privileged user account. Ask it your most sensitive questions: compensation, terminations, unannounced plans, legal matters. Read exactly what comes back.

Then make that a test suite that runs on every index change, because "we checked once" and "it holds now" are different claims, and only one of them survives a re-index.

For a revocation case, remove a test user's access in the source system and measure how long retrieval keeps serving them the document. That interval, set by your re-index schedule or your permission cache, is your real revocation window. Agree it with whoever owns access control.

Key takeaways

  • Relevant does not mean authorised.

About this explainer

Format
Explainer
Level
Practitioner
Read
2 min read
Published
Jun 7, 2026

Short mental models: one idea, why it matters, what to do about it.

Checklist · · 29 checks

Security review checklist for an AI feature

What to check before an assistant, RAG app or agent goes in front of real users. Grouped by area, ticked off locally; progress stays in your browser.