{"slug": "filter-permissions-before-retrieval", "title": "Filter Permissions Before Retrieval", "summary": "Trida AI published guidance arguing that access control in retrieval-augmented generation systems must begin at indexing, not query time: every chunk should inherit its source document's access list, and a chunk without one should default to closed. The company recommends building the caller's identity and group memberships into a server-side filter on the search itself, never from request-body fields or model-generated values, citing Microsoft's Azure AI Search document-level access control and Amazon Bedrock Knowledge Bases' pre-retrieval filtering as supporting implementations.", "body_md": "*Originally published at [Trida AI](https://trida.ai/blog/filter-permissions-before-retrieval).*\n\nPicture the control many teams ship first: a line in the system prompt warning the model that some retrieved material is confidential and must not be quoted to unauthorised staff. It feels tidy. It is also backwards. The warning and the confidential material arrive in the same context, the material first in every way that matters — the model has already read the salary band and the unreleased price before it reaches the sentence asking it to be careful. Compliance then depends on the model choosing the warning over the content, every time, against follow-up questions, summarising tasks, and documents that argue the opposite.\n\nRetrieval-augmented generation, RAG for short, widens the door your permissions were guarding. The source systems had it right: a file in a shared drive opens only for the people on its access list. Index that file into a vector store without carrying the list with it, and similarity search becomes a way around the list. The user never opens the document. They ask a question, the retriever finds the document is relevant, and the model hands over its contents in prose. No permission was broken on paper. The answer broke it.\n\nOur position is plain: a chunk outside the caller's access list should never be retrieved for that caller. Not retrieved and hidden. Not retrieved and summarised carefully. Never retrieved. Everything downstream of retrieval, the prompt, the trace, the cache, the answer, is built from what retrieval returned.\n\nAccess control in a RAG system starts at indexing, not at query time. When a document is split into chunks, every chunk inherits the document's access list: the users and groups who may read the source. A chunk that loses that list during chunking is a defect, and the safe default for a chunk with no list is closed, not open.\n\nMicrosoft's guidance for [document-level access control](https://learn.microsoft.com/en-gb/azure/search/search-document-level-access-overview) in Azure AI Search is explicit that where a pipeline splits secured documents, the permission metadata has to be populated on every resulting chunk, rather than only on the parent. Our rule for the platforms that support an explicit deny entry: the deny wins over an allow. An exception that only sometimes applies is not an exception.\n\nGroups do most of the work here. A list built from group memberships — finance, plant managers, one client's deal team — survives people joining and leaving far better than a list of individual names, and it matches how the source systems already express access. Individual entries stay available for the genuinely one-off grant, and deny stays available for the exception that has to win.\n\nAt query time, the caller's identity becomes a filter on the search itself. The application takes the authenticated user, resolves their groups, and hands the index a condition: return chunks whose access list contains this user or one of these groups. Azure AI Search describes its security filters in exactly those terms: the application passes a user or group identity, the query carries it as a filter, and documents that do not match are excluded. Amazon Bedrock Knowledge Bases, for ACL-enabled custom data sources, applies its lists during [pre-retrieval filtering](https://docs.aws.amazon.com/bedrock/latest/userguide/kb-managed-ds-custom-acl.html), returning only documents the querying user is permitted to access.\n\nTwo details decide whether this holds up.\n\nFirst, the filter comes from the authenticated session, built by server code the caller does not control. It never comes from a field in the request body, and it is never assembled by the model. A filter the caller can edit is a suggestion. A filter the model can rewrite is worse, because the model reads untrusted documents for a living.\n\nSecond, filtering is not the same job as authentication, and the vendors say so themselves. AWS warns, in the same Bedrock documentation, that ACL-aware filtering is not authorization: the knowledge base does not authenticate end users, the application does, and the filter is only as trustworthy as the identity the application verified and passed in. Teams that skip that distinction end up with a well-filtered index behind a login nobody checked.\n\n*Permission check at retrieval. The filter is built from the verified login, and the search runs only over chunks the caller may read.*\n\nTake a routine question, labelled here as an example: \"What changed in the supplier payment terms this quarter?\" Two people ask it on the same morning, in the same system.\n\nThe operations lead gets an answer drawn from the current terms sheet and the procurement bulletin — both open to her groups. The restricted annex, which holds the negotiated rates for one supplier, is not in her results, so it is not in her answer, her trace, or her follow-up questions' context either.\n\nA finance manager asks the identical question and gets a fuller answer, because the annex is open to finance. Same index, same question, different searchable set. The difference was decided before either search ran, by the lists copied onto the chunks when the documents were indexed.\n\n*Retrieval log — example. One question, two callers. The annex enters the finance manager's search and never enters the operations lead's.*\n\nPermissions change faster than indexes do. Someone leaves a deal team on Friday; the source drive updates in minutes, while the copy of the access list sitting on your chunks is only as fresh as your last sync. Treat permission changes as an indexing event, not a housekeeping job. A revocation should trigger re-indexing of the affected documents the way a content edit does, and a revocation that waits for the weekly job is a week of access you meant to end.\n\nMisconfiguration fails quietly, too. AWS notes that when its ACL settings are wrong, retrieval does not error — the affected documents are silently omitted, and users just get thinner answers. That is the safe direction to fail, but it means a broken permission sync looks exactly like a retrieval-quality problem. The test that separates the two is unglamorous: a small set of accounts, one per role, asking questions with known answers, run after every index change. If the restricted account starts seeing the annex, the run is red. If the finance account stops seeing it, the run is also red.\n\nThere is a cost we will not pretend away. Every chunk now carries permission metadata that has to be copied at indexing, kept current afterwards, and tested after every change, and coarse group lists will occasionally hide a document from someone who could legitimately have read it in the source. We accept both. A missed document is a support ticket. A leaked one is an incident.\n\nIf your assistant can answer questions from documents some of its users may not open, the fix is in the retrieval layer, not in a sterner prompt. Bring us the corpus and its permission model through [Trida AI's intake](https://trida.ai/intake), and we will design the indexing and filtering so each caller searches only what they are allowed to read.", "url": "https://wpnews.pro/news/filter-permissions-before-retrieval", "canonical_source": "https://dev.to/tridaai/filter-permissions-before-retrieval-2d72", "published_at": "2026-11-29 12:08:36+00:00", "updated_at": "2026-11-29 12:13:53.551719+00:00", "lang": "en", "topics": ["ai-agents", "ai-safety", "large-language-models", "artificial-intelligence"], "entities": ["Trida AI", "Microsoft", "Azure AI Search", "Amazon Bedrock Knowledge Bases", "AWS"], "also_reported_by": [], "takeaway": "Carry each source document's access list onto every chunk at indexing time and pass the authenticated user's identity and groups as a server-side search filter, so chunks outside the caller's access list are never retrieved rather than retrieved and hidden.", "recommendation": {"advice": "Attach permission metadata to every chunk during indexing and apply the caller's identity and groups as a server-side pre-retrieval filter, never from request fields or model output.", "playbook": "rag-retrieval", "playbook_url": "https://wpnews.pro/playbooks/rag-retrieval"}, "alternates": {"html": "https://wpnews.pro/news/filter-permissions-before-retrieval", "markdown": "https://wpnews.pro/news/filter-permissions-before-retrieval.md", "text": "https://wpnews.pro/news/filter-permissions-before-retrieval.txt", "jsonld": "https://wpnews.pro/news/filter-permissions-before-retrieval.jsonld"}}