Skip to content

Decision guide / RAG

Permission-aware RAG: access before retrieval

Preserve tenant and source permissions through retrieval, context assembly, caching and citations. Treat revocation and index freshness as part of the design.

A practical framework for an engineering decision.

The decision

Authorize the caller’s access before restricted content reaches the model, then preserve that decision through answer delivery and reuse. Tenant filters are only one layer. A complete design accounts for document ACLs, changing source permissions, caches, citations and the consequences of stale context.

  • Derive the caller and scope from trusted application context.
  • A fresh query can still use a stale permission snapshot.
  • Cached answers need access checks for the evidence they depend on.

The model is not the access-control layer

If a caller cannot read a document, the application should not pass its content to the generator and hope a prompt suppresses it. The access boundary belongs in the retrieval and application path. That includes snippets, document titles, metadata and citations when those reveal restricted information.

Authorization needs resource-level checks using trusted identity. The model may formulate a search query, but it should not define the authenticated user, group membership or tenant. Those values come from the application and its authoritative policy.[1]

Stages that need a permission contract
StageQuestion
IngestionHow are source IDs, versions and access metadata represented?
QueryWhich trusted principal and scope constrain the candidate set?
Context assemblyAre all selected passages currently permitted for this task?
AnswerDo claims and citations expose only permitted evidence?
Cache reuseDo the current caller and current source permissions still allow reuse?
RevocationHow quickly does a source change stop future disclosure?

A permission snapshot has an age

An index can enforce the permissions it knows while still holding an outdated view of the source. Microsoft’s Azure AI Search documentation explicitly describes source-specific synchronization behavior for native document-level access controls; some functionality is preview, and certain inherited permission changes require explicit refresh. These are product-specific details, not universal guarantees of immediate revocation.[2]

Define the freshness requirement for the data class. Options include current-source authorization at read time, a policy service that receives changes reliably, versioned access metadata with fail-closed behavior, or a documented exposure window where that is acceptable to the product owner. The design should not silently assume synchronization is instantaneous.

Deletion and revocation are different events but both affect reuse. Removing a document from an index does not remove its text from a previously generated answer, a conversation history or an observability system. List those derived stores and define their retention and access behavior.

Worked scenario: an answer survives a revoked source

A synthetic internal assistant answers a question using document D7 and caches the response. The cache records the source ID and version but is keyed only by the question. Later, D7 is restricted to another group. A different caller asks the same question.

Returning the cached answer immediately would bypass the updated source policy. The application should revalidate the answer’s evidence dependencies for the current caller, or invalidate the cached entry through a reliable permission-change mechanism. If access cannot be established, rebuild from permitted evidence or return an unavailable answer.

Cache record
FieldWhy it matters
Task/query identityIdentifies the work being reused without treating it as authority.
Tenant and applicable scopePrevents cross-tenant reuse.
Source IDs and versionsIdentifies the evidence dependencies.
Policy or access versionSupports freshness checks and invalidation.
Expiration and revalidation ruleDefines when reuse is allowed.

A user-specific cache key alone is not enough: the same user can lose access. A tenant-specific key alone is not enough when documents have different permissions inside the tenant.

Filter before selection, then validate the selected evidence

Where the search system supports it, apply tenant and access constraints while constructing the candidate set. This avoids giving restricted candidates to downstream ranking or generation components. If the architecture retrieves candidate identifiers first, it must still authorize before fetching or exposing content, including to a model-based reranker.

Filtering only after a small top-k retrieval can also damage quality: restricted items may occupy the candidate slots, leaving too little permitted evidence. Evaluate the retrieval behavior under realistic permissions, not only as an administrator who can see every document.

  • Use trusted principal and group information in server-generated constraints.
  • Validate source ownership and current access before assembling model context.
  • Keep citation resolution behind the same access rules as the source.
  • Treat summaries and derived chunks as dependent on their source permissions.
  • Fail closed when a required access decision cannot be established, according to the product’s defined policy.

Make revocation a test, not a diagram annotation

A permission test matrix
CaseExpected observation
Same query, different tenantsOnly each tenant’s permitted evidence is considered.
Same tenant, different rolesDocument-level restrictions remain effective.
Revocation after index updateFuture access follows the current source policy or documented freshness contract.
Revocation after answer cachingCached dependencies are revalidated or the entry is invalidated.
Direct citation accessRestricted content cannot be fetched through an alternate URL path.
No accessible answerThe system abstains without revealing that a hidden document supplies the answer.

Where it fits in the security design

Permission-aware retrieval is necessary for many enterprise systems, but it is not the complete security design. The product also needs appropriate handling of prompts, tools, external destinations, telemetry and model-provider data policy. A correctly filtered document can still contain hostile instructions.

A credible review states the authority source, enforcement points, synchronization behavior and tested failure cases. It does not declare an entire RAG product secure because a vector query contains a tenant filter.

Sources and scope

Technical references inform the cited statements. The decision frameworks and synthetic examples are TeqEngine’s editorial guidance.

  1. OWASP: Authorization Cheat Sheethttps://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html
  2. Microsoft: Document-level access control in Azure AI Searchhttps://learn.microsoft.com/en-us/azure/search/search-document-level-access-overview

Have a system like this in front of you?

We can scope a platform engagement directly, or begin with an architecture review when the next decision needs more evidence.