Blog/AI Security

Tenant isolation for AI features in multi-tenant SaaS products

Prevent one customer's data from appearing in another customer's AI answers by isolating embeddings, caches, memory and fine-tuning per tenant.

By Sagar Makker · 7 min read · October 2026
Computer Code
In short
AI features add new shared stores: vector indexes, caches, memory and tuned models.
Enforce tenant ID at the data layer for every one of them, not only in the app.
Test cross-tenant isolation automatically on every release, as you would for the main database.
The problem

This is for founders and engineering leads of B2B SaaS products adding AI search, assistants or summaries. Your main database probably enforces tenant boundaries well. AI features quietly add new places where data lives: embeddings, response caches, conversation memory, evaluation sets and customised models. If any of these is shared without strict tenant scoping, one customer may see another's contracts or tickets in an answer. This post shows where cross-tenant leaks hide in AI features and how to close each one.

A SaaS company adds an assistant that answers questions over each customer's uploaded documents. Embeddings for all customers go into one vector collection, and the application adds a tenant filter at query time. A developer later builds a new summary endpoint, forgets the filter, and a customer's assistant starts quoting pricing terms from a competitor who is also on the platform.

Other leaks are less obvious. A semantic cache returns a stored answer because two tenants asked similar questions. Agent memory saves a fact from one customer's session into a shared profile. A model customised on pooled support tickets reproduces a phrase containing another customer's name. Each was built by a careful team that simply did not treat the AI layer as part of the tenancy model.

Why it happens
01Vector indexes are shared, with tenant filters applied only in application code
02Semantic or response caches are keyed on prompt text, not tenant and user
03Agent memory and conversation history are stored without tenant scoping
04Models are customised on pooled data from multiple customers
05No automated tests that try to read one tenant's data as another
How to fix it
1
Map every AI data store
The engineering lead lists each place AI features store or derive customer data: vector indexes, caches, memory, logs, evaluation sets, customised models and exports. Each entry records how tenant boundaries are currently enforced, if at all.
2
Enforce tenant scope at the store
Developers use per-tenant collections or namespaces, or row-level security in the vector store, so a query without a tenant context returns nothing. Do not rely on every endpoint remembering to add a filter.
3
Key caches and memory by tenant
The platform team includes tenant ID and, where relevant, user ID and permission set in every cache key and memory record. A cache hit must never cross a tenant boundary, even for identical questions.
4
Keep model customisation per tenant
Product and data owners agree that any fine-tuning, prompt libraries or examples built from customer data stay within that customer's scope, unless contracts explicitly allow pooled use. Check the current position with counsel.
5
Automate cross-tenant isolation tests
QA writes tests that create two tenants with distinctive marker data, then query every AI endpoint as one tenant and assert the other's markers never appear. These tests run on every release and block deployment if they fail.
Worked example
An HR software company's policy assistant

An HR software provider serving mid-sized employers built an assistant that answered employee questions from each employer's policy documents. Early on, all embeddings lived in one shared index with a filter added in the API layer, and responses were cached by question text to save cost. A security review flagged both. The team moved to per-tenant namespaces in the vector store, rebuilt the cache key to include tenant and role, and added nightly tests with planted marker phrases for two dummy employers. After the change, the assistant behaved the same for users, the team could show enterprise buyers a clear isolation design during security questionnaires, and two new endpoints added later were caught by the tests before release.

Common mistakes
×
Trusting a filter in application code
Every new endpoint is a chance to forget it. Push enforcement down to the store with namespaces or row-level rules so a missing filter fails closed instead of open.
×
Caching answers without tenant in key
Similar questions from different customers can return each other's answers. Always include tenant ID, and user permissions where answers vary by role, in the cache key.
×
Pooling customer data for model tuning
Models can reproduce training content. Keep customisation per tenant unless contracts and consent explicitly allow pooling, and confirm the position with your counsel first.
Where an AI agent helps
Input
AI endpoints, data store configs and two test tenants with marker data
Agent does
Runs cross-tenant queries on every AI endpoint and checks caches and memory for boundary breaches
Human gate
Engineering lead approves any release with an isolation test exception
Outcome
An isolation test report per release and a list of stores lacking tenant scope
Checklist
List every AI store that holds customer-derived data
Move vector data to per-tenant namespaces or row rules
Add tenant ID to every cache and memory key
Confirm contracts before pooling data for tuning
Plant marker data in two test tenants
Block releases that fail cross-tenant tests
What to measure
AI endpoints covered by isolation tests
Stores enforcing tenant scope at data layer
Isolation test failures caught before release
Cache entries missing tenant key
Questions
Should every tenant have a separate vector index?

Not always. Per-tenant namespaces or enforced row-level filters in a shared index can be sufficient. Separate indexes suit customers with strict contractual or regulatory needs. What matters is that a query without tenant context returns nothing.

Are AI logs also a tenant isolation risk?

Yes. Prompt and response logs contain customer data, so scope access by tenant, restrict who can search across tenants, and apply the same retention rules you use for the source data.

How do we explain our isolation design to enterprise buyers?

Prepare a one-page diagram showing each AI data store, how tenant scope is enforced, and how you test it on each release. Buyers' security teams respond well to specific controls and evidence rather than general assurances.

Can a shared base model leak data between tenants?

A base model you did not train on customer data does not hold tenant data itself. The risk comes from what you add: retrieval, caching, memory and customisation. Isolate those layers and the base model stays neutral.

Keep reading
All posts →
Cctv CameraAI Security
Prompt injection explained for business leaders, and how to reduce risk
5 min readRead →
Concrete WallAI Security
Keeping private documents private in RAG and AI search tools
5 min readRead →
Concrete WallAI Security
How to keep API keys and secrets out of LLM prompts and context
6 min readRead →
Next step

Want this fixed in your business?

Send the workflow. You get a scope and a fixed price within two working days — or a straight answer that it isn't a fit.

Secure by default · find → fix → verify · authorised scope only
Send a brief →enquiry@xdqlabs.com