Permissions-Aware Retrieval: ACLs That Travel With the Data

An agent that retrieves the most relevant context will, sooner or later, retrieve the most relevant thing the person asking was never allowed to see. The fix is not a better filter on the answer. It is making entitlement and relevance the same question.
The demo goes beautifully right up until it doesn't. A financial-planning analyst asks the new assistant to pull together everything the company knows about the third-quarter forecast, and a few seconds later a clean, confident summary comes back — well organized, correctly sourced, genuinely useful. Buried in the third paragraph are two numbers the analyst has never seen before and was never cleared to see, because they originated in a board-only deck sitting in a folder her account cannot open. Nobody typed those figures into the answer. The agent retrieved them, because among all the material in the knowledge base they were the closest semantic match to the question, and nothing in the retrieval step had any idea who was asking or what she was permitted to know.
It is tempting to file this under model behavior — a hallucination, an oversight, something a stern system prompt will tidy up. It is none of those things. The model did precisely what it was built to do, which was to find and surface the most relevant context available to it. The failure sits one layer down, in the fact that relevance was the only property the retrieval step was ever asked to optimize, and entitlement — the question of whether this particular requester should be able to reach this particular document — was treated as somebody else's job, applied somewhere downstream, after the reaching had already happened. That sequencing is the whole problem, and no amount of prompt engineering repairs it, because by the time a prompt could intervene the leak has already occurred.
Relevance was the only question the index was ever asked
To see why this happens you have to look at what retrieval actually does under the hood. Building an agent's knowledge base means taking documents, splitting them into chunks, converting each chunk into a vector that encodes its meaning, and storing all of those vectors together in an index. When a question arrives it is converted into a vector too, and the index returns the chunks whose vectors sit nearest to it — the nearest neighbors in a high-dimensional space that stands in for semantic similarity. This is an elegant and profoundly democratic operation: every chunk in the index is equally reachable by every query, ranked on meaning alone, and that flatness is exactly what makes retrieval feel like magic. It is also exactly what makes it dangerous, because nothing in a nearest-neighbor search knows who is asking or carries any notion of who is allowed to reach what.
The permissions that governed those documents in their original homes do not survive the trip into the index unless someone deliberately carries them across. In the source systems, access was enforced by real machinery — folder ACLs, row-level security, group membership, sharing rules that reflect years of accumulated decisions about who sees what. The instant you copy content out of those systems and into an embedding store built for fast similarity search, you have, by default, severed it from the permission model that used to protect it. What remains is a pool of meaning with no memory of provenance, in which the board deck and the public FAQ float side by side as equally retrievable neighbors. The index did not lose the permissions maliciously. It was simply never designed to hold them, and the confidentiality that everyone assumed still applied was quietly left behind at ingestion.
A filter bolted on after retrieval is a filter bolted on after the leak
The common response, once someone notices the exposure, is to add a check after the fact — retrieve the top results the usual way, then filter out the ones the requester should not see before composing the answer. This feels like enforcement and is not, for reasons that compound. The restricted chunk has already been pulled from the index, already passed through the reranker, already been read by the model or held in the context that assembles the response; a filter that runs at that point is redacting a document the system has, in every meaningful sense, already opened. Worse, the retrieval itself leaks in ways a downstream redaction cannot recover. The ranking reveals that a matching document exists and roughly how relevant it is; the difference between "no results" and "results you may not see" is itself information, and in the wrong hands the mere confirmation that a highly relevant board deck exists on a given topic is the sensitive fact. The logs, the traces, the intermediate reasoning all capture material the requester was never entitled to, scattering copies of the very thing you were trying to contain.
The most fragile version of this pattern is the one that dresses a prompt instruction up as a control — telling the model, in effect, not to reveal HR files to people outside HR. That is not access control; it is a polite request made to a system with no obligation to honor it, defeated by a cleverly worded question or an ordinary failure of instruction-following, and it belongs to the class of relabeled safeguards that leaves real risk untouched. It also makes the whole arrangement impossible to audit, which is the quieter and more corrosive cost. When enforcement is smeared across an output filter here, a reranker setting there, and a paragraph of prompt text somewhere else, there is no single place you can point to and answer the only question that matters for a security review: for this requester, what was this agent actually able to retrieve? A system whose permissions are decided at ingestion suffers a related failure — the person who lost access this morning is still reachable through vectors embedded last month, because the check was frozen in place long before the question was asked. Enterprise buyers are beginning to price this in, and it is part of why Gartner expects more than forty percent of agentic AI projects to be canceled by the end of 2027, citing inadequate risk controls among the causes — a category that describes bolted-on permissions exactly.
The entitlement and the match have to be the same query
Closing this properly means abandoning the idea that permissions are something you apply to an answer, and treating them instead as a property of the context an agent is allowed to assemble in the first place. Mechanically, that starts with the chunk: when a document is split for embedding, each chunk must inherit its source's access controls as indexed metadata and carry them permanently, so that a fragment of the board deck remains, at the level of the index record, a fragment of the board deck and nothing less protected. The requester's identity then has to survive the entire journey from the question to the retrieval boundary — which is harder than it sounds inside an agent, because agents chain steps and call tools and are perpetually tempted to reach the knowledge base as a privileged service account rather than as the human they are acting for. That is the classic confused-deputy trap, and the discipline that avoids it is unglamorous but absolute: the agent retrieves as the requester, with the requester's entitlements resolved live against current group membership, never with borrowed authority.
With those two pieces in place the actual enforcement collapses into a single operation, and this is the crux of the whole design. The entitlement filter becomes a precondition of the nearest-neighbor search rather than a step after it, so the candidate set is scoped to what the requester may see before ranking ever runs — a pre-filter, not a post-filter, which means the restricted board deck is not retrieved and then hidden but never a candidate at all. Relevance and entitlement stop being two questions asked in sequence and become one query, and the model receives only chunks the requester was already cleared to open, which is nothing more than least privilege applied to context. The same logic extends past the knowledge base to every system an agent touches: when an autonomous worker reaches a source system through the Model Context Protocol, authenticating as the requester lets that system's own native permissions do the enforcing, so the agent inherits the exact reach of the person it serves and not a byte more. This is the principle StudioX builds Enterprise Knowledge around — that a Specialist Agent's Reasoning Core is fed retrieval already narrowed to the requester's entitlements, evaluated at query time, with Human-in-the-Loop reserved for the decisions rather than the leaks — because a knowledge layer that cannot prove what it withheld is not enterprise-ready no matter how good its answers read.
The reframe worth carrying out of all this is that the retrieval boundary is the access-control boundary, and there is no second chance further downstream. Once you accept that, the health of the whole system reduces to a single question you should be able to answer instantly for any person in the organization: what could this agent have retrieved on your behalf? When entitlement is enforced at the boundary, as a precondition of the search, that answer is a single deterministic query with a provable result — the audit is the mechanism, not a report bolted onto it. When permissions are applied after retrieval, the honest answer is "we're not entirely sure," and in a system that handles anything confidential, not being sure is indistinguishable from not enforcing anything at all.
Discussion
No comments yet — start the conversation.