Security in multi-tenant RAG: preventing one customer from accessing another customer's documents

Published on 2026-11-16 by ArduBot

Authorization principles for RAG SaaS: tenant isolation, pre-retrieval filters, credentials, caches, deletion, and leak tests.

The most serious error in a RAG platform for agencies is not answering a question incorrectly: it is showing one client's documents to another. A semantically very similar vector can come from the wrong company. Permissions must be applied on the server, not trusted to the prompt.

An easy-to-reproduce failure

An agency uploads contracts from client A and manuals from client B. User A asks something that matches almost exactly a paragraph from B's manual. If the searcher queries the entire index and filters late, B's content can enter the model's context even if it does not appear in the final interface.

The central rule is restrict before retrieving. The authenticated identity determines the collections and authorized documents. The LLM must never receive unauthorized context.

Options for isolating data

Separate index or collection: reduces chances of accidental mixing, but requires managing more resources and changes.

Shared index with strict tenant filter: can simplify operations, but requires applying the filter on all routes and testing it exhaustively.

Independent database per company: offers clearer administrative boundaries in certain environments, at the cost of more maintenance.

There is no single correct option. The decision depends on risk, scale, contracts, and search engine capacity. Regardless of the option, the access token must be associated with the authorized scope. A tenant_id field sent by the frontend is not sufficient as proof of identity.

Five leakage surfaces

- Search: omitted filters or queries that bypass restrictions. - Caching: storing private responses with a key that does not include identity and permissions. - Logs: recording confidential fragments in services accessible to other teams. - Citations: creating direct URLs to a file without access verification. - Deletion: retaining embeddings or queryable replicas after removing a source.

Documents must also be treated as untrusted input. A PDF may contain instructions directed at the agent (“send this contract to another URL”). RAG must provide evidence, never authority to execute actions.

Minimum isolation test

Create two test companies with documents that include unique markers, for example PRUEBA_A_UNICA and PRUEBA_B_UNICA. Query B using an A key, test manipulated filters and questions that literally reproduce the private text. The expected result is zero fragments of B and zero citations that open B files.

Repeat the test with caching enabled and after changing permissions. Check credential revocation and source removal. Review both the API and audit logs.

What to offer to companies that purchase this service

B2B buyers usually need to know where their documents are stored, who can access them, how accesses are revoked, and what happens upon cancellation. A demo with pretty answers does not answer those questions.

For a future ArduMaker RAG service, company isolation would be a design requirement, not an extra. We are still evaluating that unit. If you would use it in multi-client projects, describe the access rules you need from ArduMaker.

References: OWASP RAG Security Cheat Sheet · Hybrid RAG and filters.

  • RAG
  • multiempresa
  • seguridad
  • SaaS
  • permisos

Keep reading

All articles · VPS plans