// Knowledge systems · 3 min read

Multi-Tenant RAG Access Control: Filter Before the Model Reads

An answer can be polite and still leak another customer's information.

By Jamil Darwish ·

Enforce access before retrieval returns content. The model should receive only records the authenticated user may see. A prompt asking it not to reveal other tenants' information is not an authorization system.

Identify every possible disclosure

The answer text is not the only output that can leak data. Search snippets, document titles, filenames, citations and error messages can reveal restricted information. Include those surfaces in the access model.

A tenant identifier supplied by the browser is not sufficient proof of membership. Resolve identity and permissions through trusted server-side logic. Keep privileged service credentials out of public clients and avoid granting broader access merely to simplify search code.

Connect retrieval to the permission model

Supabase's RAG with Permissions guide provides one concrete reference. Whatever stack you choose, the retrieval query should enforce the intended visibility rules before candidate text reaches generation.

Do not search the full corpus and remove unauthorized results afterward in the prompt. The model and any intermediate logs may already have received the restricted content. Filtering must happen at the appropriate data boundary.

A worked two-customer test

Create synthetic tenants A and B with similarly named policy documents. Authenticate a test user for A and ask both a normal policy question and a question containing B's exact document ID. The system should not disclose B's title, snippet or content.

Then ask an indirect question that semantically matches B's distinctive policy. Exact-ID tests alone do not establish that vector retrieval is properly scoped. Test both keyword and semantic routes under the same restrictions.

Include citations and caches

A generated citation should not expose a private document to a user who cannot open it. Verify the destination's access checks independently of the answer UI. Avoid sharing a cached response across tenants merely because the normalized question text is identical.

Review logging and analytics as well. An otherwise correct answer flow can still copy restricted excerpts into a broad-access debugging tool. Collect the minimum operational detail needed to diagnose the system.

Test revocation and permission changes

  • Remove a user's access and repeat the previous query.
  • Move a document between visibility groups.
  • Check stale sessions and cached responses.
  • Attempt retrieval with a forged or missing tenant value.
  • Verify that background jobs preserve the same scope.

Record expected behavior for every case. A denied request should fail in a controlled way without confirming the existence of unrelated private records.

Keep permission tests as release gates whenever retrieval code, storage rules or model tooling changes. Multi-tenant safety is a property of the complete application path, not a feature that a more capable language model can supply on its own.

Sources and editorial scope

Researched and published 30 November 2026. Provider capabilities are attributed to official documentation; recommendations and worked examples are editorial analysis. No independent model benchmark or client outcome is claimed. Confirm current access, pricing and terms before implementation.

Download an AI starter skill · Explore the MCP directory

Build the useful version.

Discuss an AI workflow, knowledge assistant or digital-product brief with Jamil Darwish.

Start a conversation