RAGcore
Metadata filters & per-user permissions
Retrieval must only return what this user may see — enforced in the query, not the prompt.
What it is and why it exists
Enterprise corpora carry access controls (groups, teams, tenants). Every chunk stores its ACL and metadata; every query filters on the caller’s identity. Pre-filtering applies the filter during search; post-filtering searches first and then drops what’s not allowed — which can return far fewer than k results (k-starvation) and is easy to get wrong.
Quick prototype
One shared index, no permissions.
In production, at scale
ACLs synced from the source system (Drive, SharePoint, Confluence) into chunk metadata, filters derived from the authenticated user server-side, pre-filtered search (or partitioned indexes per tenant), and an eval that checks a user never retrieves something they can’t open.
Vendors and tools
| Pinecone namespaces / metadata filters | Filtered vector search |
|---|---|
| Qdrant / Weaviate filters, multi-tenancy | Payload filters, tenant isolation |
| Glean-style enterprise search | Permission-aware search products |
| Postgres row-level security | Permissions enforced by the database |
On AWS: Bedrock Knowledge Bases metadata filtering; Amazon Q Business ACL-aware connectors; OpenSearch document-level security.
How it fails
- Telling the model “don’t reveal HR documents” instead of filtering
- Post-filtering top-5 leaves zero results for restricted users
- ACLs synced once and never updated
What the interviewer asks next
Why is “the model won’t mention restricted docs” not enough?
Anything in the context can leak through paraphrase, summaries or injection. If the user isn’t allowed to read it, it must never be retrieved into their context.
Pre-filter or post-filter?
Pre-filter for correctness (always k results, all allowed); post-filter only if you over-fetch heavily and accept the risk of short result lists.