LIVEยทThe trends shaping tomorrow's world.
AI

Building Secure Enterprise RAG

A security blueprint for enterprise RAG: permission-aware retrieval, tenant isolation, embedding lifecycle and logging, mapped to OWASP 2026 and NIST.

Secure enterprise RAG means a retrieval-augmented generation system that only ever shows a user what that user is already allowed to see, treats every piece of indexed content and every vector as sensitive data, and limits what the model can do when something gets through. In practice that comes down to six design decisions: enforce permissions inside the retrieval query, isolate tenants and trust levels, manage the embedding lifecycle like the source data, keep secrets and authorization out of the prompt, control cost and outputs, and log enough to investigate. The OWASP Top 10 for LLM Applications 2026 and NIST's AI Risk Management Framework give you the vocabulary to govern it.

Where this fits

Our article on RAG security: prompt injection, data poisoning and guardrails covers the attacks that arrive through retrieved content and the guardrails against them. This piece assumes you know how RAG works and is about the system around that: the architecture decisions that make a RAG deployment safe to connect to company data. If you're building agents that act on retrieved content, read AI agent security and governance too.

The 2026 OWASP list, published in August 2026, puts several RAG-relevant risks in its top ten: Prompt Injection (LLM01), Sensitive Information Disclosure (LLM02), Data and Model Poisoning (LLM05), Unbounded Consumption (LLM06), Hidden Context Exposure (LLM08), Vector and Embedding Weaknesses (LLM09) and Improper Output Handling (LLM10) [1].

Why RAG changes the security model

A traditional enterprise search portal shows a list of links, and the user's browser fetches each document with the user's own credentials. If the user lacks access, the click fails.

RAG removes that safety net. The retriever reads the content on the user's behalf, a language model summarizes it, and the answer can blend text from many documents. If retrieval runs with a service account that can read everything, every user effectively inherits that service account's access. OWASP's 2026 entry on vector and embedding weaknesses puts it plainly: "Whenever similarity search sits between a data source and the prompt, the embedding layer becomes part of the application's trust boundary" [2].

NIST's Generative AI Profile makes the same point more broadly. It says generative AI "expands the available attack surface," since the systems are vulnerable to "attacks like prompt injection or data poisoning" [10].

Decision 1: Enforce permissions inside the retrieval query

This is the most important control, and the one most often done wrong.

Do: pass the end user's identity to the retriever and filter by that user's entitlements as part of the search itself. OWASP's 2026 guidance says to "enforce document- and chunk-level authorization inside the index query, not at the application layer after retrieval" [3], and to enforce tenant scoping "inside the index query, not as a post-retrieval filter," validated server-side [2].

Don't: retrieve the top results across everything and then drop the ones the user can't see. OWASP describes why this leaks even when nothing forbidden is displayed: if similarity search runs across the full index before access control, an attacker can infer "the existence, topic, and approximate volume" of other tenants' documents from result counts, score distributions and timing [2].

Don't: ask the model to withhold content. OWASP's 2026 entry on hidden context says authorization and privilege separation "must not be delegated to the LLM, whether through the system prompt or another mechanism" [4].

What this looks like in practice

Search platforms now document native mechanisms for this. Microsoft's Azure AI Search (now branded Foundry IQ) is one example, as of November 2026 [11]:

  • Security filters: your application stores user or group IDs on each document and passes the caller's identity as a filter string at query time. It works with any identity system.
  • Native ACL and RBAC filtering: permissions from sources such as ADLS Gen2 and SharePoint are ingested with the content, and the user's Microsoft Entra token is sent with each query so results are trimmed to what that user can read. Microsoft lists SharePoint ACLs and ADLS Gen2 ACL/RBAC as generally available with its 2026-10-01 API, and Purview sensitivity-label enforcement as still in preview (configured with the 2026-11-01-preview API).

Two details from that documentation apply to any platform:

  • Permissions must follow the chunks. If your pipeline splits documents into chunks, every chunk needs the parent document's permission metadata, or chunk-level results won't be filtered [11]. OWASP adds that "a mostly-public document can contain a confidential paragraph," so chunk-level control matters [2].
  • Permissions go stale. Indexed ACLs are snapshots. Microsoft's docs say permission refresh "doesn't provide immediate revocation or a corpus-wide freshness SLA" [11]. Decide how quickly a revoked user must lose access, and design re-sync accordingly. For high-sensitivity sources, consider checking the source system's permissions at query time.

Identity is the foundation here. If you don't yet have reliable user and group identities flowing to your applications, start with identity and access management.

Decision 2: Isolate tenants and trust levels

Separate by tenant. For multi-tenant products, OWASP recommends physically separated indexes per tenant or trust zone for high-sensitivity workloads [2]. Many vector databases offer logical partitions; Pinecone, for example, documents namespaces as the way to keep each tenant's data separate within one index [12]. Logical partitions are only as strong as the code that sets them, so set the partition server-side from the authenticated identity, never from a client parameter. OWASP's phrase: "A client-supplied scope is a suggestion, not a control" [2].

Separate by trust. Don't mix external web content, partner feeds and internal confidential documents in one index. OWASP's 2026 guidance says mixed-trust content "must not share an index without hard isolation," and that index-level segregation "beats classification tags on a shared index because it removes the misconfiguration path" [2].

Don't expose raw scores. Returning similarity scores or distances to clients can turn the index into a "membership oracle" that reveals whether a specific document exists [2]. Return results, not scores.

These choices echo zero trust architecture: assume any component can be misused, and grant each the minimum it needs.

Decision 3: Treat embeddings and indexes like the source data

It's tempting to think vectors are anonymous numbers. They aren't.

OWASP's 2026 entry reports that stored embeddings can be inverted to recover source text, citing published methods, including zero-shot techniques that don't need an inversion model trained for the original encoder. Its operational advice: treat vector-database backups, embeddings sent to third parties and embeddings exposed through misconfigured storage "as equivalent to a leak of the underlying documents" [2]. It describes a scenario where a leaked backup was first classed as low severity because "only the embeddings leaked," then reclassified as a source-document breach [2].

Lifecycle controls OWASP recommends [2]:

  • Deletion: delete embeddings within a bounded time when the source document is deleted, and verify with reconciliation audits.
  • Backups: give vector-store backups the same sensitivity tier as the source documents.
  • Encryption: encrypt embeddings at rest with keys managed separately from the application.
  • Model rotation: when you change embedding models, re-embed the corpus rather than mixing old and new vectors.
  • Keys: treat embedding-API keys as secrets; a leaked key gives an attacker query access to your exact encoder.

Govern what goes in. OWASP's sensitive-information guidance puts corpus governance first: track provenance and classification, deduplicate, and scrub personal data at ingestion [3]. Its vector-weakness entry adds normalizing content before embedding (stripping zero-width characters, white-on-white text and look-alike Unicode characters) and recording provenance for every embedding so a bad batch can be found and removed [2]. Our RAG security article covers poisoning defenses in more depth.

Decision 4: Keep secrets and authority out of the prompt

RAG prompts carry a lot of hidden context: system instructions, retrieved policy text, tool schemas. OWASP's 2026 list gives this its own entry, Hidden Context Exposure (LLM08), and advises designing "under the assumption that hidden context is discoverable" [4]. Its mitigations [4]:

  • Don't put credentials, connection strings, tokens or security-critical configuration in system prompts or retrieved context.
  • Enforce critical behavior, such as harmful-content filtering, with deterministic systems outside the model.
  • Enforce authorization independently of the LLM, and give each task only the privileges it needs.

The prompt injection entry draws the same line from the other side. Because models "make no architectural distinction between instructions and data," OWASP says no reliable prevention exists today and defense must be architectural: keep "credentials and state-change capability in application code, not the model," and grant least privilege per operation [5]. If your RAG system can also take actions, apply the "Rule of Two" that OWASP adopts from Meta AI: treat any agent that combines untrusted input, sensitive data and the ability to change state or communicate externally as high-risk, requiring per-action human approval [5]. See human-in-the-loop AI for approval patterns.

Decision 5: Control outputs and cost

Outputs. Model answers are untrusted input to whatever consumes them. OWASP's Improper Output Handling entry (LLM10) warns that passing unvalidated model output downstream can lead to cross-site scripting in browsers, server-side request forgery, privilege escalation or remote code execution [7]. Encode output before rendering it, validate structured output against a schema in application code, and never pass model text straight into a database query or shell [5][7].

Cost and availability. RAG multiplies cost per question: retrieval, reranking and long prompts full of context. OWASP's Unbounded Consumption entry (LLM06) highlights "large-context abuse," requests that stay just within limits while inflating cost, and recommends token-aware rate limits, pre-flight token estimation and hard spending caps that halt inference rather than just alert [6]. It also recommends per-user query budgets on sensitive endpoints to disrupt enumeration and membership probing [3].

Decision 6: Log, monitor and plan for incidents

You can't investigate what you didn't record. OWASP recommends immutable logs of retrieval activity, covering tenant scope, query, returned document IDs and similarity scores, and monitoring for tenant-filter bypass attempts, cross-tenant anomalies and unusual embedding-API volume [2]. Watch for new vectors that sit unusually close to many common queries, a sign of retrieval-hijacking content [2].

Balance that against privacy: scrub logs and traces before they reach observability tools, and classify and redact model reasoning traces like any other output [3]. Our explainer on observability vs monitoring covers the tooling side.

Update incident playbooks so that an "embeddings only" leak triggers the same breach assessment as a document leak [2]. US organizations should map this to their existing state breach-notification and sector obligations; OWASP cites GDPR Article 33 as an example for EU data [2].

The controls at a glance

Control

What it prevents

OWASP 2026

NIST AI RMF function

Authorize inside the index query, per chunk

Users seeing documents they can't access; cross-tenant inference

LLM02, LLM09 [2][3]

Manage

Server-side tenant scoping; separate indexes for high sensitivity

Cross-tenant leakage

LLM09 [2]

Manage

Separate indexes by trust tier

Untrusted content mixing with confidential

LLM09 [2]

Map, Manage

No raw similarity scores to clients

Membership inference

LLM09 [2]

Manage

Treat embeddings and backups as source-sensitive; deletion SLAs; encryption

Inversion leaks; zombie data

LLM09 [2]

Manage

Provenance, normalization and review at ingestion

Poisoning; hidden instructions

LLM01, LLM05, LLM09 [2][5]

Map, Measure

No secrets in prompts; authorization outside the LLM

Credential leaks; prompt-based bypass

LLM08 [4]

Manage

Least privilege; human approval for risky actions

Injection turning into action

LLM01 [5]

Manage

Output encoding and schema validation

XSS, SSRF, injection downstream

LLM10 [7]

Manage

Token budgets and hard spending caps

Denial of wallet; outages

LLM06 [6]

Manage

Immutable retrieval logs and anomaly detection

Undetected abuse

LLM09 [2]

Measure

Red-team retrieval and disclosure paths before release

Unknown gaps

LLM01, LLM02 [3][5]

Measure

The NIST column is our mapping, not NIST's.

Governing it with NIST AI RMF

NIST's AI Risk Management Framework, released in January 2023, is voluntary and organizes AI risk work into four functions [8][9]:

  • Govern: policies, accountability and culture. NIST calls it "a cross-cutting function that is infused throughout AI risk management" [9]. For RAG: who owns each data source connected to the system, who approves new sources, and who signs off on access-control design.
  • Map: establish "the context to frame risks related to an AI system" [9]. For RAG: inventory sources, classify data, note which sources are untrusted, and identify who will use the system.
  • Measure: use "quantitative, qualitative, or mixed-method tools" to assess risk [9]. For RAG: permission-leak tests (can user A retrieve user B's documents?), red-team results, and quality metrics from RAG evaluation.
  • Manage: allocate resources "to mapped and measured risks on a regular basis" [9]. For RAG: the controls in the table above, plus incident response.

NIST's Generative AI Profile (NIST AI 600-1, July 2024) adds generative-specific guidance; among its suggested actions, it asks organizations to consider data sources such as "grounding, retrieval-augmented generation" when identifying a system's intended purposes [10]. NIST says the AI RMF 1.0 is being revised as part of the White House AI Action Plan, so check for updates [8].

A build checklist

Before connecting a data source

  • Name an owner and classify the data.
  • Decide its trust tier and which index it belongs in.
  • Confirm you can ingest its permissions, or exclude it.

During ingestion

  • Carry document permissions onto every chunk.
  • Normalize text and record provenance for every embedding.
  • Scrub or exclude personal data the use case doesn't need.

At query time

  • Resolve the user's identity and entitlements server-side.
  • Filter inside the search; never post-filter a global result set.
  • Keep secrets out of the prompt; validate outputs before use.
  • Enforce token budgets and spending caps.

In operations

  • Log retrievals immutably; alert on cross-tenant and probing patterns.
  • Propagate deletions to vectors and backups within a set time.
  • Re-test permissions after every connector, schema or model change.
  • Rehearse an "embeddings leaked" incident.

Limitations

  • No control is complete. OWASP is explicit that prompt injection has no reliable prevention today [5]. Architecture limits the damage; it doesn't eliminate the risk.
  • Permission sync lags. Indexed ACLs trail the source system [11]. Very sensitive content may need live permission checks or exclusion.
  • Vendor features vary and change. Preview features can change; verify GA status and limits for your platform.
  • Frameworks don't build systems. OWASP and NIST tell you what to worry about; the engineering is yours.

Outlook

The 2026 OWASP list shows where attention is moving. Its vector and embedding entry adds risks the 2025 version didn't list, including retrieval jamming, membership inference and semantic-cache poisoning [2][13], and hidden context is treated as its own top-ten risk [4]. Search platforms are adding native permission filtering [11]. Expect permission-aware retrieval to become a default checkbox in enterprise search products, and the remaining work to shift to keeping permissions fresh and proving, through testing, that they hold.

Frequently asked questions

What is permission-aware retrieval?

Retrieval that filters results by the requesting user's access rights as part of the search query, so documents the user can't access never reach the model. OWASP recommends it at the document and chunk level [2][3].

Is post-filtering search results enough?

No. Filtering after a global search can still leak the existence and topic of restricted documents through result counts, scores and timing [2]. Filter inside the query.

Are vector embeddings personal data?

They can carry the same information as the text they came from. OWASP's 2026 guidance says embeddings can be inverted to recover source text and should be treated as equivalent to the source documents for breach purposes [2].

Should each customer get their own vector index?

For high-sensitivity workloads, OWASP recommends physically separate indexes per tenant or trust zone [2]. For lower-risk cases, logical partitions such as namespaces can work if the partition is set server-side from authenticated identity [2][12].

How does NIST AI RMF apply to RAG?

It gives a governance structure, Govern, Map, Measure and Manage, rather than specific controls [9]. Use it to assign ownership of data sources, map risks, test controls and manage them over time, and use OWASP for the technical risk list.

Sources

  1. OWASP GenAI Security Project. "OWASP Top 10 for LLM Applications 2026" (project README; published August 4, 2026). https://raw.githubusercontent.com/GenAI-Security-Project/GenAI-LLM-Top10/main/README.md
  2. OWASP GenAI Security Project. "LLM09:2026 Vector and Embedding Weaknesses." https://github.com/GenAI-Security-Project/GenAI-LLM-Top10/blob/main/2026/final/LLM09_VectorAndEmbeddingWeaknesses.md
  3. OWASP GenAI Security Project. "LLM02:2026 Sensitive Information Disclosure." https://github.com/GenAI-Security-Project/GenAI-LLM-Top10/blob/main/2026/final/LLM02_SensitiveInformationDisclosure.md
  4. OWASP GenAI Security Project. "LLM08:2026 Hidden Context Exposure." https://github.com/GenAI-Security-Project/GenAI-LLM-Top10/blob/main/2026/final/LLM08_HiddenContextExposure.md
  5. OWASP GenAI Security Project. "LLM01:2026 Prompt Injection." https://github.com/GenAI-Security-Project/GenAI-LLM-Top10/blob/main/2026/final/LLM01_PromptInjection.md
  6. OWASP GenAI Security Project. "LLM06:2026 Unbounded Consumption." https://github.com/GenAI-Security-Project/GenAI-LLM-Top10/blob/main/2026/final/LLM06_UnboundedConsumption.md
  7. OWASP GenAI Security Project. "LLM10:2026 Improper Output Handling." https://github.com/GenAI-Security-Project/GenAI-LLM-Top10/blob/main/2026/final/LLM10_ImproperOutputHandling.md
  8. NIST. "AI Risk Management Framework." Accessed November 2026. https://www.nist.gov/itl/ai-risk-management-framework
  9. NIST. "AI RMF Core (Section 5)." Trustworthy and Responsible AI Resource Center. https://airc.nist.gov/airmf-resources/airmf/5-sec-core/
  10. NIST. "Artificial Intelligence Risk Management Framework: Generative Artificial Intelligence Profile" (NIST AI 600-1), July 2024. https://nvlpubs.nist.gov/nistpubs/ai/NIST.AI.600-1.pdf
  11. Microsoft. "Document-Level Access Control - Foundry IQ (Azure AI Search)." Microsoft Learn, updated November 2026. https://learn.microsoft.com/en-us/azure/search/search-document-level-access-overview
  12. Pinecone. "Indexing overview." Accessed November 2026. https://docs.pinecone.io/guides/index-data/indexing-overview
  13. OWASP GenAI Security Project. "LLM08:2025 Vector and Embedding Weaknesses." https://genai.owasp.org/llmrisk/llm082025-vector-and-embedding-weaknesses/