RAG Access Control: Enforcing Per-User Permissions in Enterprise RAG

AI Applications

RAG Access Control: Enforcing Per-User Permissions in Enterprise RAG

Introduction

It's Monday morning. A new sales hire asks your AI assistant, "What discount did we give Acme last year?" The answer comes back in seconds. It also quotes margin notes from a board deck she was never supposed to see.

Nobody hacked anything. Your retrieval-augmented generation (RAG) system simply searched every document it could reach and handed the best match to the model. That is what happens when retrieval ignores who is asking.

So how do you give people fast AI answers without turning your assistant into a data leak? You enforce per-user permissions inside retrieval itself. This guide shows you how it works, which approach fits your stack, which tools support it and how to roll it out step by step.

TL;DR: Quick Answer

RAG access control filters what the retriever can return based on the signed-in user's identity and each document's permissions. Capture access lists when you index content, apply them as a filter before ranking, and add a live check for sensitive data. Never rely on the language model to enforce access.

Key Facts

  • 13% of organizations reported breaches of AI models or applications, and 97% of those lacked proper AI access controls (2025, IBM).
  • The global average cost of a data breach reached $4.44 million (2025, IBM).
  • Breaches at organizations with high levels of shadow AI cost an average of $670,000 more (2025, IBM).
  • 40% of organizations delayed Microsoft 365 Copilot rollouts by three months or more over data oversharing concerns (2024, Gartner).
  • OWASP added "Vector and Embedding Weaknesses", the category that covers RAG pipelines, to its Top 10 for LLM Applications (2025, OWASP).

Why RAG Access Control Matters More Than You Think

A RAG system answers from whatever its retriever finds. That makes the retriever a brand-new path into your data. If the path ignores permissions, your AI can repeat restricted content even though the user never opens the restricted file.

Most RAG pilots start with one shared index and one service account. That works fine on public help docs. It breaks the moment you connect SharePoint, Google Drive, Confluence or a CRM, where every file carries its own access rules.

What can actually go wrong?

  • Leaks across teams: a sales question pulls salary bands, legal holds or M&A notes into the answer.
  • Cross-client exposure: in a multi-tenant product, one customer's documents show up in another customer's answers.
  • Compliance breaches: answers that expose health, financial or personal data can break HIPAA, GDPR or contract terms.
  • Stalled rollouts: one leaked answer can freeze your AI program for months while security re-reviews it.

These are not edge cases. Among organizations that reported breaches involving AI models or applications, 97% lacked proper AI access controls (2025, IBM). Oversharing worries alone pushed 40% of organizations to delay Copilot rollouts by three months or more (2024, Gartner).

Why a better prompt won't fix it

Can't you just tell the model, "Only use documents this user may see"? You can, but it will sometimes get it wrong. Language models are not deterministic, and "usually correct" is not an access-control policy. The control must run in code, before any content reaches the model.

That is where many guides fall short. They show a working demo with a single filter and stop there. They skip permission freshness, nested groups, caches and audit logs, which are exactly where real leaks happen. The rest of this guide covers all of them.

How Permission-Aware Retrieval Works

Permission-aware retrieval checks who you are before it ranks anything. Chunks you can't access are removed from the candidate set, so they are never scored, never sent to the model and never cited.

The five stages

  1. Identity: you sign in through your identity provider, such as Microsoft Entra ID, Okta or Google Workspace. Every query carries your identity and group memberships, not a shared service account.
  2. Permission capture at ingestion: when documents are split into chunks and embedded, the pipeline also reads each file's access control list (ACL) from the source system. It stores allowed users, groups, department or tenant as metadata on every chunk.
  3. Filtered retrieval: at query time, the retriever builds a filter from your identity and applies it inside the vector or hybrid search. Only chunks you may see come back.
  4. Live check for sensitive data: for restricted content, a second check confirms your access against the source system or an authorization service just before the answer is generated.
  5. Audit: each query logs who asked, which documents were retrieved and which authorization decision was made.

Where most systems break: permission freshness

Which stage fails most often? Usually stage 2. Permissions change every day as people join teams, leave projects or receive sharing links. If your index syncs access lists once a night, someone removed from a folder at 9 a.m. can still get answers from it until the next sync.

That's why mature designs combine two layers. A fast metadata filter handles most queries, and a real-time check covers the sensitive ones. You get speed for everyday questions and certainty where it matters.

What about AI agents?

An AI agent that searches on your behalf should inherit your permissions, never more. If the agent runs under its own broad credentials, every user effectively gets the agent's access. Treat agents as users with the same identity, filter and audit rules.

4 Ways to Enforce Per-User Permissions in RAG

For most enterprises, metadata pre-filtering is the right base layer. Add fine-grained authorization when permissions are complex or change often. Avoid relying on post-filtering alone.

1. Metadata pre-filtering

Each chunk stores ACL fields such as allowed users, groups or department. The retriever applies a filter from your identity before the similarity search runs. It's fast and supported by most vector databases. The catch? It's only as fresh as your last permission sync.

2. Post-filtering

The retriever fetches the top results first, then removes the ones you can't see. It's easy to bolt onto an existing demo. But if 8 of your top 10 results get removed, the model answers from scraps. And if any code path forgets the filter, restricted content goes straight through.

3. Separate indexes per tenant or role

Each customer, business unit or clearance level gets its own index or namespace. Isolation is strong and easy to audit, which suits multi-tenant SaaS. It doesn't handle per-document sharing, though, and duplicated content multiplies storage costs.

4. Fine-grained authorization (ReBAC or ABAC)

A dedicated authorization service decides access from relationships and attributes, such as "viewer of this folder" or "member of this deal team". The retriever asks the service which documents you can see, or checks each candidate. It handles complex, fast-changing permissions, at the cost of one more service to run.

Which one should you choose?

Ask two questions. How often do your permissions change, and how many systems do they come from? A single SharePoint tenant with stable groups can run well on pre-filtering. A product that mixes CRM records, shared drives and client workspaces usually needs fine-grained authorization on top.

Approach How it works Best for Main drawback
Metadata pre-filtering ACL fields on each chunk; filter applied before vector search Most enterprise knowledge bases Only as fresh as the last permission sync
Post-filtering Retrieve top results, then drop unauthorized ones Quick prototypes only Thin results and easy to bypass
Separate indexes One index or namespace per tenant, unit or clearance level Multi-tenant SaaS, strict data residency No per-document sharing; duplicated storage
Fine-grained authorization Authorization service checks relationships and attributes per document Complex, fast-changing permissions Another service to run and keep in sync

Best Tools for RAG Authorization

The best tool for you depends mostly on where your documents and identities already live. Here are the main options enterprises use today.

Azure AI Search (Microsoft stack)

Azure AI Search supports document-level access control in several ways. Security filters are generally available and work with any identity system. Native Microsoft Entra ACL and RBAC enforcement, SharePoint permission ingestion and Microsoft Purview sensitivity labels are available in preview. It's a strong fit if your content lives in SharePoint, OneDrive or Azure Data Lake.

Amazon Bedrock Knowledge Bases (AWS stack)

Bedrock Knowledge Bases uses metadata filtering to pre-filter the vector store before retrieval. Be careful here: AWS's own documentation says its ACL-aware filtering is not a security boundary. Its reference architecture adds a second layer with Amazon Verified Permissions for defense in depth.

Auth0 FGA and OpenFGA (any stack)

Auth0 Fine-Grained Authorization applies relationship-based access control (ReBAC). It checks every document against your permissions before it reaches the model. It's built on OpenFGA, an open-source CNCF project you can self-host if you'd rather not depend on a vendor.

Vector databases with metadata filters

Pinecone, Qdrant, Weaviate, Elasticsearch and Postgres with pgvector all support filters or namespaces. They give you the building blocks for pre-filtering. Your team still has to sync permissions and build the filters.

Custom permission-aware RAG

What if your content spans SharePoint, Salesforce and a ticketing tool at once? Then no single product covers it. You'll need a custom ingestion pipeline that maps every source's permissions to one identity model. That is the work our RAG knowledge base search service is built for.

One gap you'll notice in most "best tools" lists: they compare features but ignore permission sync speed. Before you choose, ask each vendor how quickly a removed permission stops affecting answers.

How to Implement RAG Access Control: Step-by-Step

This eight-step order lets you ship a secure pilot first, then tighten controls as you add sensitive sources.

  1. Map your sources and their permission models. List every system the assistant will read, who owns it and how it grants access: users, groups, sharing links or roles.
  2. Classify sensitivity. Tag each source as public, internal, confidential or restricted. Start your pilot with public and internal content only.
  3. Connect one identity provider. Resolve every user and group to a single ID from Entra ID, Okta or Google Workspace, including nested groups.
  4. Capture ACLs at ingestion. Store allowed users, groups and tenant on every chunk, not just on the parent document. Give connectors least-privilege access, never tenant-wide read rights.
  5. Filter before ranking. Build the retrieval filter from the signed-in user's identity and apply it inside the vector or hybrid query.
  6. Keep permissions fresh. Sync access changes on events, or every few minutes for sensitive sources. Add a live check before answering from restricted content.
  7. Log every decision. Record the user, query, retrieved document IDs and authorization result, so security can audit any answer.
  8. Test for leaks before launch. Create test users with different roles. Ask questions that target restricted documents, and fail the release if any restricted content appears.

How long does this take?

A single-source pilot on one identity provider is usually the quickest path. Each extra source adds work, because every system models permissions differently. Plan time for step 1. Teams that skip the mapping often rebuild the ingestion pipeline later.

Not sure where your data and permissions stand today? An AI readiness assessment maps your sources, owners and risks before you write any code.

Common Pitfalls and Fixes

Most RAG leaks come from a handful of repeat mistakes. Here's what to watch for and how to fix each one.

  • One service account for every query. The retriever sees everything, so every user inherits that access. Fix: pass the signed-in user's identity into each retrieval call.
  • Letting the LLM enforce permissions. A prompt is not a security control. Fix: filter in code before any content reaches the model.
  • ACLs on documents but not on chunks. Chunks get separated from their parent and lose the permission tag. Fix: copy the ACL fields onto every chunk at ingestion.
  • Ignoring nested groups and sharing links. People often get access through a group inside a group, or an "anyone with the link" share. Fix: resolve effective permissions at ingestion, not just direct ones.
  • Syncing permissions too rarely. A nightly sync leaves a full day where removed users still get answers. Fix: sync on change events, and add a live check for restricted sources.
  • Forgetting caches, logs and citations. A cached answer or citation link can show restricted content to the next person who asks something similar. Fix: scope caches per user or group, and check access again before showing a citation.

Notice a pattern? Every fix moves the decision out of the model and into code you can test. If a control can't be tested, assume it will fail. For agent-specific risks, see our guide to governance and control in AI agent systems.

Real-World Case Examples

These four examples come from public engineering write-ups. Each shows a different way teams solved the same problem.

Microsoft: carrying SharePoint permissions into Azure AI Search

A Microsoft engineering team needed to expose a customer's SharePoint content through AI search and Copilot extensions without overexposing sensitive files. Granting the app tenant-wide read access was the common shortcut, and they rejected it.

Instead, they used least-privilege site access and wrote each document's allowed users and groups into the search index at ingestion. The lesson: authorization ran before results were returned, and the same pattern worked for both RAG and Copilot.

AWS: one RAG app for many departments

An AWS reference design serves several departments from a single Amazon Bedrock knowledge base. Staff see only their department's material, while executives can see across departments.

Amazon Verified Permissions evaluates access at retrieval time as a second, independent layer. Access rules can change in minutes without redeploying code, and every decision is logged for audit.

Amazon Quick: live checks on top of pre-filtering

AWS also added real-time ACL checks to Amazon Quick and Bedrock Knowledge Bases. Pre-retrieval filtering narrows results first. Then permissions are verified with the source system at query time, which closes the gap left by stale syncs.

A compliance copilot that fails its own build

An engineer building "Atlas", an enterprise copilot for a compliance domain, put the access check inside the retrieval query itself. Results are filtered by the caller's verified clearance before ranking.

The team also wrote an automated test that fails the build if anyone breaks that rule. It's a cheap habit worth copying: your leak test runs on every release, not just at launch.

Methodology

We built this guide from search data, primary documentation and published security research. Here's how.

Tools used

  • Google Search Console and WebCEO, to find the exact questions people search about RAG authorization
  • Vendor documentation portals from Microsoft, AWS and Auth0
  • Published security research and analyst reports

Data sources

  • IBM's Cost of a Data Breach Report for breach cost and AI access-control figures (2025, IBM)
  • Gartner's Microsoft 365 Copilot survey findings on oversharing delays (2024, Gartner)
  • The OWASP Top 10 for LLM Applications for risk categories (2025, OWASP)
  • Microsoft Learn, AWS documentation and Auth0 documentation for tool capabilities
  • Public engineering write-ups for the case examples

Data collection process

We started with real search queries that already lead people to RAG security content. We then reviewed each vendor's current documentation and checked feature status, such as general availability versus preview. Statistics were taken from the original publisher's page or press release, not from secondary summaries.

Limitations and verification

  • Preview features change quickly. Check the vendor's documentation before you design around one.
  • Vendor documents describe capabilities, not independent benchmarks. We did not run performance tests.
  • Case examples come from public write-ups, so they share lessons rather than private business results.

Every statistic in this guide was checked against its primary source before publishing.

Conclusion: Secure Your RAG Before You Scale It

RAG access control decides whether your AI assistant is a productivity tool or a data leak. Capture permissions at ingestion, filter before ranking, keep access lists fresh and test for leaks on every release. Pick tools that match where your data already lives, and add fine-grained authorization when permissions get complex.

Unicode AI builds permission-aware knowledge base search with RAG, enterprise search that replaces keyword search and internal chatbots trained on company knowledge, with your existing permissions enforced from day one.

Ready to roll out AI search without the data risk? Book a permission-aware RAG pilot call with our team.

Frequently Asked Questions

What is RAG access control?

RAG access control is the set of rules and filters that make a retrieval-augmented generation system return only content the asking user is allowed to see. It is enforced at retrieval time, before any document reaches the language model.

What are the best tools for RAG authorization?

Azure AI Search suits Microsoft environments, Amazon Bedrock Knowledge Bases with Amazon Verified Permissions suits AWS, and Auth0 FGA or open-source OpenFGA work with any stack. Most vector databases also support metadata filters for building your own permission layer.

Which platforms enforce per-user permissions for RAG retrieval?

Azure AI Search can enforce Microsoft Entra-based document permissions (in preview) and security filters (generally available). Amazon Bedrock Knowledge Bases supports ACL-aware pre-retrieval filtering for Amazon S3 sources. Auth0 FGA checks each document against the user's relationships before generation.

Is pre-filtering or post-filtering better for RAG security?

Pre-filtering is safer. It removes unauthorized chunks before ranking, so they can never reach the model. Post-filtering drops results after retrieval, which can return too few answers and is easier to bypass by mistake.

Can a RAG chatbot respect SharePoint permissions?

Yes. The ingestion pipeline reads each file's SharePoint permissions and stores them with the indexed content, and queries are filtered by the signed-in user's Entra ID identity and groups.

Is role-based access control (RBAC) enough for RAG?

RBAC works when access follows a few clear roles. When access depends on project teams, folder sharing or client relationships, relationship-based (ReBAC) or attribute-based (ABAC) control fits better.

Ready to Transform Your Business with AI?

Let's discuss how our AI solutions can help you achieve your goals. Contact our team for a personalized consultation.