📍 Dhanmondi, Dhaka-1205🇧🇩 বাংলা

Permission-Aware RAG: Access Checks Before Answers

Permission-aware RAG means retrieving and sharing only the source material the signed-in user is authorised to read. The permission check belongs in the application and retrieval path before private content enters model context; a prompt telling the model to “respect access rules” is not an access-control system.

When I review this design, I start with a less glamorous question than answer quality: what does the system return to the person who must not see the document? A convincing answer for an authorised user is only half of that test.

What is permission-aware RAG?

Permission-aware retrieval-augmented generation is a design in which the system checks the current caller's access rights while selecting source documents and assembling model context. The answer, citations and related outputs are restricted to authorised material, instead of relying on the language model to conceal documents that were already supplied to it.

Ordinary RAG searches a collection and uses selected passages to ground an answer. Permission-aware RAG adds an explicit question to that process: which passages may this user see, in this organisation, for this request?

The distinction matters even inside one company. A shared search index can contain public guidance, team procedures and restricted employment records without making those categories interchangeable.

For the underlying indexing and answering pipeline, read my practical introduction to RAG. This guide focuses on access boundaries, permission changes and the tests that demonstrate those boundaries.

Folders and a calculator on an office desk, illustrating documents that need a defined access scope
Illustrative photograph. Photo: Jakub Zerdzicki / Pexels

Where should the permission boundary sit?

Draw the path from the browser to the source system before choosing a vector database. Include the identity service, application, retriever, model provider, cache, logs and any export feature.

A boundary that exists only in the user interface is easy to bypass. Hiding a menu option does not stop a direct API request, and filtering a finished answer does not undo private text already sent to a model service.

My organising rule is simple: every route that can move source material needs an authorisation decision. That includes answer generation, document previews, citations, conversation history, downloaded reports and background jobs.

This does not mean every component needs an independent policy language. It means the application must know which trusted service makes the decision and how each output uses that decision.

Place the cache beside that diagram rather than outside it. A perfectly filtered search can still leak information if the application serves another person's cached answer before running the access check.

How do you establish who is asking?

Start with an authenticated identity from your normal identity system. Validate the relevant token or session on the server, then resolve the organisation and access context through trusted application logic.

Do not accept a request field such as is_hr=true as proof that someone belongs to HR. The same applies to group identifiers copied from the browser, a role written in a prompt or a tenant name supplied as ordinary text.

Keep application access and document access distinct. A service account may be allowed to query the index, while the employee using that service is allowed to read only a subset of its contents.

Microsoft's document-access guidance makes this distinction explicit for its supported patterns. Its simpler security-filter approach compares strings; the application still has to supply trustworthy identity information and enforce the surrounding security boundary.

Decide what happens when that information is missing. I would return a controlled access error or an answer limited to a separately defined public collection, rather than quietly querying the full private index.

Which permissions should travel with a document and its chunks?

Indexing creates another representation of the source. If access rules stay only on the original file while its extracted passages become globally searchable, the ingestion pipeline has lost an important part of the document.

Define a small metadata contract for every indexed object. At minimum, the application should be able to identify the source document, its organisation or security partition, its permission information and the version of that information.

Those field names are design choices, not a universal API. A relational policy lookup, group-based access list or managed permission integration can implement the same requirement with different storage.

MetadataWhy it existsWhat to test
Source document identifierConnect a chunk to its authoritative recordEvery chunk resolves to the correct source
Organisation or partitionPrevent accidental mixing of separate customersMissing or conflicting values are rejected
Access rules or policy referenceDecide which callers may receive the contentAn empty value does not silently mean public
Permission version or update markerDetect stale access informationA revoked document is handled during refresh
Source title and locationProduce useful authorised citationsA denied source does not leak its title

Check the contract after chunking, not just before it. A transformation that preserves the text but drops the tenant or access field can turn a careful source connector into an unsafe index.

Apply the same review to extracted tables, images and attachments. Their permissions should follow the governing source rules rather than the convenience of the parser that happened to produce them.

How should retrieval apply the access rules?

Use a retrieval mechanism that can constrain results by the caller's authorised scope, or perform an appropriate authorisation step before any retrieved private material leaves the trusted boundary. The exact implementation depends on the engine and the source's permission model.

Where a search engine supports permission metadata or filters, understand what the filter actually does. Authentication, tenant partitioning and document membership are separate concerns; a filter string is not proof that all three have been solved.

For vector search, also check when filtering occurs. Some engines distinguish filtering before candidate selection from filtering after it, which can affect result completeness and recall.

Microsoft documents those differences for Azure AI Search's vector filter modes. Do not copy a setting from that product into another engine and assume the names or behaviour are equivalent.

Whatever the search mode, do not send rejected passages to the model and ask it to forget them. Keep unauthorised text out of the prompt, response payload and ordinary application logs.

A useful retrieval record can contain request identifiers, authorised source identifiers and a policy version without storing the complete private passages. Choose the minimum evidence needed to investigate access decisions and operate it under the organisation's retention policy.

What does the application contract look like?

The following is an architecture sketch, not runnable SDK code. The deliberately named functions stand for your authenticated identity service, permission system, retriever and output controls.

# Illustrative application flow; not a drop-in implementation.
caller = authenticate_request(request)
scope = resolve_trusted_access_scope(caller)
require_valid_scope(scope)

candidates = retrieve_with_authorised_scope(question, scope)
context = authorise_and_select_context(candidates, caller, scope)
answer = generate_from_authorised_context(question, context)
return build_authorised_response(answer, context, caller)

The important part is the contract between the steps. A retrieval error must not trigger an unfiltered fallback, and a missing permission record must not become an invitation to let the model decide.

Keep the policy result tied to the request that used it. If different stages independently read mutable permissions without a defined consistency rule, a later output can use a different access assumption from the one used during retrieval.

This is where I ask for an explicit failure path in the design review. “The identity service timed out, so we searched everything and removed names afterwards” is not a graceful degradation strategy.

Two developers reviewing code together at a workstation, illustrating server-side authorisation review
Illustrative photograph. Photo: Mikhail Nilov / Pexels

How do permission changes reach the index?

Decide how a revoked document or removed group membership stops influencing answers. An access design is incomplete if it describes initial indexing but has no story for changes the following day.

Indexed permission metadata is a copy, and copies need synchronisation. The Microsoft document-access guidance retrieved on 9 November 2026 describes source-specific update mechanisms and limitations; check the exact connector and feature version before implementing it.

Write the propagation interval into the design rather than assuming that source changes become immediate search changes. Some environments can tolerate a short, defined update delay; others need a stronger check against the current source authority before delivering content.

For stricter boundaries, consider a current authorisation check on candidate source identifiers before assembling context, together with a defined response when the index's permission version is stale. That is an application design proposal, not a claim that every search service provides such a check automatically.

Revocation also affects cached answers and conversation history. A document removed from the index should not remain available through a cached summary that is shared with users who no longer have access.

Test additions as well as removals. Overly slow grants can be a service problem, but a fast grant is not evidence that revocation is equally fast or follows the same path.

How do caches, citations and exports become unexpected leak paths?

A cache key built only from the question can reuse a finance answer for someone outside finance. Include the relevant security scope in cache design, and invalidate or re-evaluate entries when that scope changes.

There is no universal list of cache-key fields. The required boundary may include organisation, caller or group scope, policy version, source version and the application mode that produced the answer.

Be careful with citations. A denied document's title, file path or excerpt can reveal information even if the final paragraph does not quote the body.

Document downloads and report exports need the same attention. Do not allow an otherwise protected conversation to create a publicly accessible file merely because the export service uses a separate route.

Conversation sharing needs an explicit audience as well. A colleague opening a shared link should not inherit the original author's private source permissions simply because the answer was generated earlier.

I would put these features into the same access-test plan as retrieval, rather than adding a vague “secure exports” line at the end of the project. They move the same information through a different interface.

Can a system prompt or a model-side refusal enforce permissions?

A prompt can guide behaviour, but it should not be the authority that grants access to private source material. The language model does not replace the application's authenticated identity and policy checks.

Retrieved documents can also contain instructions that conflict with the intended workflow. Treat those instructions as untrusted content, not as permission to retrieve another collection or reveal a restricted source.

My guide to prompt injection and containment covers that attack surface. Permission-aware retrieval limits what information is supplied; prompt-injection defences address how untrusted content might try to redirect the system.

Neither control makes the other unnecessary. An authorised employee can still ask an unsafe operational question, and a malicious document can still attempt to manipulate an answer inside an otherwise authorised collection.

Keep any consequential tool action behind its own permission and approval rules. Reading an approved procedure does not automatically authorise an assistant to change a database, send a message or alter an account.

What should a practical deny-test matrix contain?

Build synthetic documents and test identities before connecting sensitive material. Mark the fixtures clearly so nobody later mistakes their invented names, balances or internal projects for real business data.

For this example, imagine two separate organisations, each with a general team and a restricted personnel group. The fixtures are a test design, not a description of a customer deployment.

TestExpected boundaryEvidence to retain
Authorised user asks about an allowed documentRelevant answer with authorised citationCaller scope, selected document identifiers
General user asks for restricted personnel contentNo restricted passage, title or citation exposedDenied access decision and response
User from organisation A names a document in BNo cross-organisation contextPartition and policy decision
Browser submits a forged group listServer ignores untrusted access claimsVerified identity path
Chunk lacks permission metadataControlled exclusion or access errorIngestion and retrieval failure handling
Access is revoked after a cached answer existsOld cache does not bypass the new decisionRevocation and cache test results
Denied content is requested in another languageSame boundary appliesEnglish and Bengali test outcomes
Export or shared conversation is opened by another userOutput is checked for that audienceDownload and sharing authorisation trace

Run the tests through the actual API routes, not only through visible buttons. Direct retrieval, preview and export endpoints should be included, because a disabled button can hide an unprotected service.

Record failures as failures, including awkward partial failures such as a refused answer with a restricted filename in its citation list. The overall answer may look safe while a smaller field reveals the problem.

A team reviewing work together around a monitor, illustrating tests of document-permission boundaries
Illustrative photograph. Photo: cottonbro studio / Pexels

How can two test users expose a shared-cache mistake?

Use a deliberately synthetic personnel document containing a unique invented phrase, such as “violet otter rehearsal.” Give test user A access and deny test user B, while keeping the test organisation and question unchanged.

First ask A a question that requires that phrase and retain the selected source identifiers. Then ask B the same question after A's response has populated the cache, using B's own authenticated session rather than editing a user identifier in the request.

  1. Check that A receives only the authorised synthetic source and its citation.
  2. Check that B receives no restricted passage, title, snippet or download link.
  3. Repeat B's request through the API and export route, including a Bengali paraphrase.
  4. Revoke A's source access and repeat both the cached and uncached requests.
  5. Record the policy version, cache decision and selected source identifiers for each request.

This is a proposed acceptance exercise, not a report that a particular product passed it. The expected boundary is the absence of denied source material; an application may return a controlled refusal or an answer supported only by material that B can read.

The invented phrase helps trace the fixture, but its absence alone does not prove safety. Inspect citations, selected document identifiers and exported bytes as well, because a paraphrase can reveal the same information without repeating the phrase.

Keep the permission-revocation test separate from deleting the fixture. Deleting the source tests one update path; removing a user's grant while the document remains tests whether access decisions and cached outputs actually follow that changed permission.

How do you measure answer quality without weakening the boundary?

Measure retrieval relevance and access correctness separately. A test can be relevant but forbidden, authorised but irrelevant, or both authorised and useful.

That distinction helps when a permissions change reduces the available evidence. The system should admit that it lacks an authorised source rather than borrowing a better answer from a restricted collection.

Use the same question under different test identities and compare the selected source identifiers, not just the natural-language answer. Similar wording does not prove that the same documents were used, and different wording does not prove that a permission boundary held.

Include “no supported answer” cases in the evaluation set. A responsible refusal or a request for an authorised source is a valid product outcome, even though it looks less impressive in a demo than an elaborate guess.

For the operational trade-offs behind keeping business data under your control, see my guide to AI data sovereignty and control. Infrastructure location and document permission are related concerns, but one does not establish the other.

What should be ready before a permission-aware RAG release?

I would ask for a short evidence pack: an access model, an ingestion metadata contract, the query and context boundary, a revocation design, the deny-test results and the operating owner. Each should describe the actual implementation rather than a future aspiration.

Check product status carefully when choosing managed features. Microsoft's guidance retrieved on 9 November 2026 marks several native document-access integrations as preview and says preview features are not recommended for production workloads or covered by a service-level agreement. Verify the exact capability's status before choosing it.

  1. Confirm the source of authenticated user and organisation identity.
  2. Document access defaults, including missing or malformed permission metadata.
  3. Verify how source permissions reach every indexed chunk.
  4. Test retrieval, citations, conversation sharing, cache and exports.
  5. Demonstrate what happens when access is revoked and a dependency is unavailable.
  6. Assign the permission-sync alerts and incident response to a named role.

These checks are a proposed engineering review, not a certification or a claim of compliance with a particular law. Adapt them to the data, contracts and controls that actually apply to your organisation.

The practical next step is to build the denied case before polishing the answer. If permission-aware RAG cannot show what happens to the person who must not see a source, the reassuring demo is still missing its most useful test.

Frequently Asked Questions

Is a system prompt enough to protect private documents?

No. Use authenticated identity and application or retrieval authorisation before private source content enters model context; prompts are behavioural guidance, not a replacement for access enforcement.

Does a shared vector index mean every employee can read everything?

It does not have to, but the access design must explicitly constrain the documents and outputs each caller can receive. The existence of one index does not establish either isolation or permission enforcement by itself.

Are security filters the same as authentication?

No. A filter can compare stored metadata with a supplied value, while authentication establishes who the caller is; the application must connect the two through trusted logic.

What happens when someone loses access to a source document?

The system needs a defined revocation path for indexed permissions, cached answers and shared outputs. Test the actual propagation behaviour for your source and implementation instead of assuming the change is immediate.

Should citations be permission-checked too?

Yes. Titles, filenames, paths and snippets can reveal restricted information even when the answer body avoids quoting it.

Can I use a managed preview feature for a sensitive deployment?

Microsoft's guidance retrieved on 9 November 2026 says preview features are not recommended for production workloads and have no service-level agreement. Verify the exact feature's status and terms before choosing it; this article does not certify a preview for sensitive production use.

What is the first test to build?

Create an identity that must be denied a synthetic document, then test the full path through retrieval, answer, citation and export. That establishes a concrete boundary to preserve while improving answer quality.

Primary references

Review the design and evidence before the change

Contact me to discuss your Oracle or enterprise AI workflow and the evidence your team needs.

Discuss the workflow
Nasir Uddin Khan

Nasir Uddin Khan

Oracle DBA and IT consultant based in Dhaka, Bangladesh. Oracle databases, middleware, ERP and enterprise AI.

About the author
💬