SysArt
Book a briefing
SysArt

Private LLMs and RAG

Policy-Enforced RAG Boundaries for On-Premises AI

How to enforce access boundaries in on-premises RAG: knowledge zones, classification at ingestion, permission-aware retrieval, answer rules and boundary tests.

Last reviewed by SysArt AI Architecture Team6 min readHow we review

In short

Policy-enforced RAG boundaries make retrieval respect who is asking and why. Documents are classified and tagged at ingestion, retrieval filters candidates by the user's entitlements before ranking, and the answer layer applies citation, redaction and refusal rules. Prompt instructions are not an access control: enforcement belongs in code, policy engines and the data stores themselves.

Key takeaways

  • A RAG assistant is only as safe as the retrieval boundary beneath it; prompt instructions cannot stop a model from using what it has been given.
  • Define a small number of knowledge zones aligned with your existing classification policy, make ownership and classification metadata mandatory at ingestion, and quarantine documents without it.
  • Filter by entitlement before similarity ranking, using attributes of the user, the data and the request, evaluated by a policy engine outside the model.
  • Reflect zones in storage as well, through separate collections, databases or row-level security, so that one code change cannot collapse them.
  • Test boundaries in the release pipeline with queries that must not return restricted content, and log which zones and passages every answer used.
Network servers connected with cables inside a data center

Why do private RAG projects fail at the boundary layer?

Because they put every document into one shared index and rely on prompt instructions to keep the assistant in line. If the same index holds engineering runbooks, contract redlines, payroll procedures and internal investigation notes, similarity search will sooner or later return a passage the user should never see. An innocent question about the latest escalation process should not pull text from a legal hold archive or an HR case file just because the wording happens to be similar.

The OWASP Top 10 for LLM Applications 2025 names this risk. Its entry on vector and embedding weaknesses (LLM08) warns of cross-context information leaks in multi-tenant environments, where several classes of users or applications share the same vector database, and recommends fine-grained access controls and permission-aware vector and embedding stores.

In a regulated environment, the practical question is not whether the model can answer, but whether this model may see and combine these sources, for this request, for this person. That makes retrieval boundaries a policy problem, not only a search problem. Designing them up front avoids the re-engineering that follows when the first audit or access complaint shows that the knowledge layer has no meaningful separation.

How should you define knowledge zones?

Start from the information classification policy you already have rather than inventing a new scheme. Many organisations work with three or four levels, for example:

  • Public: approved marketing material, product documentation and published policies.
  • Internal: operating procedures, architecture standards and team playbooks.
  • Restricted: contract terms, pricing rules, investigation records and confidential project material.
  • Regulated: data that needs stricter handling because of privacy, export control, safety or sector rules.

Zones should shape the pipeline, not live only in a spreadsheet. Make metadata mandatory at ingestion: business owner, classification, region, retention rule, approval status, categories of personal data and permitted audiences. When a document arrives without it, quarantine the document instead of sending it to a default index, because unclassified content in a shared index is exactly how boundaries erode.

Then reflect the zones in the infrastructure: separate storage locations, separate collections or indexes, and separate databases for the most sensitive zones. If the only control is a filter inside one service, a rushed code change can undo it; if the boundaries also exist in storage and access policies, mistakes become easier to detect and harder to deploy. Our post on data classification frameworks for enterprise AI covers the classification side.

Where should policy be enforced in a RAG pipeline?

At three points: ingestion, retrieval and answer generation. No single control is perfect, so each layer limits the damage when another one fails.

1. Ingestion. Every incoming file should pass malware scanning, text and metadata extraction, classification, metadata validation and chunking that keeps each chunk linked to its source document. Extraction toolkits such as Apache Tika, which detects and extracts text and metadata from more than a thousand file types, are a common building block. The essential rule is that every chunk inherits its document’s owner and classification; a passage cut from a restricted PDF must not become an orphaned vector without policy context.

2. Retrieval. Filter by entitlement before ranking by relevance. Candidate sources are narrowed by the user’s role, region and tenant and by the purpose of the task, and only then does similarity search rank what remains. This is attribute-based access control, which NIST SP 800-162 defines as authorisation determined by evaluating attributes of the subject, the object, the requested operation and, in some cases, the environment against policy. A policy engine such as Open Policy Agent (OPA) keeps those rules out of application code: it decouples policy decisions from enforcement, takes structured input such as JSON, and expresses policies in its Rego language.

Enforce the result in the data store as well. With pgvector, PostgreSQL row-level security restricts rows per user and denies access by default once enabled, but superusers, roles with BYPASSRLS and normally table owners bypass it, so the retrieval service must connect with a restricted role; our post on vector database architecture covers the other engines. A finance analyst and a site reliability engineer may both ask about incident response, but they should not search the same collections. Search scope is part of access control.

3. Answer generation. Even after filtered retrieval, the answer layer should enforce citation rules, redaction, refusal and tool permissions. If the approved sources cannot support a grounded answer, the assistant should say so rather than improvise; if an action would export restricted material, it should stop at a summary or require approval. Do not lean on the system prompt for any of this: OWASP’s entry on system prompt leakage (LLM07) says the system prompt should not be used as a security control and that authorisation checks must not be delegated to the model. Our post on prompt injection defences for on-premises RAG covers the attacks that make this necessary.

What does this look like in a mixed-sensitivity organisation?

Take, as an illustration, a manufacturer that wants one private assistant for plant operations, procurement, legal and central IT. A durable design places plant manuals, maintenance procedures and approved troubleshooting guides in an internal operations zone; supplier contracts and negotiated service terms in a restricted commercial zone; and employee records and incident investigation files in a regulated zone with separate approval requirements. The same identity can exist across zones, but an assistant session does not automatically inherit access to all of them.

The front end passes the user’s token, business context and task type to an orchestration service, which resolves the eligible zones before any search runs. An engineer troubleshooting a packaging line can search plant procedures, known issues and approved vendor manuals, but not dispute correspondence with that vendor or notes from an HR review. If a question crosses a boundary, the workflow can ask the user to narrow it, route it to a more controlled assistant, or open a human review.

The same design makes auditing credible. Security and compliance teams can see which zones were queried, which passages were returned and which citations the user saw, which shows that knowledge access is deliberately constrained and observable.

How do you keep boundaries intact over time?

Boundaries need operating discipline as well as architecture:

  • Entitlement reviews, so zone access follows actual responsibilities as people change roles.
  • Ingestion exception reports, showing how much content is quarantined, misclassified or missing an owner.
  • Boundary tests in the release pipeline: queries from test identities that must not return restricted passages, plus marker documents seeded in restricted zones that should never appear in a lower-zone answer. If these tests are not release gates, they will be skipped under delivery pressure.
  • Immutable retrieval logs. OWASP recommends detailed, immutable logs of retrieval activity so that suspicious behaviour can be detected and handled promptly.
  • Exercises for AI-specific failures: a restricted document tagged as internal, a service account given broad search access during an incident and never reduced, or an assistant connected to a tool that can email summaries. Document compensating controls and check that alerts and rollback work.

The AI governance checklist helps assign owners for these reviews.

Does on-premises hosting make RAG compliant?

No. Hosting the stack on-premises simplifies questions about where data goes, but it does not by itself provide access control, data minimisation or accountability. Those come from zones, metadata, policies and enforcement designed together, and from evidence that they work. Our guide to GDPR-compliant LLM deployment covers the data protection side, and our enterprise RAG page describes how SysArt implements permission-aware retrieval on infrastructure the client controls.

Featured image by Fabio Sasso on Unsplash.

Frequently asked questions

Why is prompt-based access control not enough for RAG?

Because the model cannot be relied on to withhold what it has been given. The OWASP Top 10 for LLM Applications states that the system prompt should not be used as a security control and that authorisation must not be delegated to the model, and prompt injection can override instructions. Enforce access before retrieval, in code and in the data stores, so restricted passages never reach the model.

What is permission-aware retrieval?

Retrieval that filters candidate passages by the requesting user's entitlements before ranking them by relevance. OWASP lists vector and embedding weaknesses as LLM08 in its Top 10 for LLM Applications, warns of cross-context leaks where several classes of users share one vector database, and recommends fine-grained access controls and permission-aware vector stores. The filter must come from the authenticated identity, not the client.

Should each knowledge zone have its own vector index?

For the most sensitive zones, usually yes: separate collections or databases make it hard for one faulty query to cross a boundary. For many small groups, a shared index with server-side filters is easier to run. If you use PostgreSQL with pgvector, row-level security denies access by default once enabled, but superusers, roles with BYPASSRLS and normally table owners bypass it.

How does attribute-based access control apply to RAG?

NIST SP 800-162 defines attribute-based access control as authorisation determined by evaluating attributes of the subject, the object, the requested operation and sometimes the environment against policy. In RAG, those are the user's role and location, the document's classification and owner, the task, and conditions such as time or device. A policy engine such as Open Policy Agent evaluates them outside the application.

How do you test that RAG boundaries hold?

Add boundary cases to the release pipeline: questions from test identities that must not retrieve or reveal restricted passages, including attempts through rephrasing or instructions hidden in documents. Seed marker documents in restricted zones and alert if one ever appears in a lower-zone answer. Review retrieval logs for cross-zone access, and run exercises for mis-tagged documents and over-privileged service accounts.

Related insights

Plan your private AI with people who build it

Book a briefing. We look at your use case, data and constraints, and you leave with the deployment options and governance steps that fit.