jcardena.com › Blog › The Index That Knows Who's Asking
184 posts
EN ES

The Index That Knows Who's Asking

Software

An enterprise retrieval index must return only what the person asking is allowed to see. Why identity-gated retrieval is a design problem, not a filter you bolt on later.

The Index That Knows Who's Asking

Put a language model on top of all your company's documents and you have built two things at once: a genuinely useful assistant, and a genuinely dangerous one. Useful, because it can answer almost anything. Dangerous, for exactly the same reason. The assistant that can find the answer to any question can also find the salary sheet, the unreleased plan, the document one team was never supposed to see. The difference between the two is a single property of the index underneath: does it know who is asking.

TL;DR: An enterprise retrieval index must return only what the person asking is allowed to see. That is not a filter you sprinkle on at the end. Permissions have to travel with the content into the index, the query has to carry the asker's identity, and retrieval has to enforce access at query time. And it all has to be built together with retrieval quality, because an index that is secure but cannot find things, or finds things but leaks them, has failed either way.

Query +IdentityCheckPermissionsRetrieveAllowed OnlyGround theAnswer
Every query carries who is asking; retrieval returns only the overlap.

Search that forgets to ask who

The demo version of enterprise search is impressive and quietly broken. You point it at everything, ask it anything, and it answers. In the demo everyone in the room is allowed to see everything, so nothing goes wrong. Then it ships to a real company where people are very much not allowed to see everything, and the same system that impressed everyone becomes a way to ask innocent questions and get answers drawn from documents you had no right to. The index never forgot the content. It just never learned to ask who was asking before it answered.

The leak is not the model, it is the index

When people worry about an AI assistant leaking secrets, they usually worry about the model. They should worry about the index. The model can only speak about what it was handed, and what it was handed came from retrieval. If retrieval pulled a restricted document into the context, the model will happily summarize it, because from the model's point of view that document was simply provided. The leak happened one step earlier, when the index returned something it should not have. Fix the model's manners all you like; the actual boundary is at retrieval, and that is where the enforcement has to live.

Filter at query time, not just at ingest

It is tempting to think you can solve this once, at ingestion, by only indexing what is public. But most useful enterprise knowledge is not public; it is permissioned, and who may see what changes constantly as people join teams, leave them, and get access granted and revoked. So the permissions cannot be frozen at index time. They have to be checked at query time, against the asker's identity as it is right now. The content and its access rules go into the index together, and every query arrives carrying who is asking, so retrieval can compare the two and return only the overlap. Anything less is a snapshot that goes stale the first time someone changes teams.

A grid of document tiles, some lit gold, some dimmed behind a barrier
Permission-aware retrieval: the index returns only from the set this person is allowed to see.

Permission-aware retrieval done well

Done well, permission-aware retrieval is almost invisible. The user asks a question, their identity rides along with it, the index retrieves only from the set of things that person is allowed to see, and the model grounds its answer in that set. Two people can ask the identical question and get different, correct answers, because they are allowed to see different things, and neither of them ever learns that the other's documents exist. The person with no access to a topic simply gets nothing on it, as if it were not there. That silence is the feature. The index does not tease with what it will not show; it behaves, for each person, as if it only ever contained what they were allowed to have.

Access control and retrieval quality are one design

The mistake I see is treating security and quality as separate teams pulling against each other, one adding filters, the other trying to retrieve more. They are one design. If your access filtering is crude, it will hide things people are allowed to see and the assistant will feel useless. If your retrieval is crude, it will surface things people are not allowed to see and the assistant will be a liability. Getting one right at the expense of the other is not a win. The index has to be measured on both at once: does it find the right thing, and does it find it only for the right person. I hold retrieval to both numbers together, because in an enterprise they were never really two problems.

A stream of light meeting a gold gate that opens one channel
Enforce access at query time, so it stays current as people and teams change.

The one that taught me this

The lesson landed for me the first time I watched a permission-blind index in front of real, mixed content. Nothing dramatic happened in a demo. It happened in my head, when I realized that the same query I was proudly running would, for a different person against a fuller corpus, have pulled back exactly the things that must never travel. The system was not malicious. It was faithful. It retrieved what matched, and matching had nothing to do with permission. From then on I stopped thinking of access control as a wrapper around retrieval and started treating it as part of what retrieval is.

SOURCESDocumentsTheir OwnPermissionsINDEXChunksCarry AccessRulesQUERYUser IntentAskerIdentityFILTERPermission-AwareAt QueryTimeANSWERGrounded inAllowed Only
Identity-gated retrieval: permissions with the content, identity with the query, access enforced at retrieval.

The takeaway

An enterprise index is only as trustworthy as its answer to one question: who is asking. Carry permissions with the content into the index. Carry the asker's identity with every query. Enforce access at retrieval, at query time, so it stays current as people and teams change. And measure the index on finding the right thing and finding it only for the right person, together, because in the real world they are the same job. The index that knows who is asking is the one you can safely put in front of the whole company. The one that does not is a leak with a friendly interface.

JC
Juan Cardena
Enterprise AI & Agentic Systems Architect

Enterprise architect with 25 years across web, software, data, and AI. MIT CDAO ’25. Writing on agentic AI in production.