OXYNE PLATFORMAgentic Security
Back to Blog
Blog

AI Agent Tenant Isolation: Security Testing for Multi-Tenant SaaS

Test multi-tenant AI agents for cross-customer leakage across authentication, RAG, memory, tools, caches, files, logs and delegated actions.

Multi-tenant SaaS applications have spent years refining customer isolation. AI agents can accidentally route around those controls by combining broad service credentials, model-selected identifiers, shared retrieval indexes and persistent memory. A correct login at the chat interface does not prove that every downstream call remains inside the tenant.

Tenant isolation testing must follow the complete workflow—from authenticated session to retrieval, tools and final effect. This guide provides a practical method using synthetic tenants and evidence.

Define the tenant boundary

Document how tenant identity is established, propagated and enforced. Include organization, workspace, project, account and subtenant relationships. Identify trusted sources for tenant context at each layer.

Map every shared component: model gateway, RAG index, memory store, cache, MCP server, tool, database, file storage, queue, analytics and logs. Shared infrastructure is normal; shared authorization state is dangerous.

Record legitimate cross-tenant roles such as support or resellers. They need explicit policy and stronger evidence, not hidden exceptions.

Bind tenant server-side

Derive tenant from the authenticated session or trusted delegation. Do not accept a tenant identifier supplied only by the model. If a tool includes tenant or account as an argument, compare it with authoritative state.

Propagate tenant through queues and background jobs. Include it in cache and storage keys. Revalidate at the resource-owning service.

Test omission, substitution, mixed casing, alternate IDs and nested objects. Deny ambiguous requests rather than selecting a default tenant.

Retrieval isolation

Apply authorization before vector or keyword retrieval. Separate indexes where risk warrants it, or enforce tenant filters in trusted query construction. Do not ask the model to discard passages from other tenants after retrieval.

Test direct questions, semantic variants, aggregation, source metadata and repeated probing. Use unique canaries in each tenant. Check citations, filenames and counts as well as body text.

The RAG data-leakage guide provides an expanded methodology.

Memory and conversation isolation

Partition short-term and persistent memory by tenant, user and purpose. A conversation switch should not retain the previous customer's context. Summaries and embeddings need the same isolation as raw messages.

Test logout/login, account switching, shared devices, support impersonation and concurrent tabs. Attempt to retrieve another user's preferences, prior tool results and hidden summaries.

Role change and customer deletion should invalidate relevant memory access. The memory-poisoning guide covers persistence.

Tool and object authorization

An agent may use a broad service credential to call CRM, billing or ticket tools. Every downstream object must be authorized for the initiating tenant and user. Model-selected IDs are untrusted.

Test direct object references, list filters, exports, bulk actions and nested relationships. Confirm denial at the backend, not only a refusal in chat.

Separate support/admin tools from customer agents. Require current role and purpose, with auditable elevation.

MCP server isolation

Shared MCP servers should preserve tenant and user context through connection and tool calls. Tool discovery may itself vary by tenant. Server caches, sessions and temporary files must include tenant scope.

Test one tenant reusing another's session, approval or resource identifier. Attempt direct tool calls outside the managed host. Inspect logs for cross-tenant data.

Gateway policy helps but does not replace backend resource authorization. See MCP authorization security.

Files, exports and generated artifacts

Agents create reports, archives, images and code. Store artifacts under authoritative tenant ownership and use unguessable identifiers. Reauthorize downloads and shares.

Temporary files and object-storage URLs can leak across customers. Test expired links, predictable paths, thumbnails and background conversion services.

Ensure generated output does not include retrieved material from another tenant through cached prompts or examples.

Caches and batching

Semantic caches are risky when keys omit tenant, permissions, model or policy. A response generated for one customer must not be reused for another because the question looks similar.

Batching and request coalescing can mix context under load. Include tenant in every boundary and test concurrent traffic with distinct canaries.

Invalidate caches after access changes. Do not let a previously authorized result outlive the user's permission.

Logs and observability

Central logs contain multiple tenants by design. Restrict access, redact sensitive content and preserve tenant labels. Support dashboards should enforce the same authorization as production systems.

Test whether users can request traces, debug data or “why” explanations containing another tenant's content. Keep internal run IDs unguessable and reauthorized.

Correlate agent, user, tenant, tool and effect for investigation without exposing raw customer data broadly.

Support and administrative workflows

Support agents may have cross-tenant reach. Use just-in-time elevation, case binding, purpose limitation and session recording. Do not grant the AI agent every privilege held by human support.

Approval should identify customer and action. End elevation when the case closes. Detect unusual customer switching and bulk access.

Test forged case IDs, expired elevation and attempts to use support tools from a customer-facing agent.

Safe tenant-isolation testing

Create at least two synthetic tenants with distinct users, roles, documents, memory, tools and canaries. Include an admin/support role. Run:

  1. Cross-tenant object identifier substitution.
  2. Retrieval prompts for another tenant's canary.
  3. Session and account switching.
  4. Persistent memory reads and writes.
  5. Shared cache collisions.
  6. MCP session and approval replay.
  7. File, export and signed-link access.
  8. Concurrent requests and race conditions.
  9. Role revocation during active runs.
  10. Support elevation outside the bound case.
  11. Error, debug and observability disclosure.
  12. Indirect prompt injection requesting cross-tenant action.

Capture the downstream decision and data returned. A model refusal does not prove isolation if the tool already accessed the record.

Remediation priorities

Fix authoritative tenant propagation and backend object authorization first. Partition memory and caches. Reduce broad service identities. Remove model control over tenant fields. Add tests for every confirmed boundary failure.

Use defense in depth, but avoid duplicate weak filters that all trust the same model-supplied value. One trusted derivation and consistent enforcement are stronger.

Retest after changes to identity, retrieval, memory, tools, caches or support workflows.

Tenant-isolation checklist

  • Define every tenant and subtenant relationship.
  • Derive tenant from authenticated trusted state.
  • Propagate tenant through jobs, tools and storage.
  • Authorize before retrieval and object access.
  • Partition memory, caches and temporary files.
  • Reauthorize artifacts, exports and signed links.
  • Restrict support/admin elevation by case and time.
  • Label and protect logs by tenant.
  • Test concurrent and role-change scenarios.
  • Use unique synthetic canaries.
  • Verify backend denial and final effect.
  • Maintain regression tests for critical boundaries.

Frequently asked questions

Is a separate vector index required per tenant?

Not always. Shared indexes can be viable with correctly enforced trusted filters, but higher-risk environments may choose stronger physical separation.

Can the model enforce tenant boundaries?

No. Tenant and resource authorization must be enforced by trusted application and data services before content reaches the model.

What is the most common failure pattern?

A broad service credential combined with a tenant or object identifier selected from model-controlled input.

How should isolation be evidenced?

Use distinct canaries and show the authenticated identities, requested target, policy decision, tool response and whether any cross-tenant data moved.

Tenant isolation is credible only when every reachable layer agrees on the customer boundary. Continue with AI agent data-exfiltration testing, least privilege and complete-system threat modeling.

Make tenant context authoritative

Derive tenant identity from authenticated server-side state. Do not trust a model, URL parameter or tool argument to choose it. Where users belong to several organizations, require an explicit, validated active context.

Propagate tenant context through every service call, queue message, cache key and trace. Reject requests when context is missing or ambiguous. A global fallback is a cross-tenant incident waiting to happen.

Sign or integrity-protect internal task metadata where appropriate. Downstream services should independently authorize the requested resource rather than assuming the upstream agent checked it.

Test retrieval isolation deeply

Seed unique synthetic canaries in each tenant's documents, chunks, summaries and metadata. Query them from other tenants using exact text, paraphrases, partial identifiers and semantic descriptions.

Test empty, malformed and conflicting filters. Exercise hybrid search, autocomplete, citations, export and debugging endpoints. Verify that unauthorized candidates never reach reranking or model context.

Change document permissions and membership during active sessions. Check caches, embeddings and derived summaries after revocation. The vector database security guide provides a detailed retrieval plan.

Isolate memory and conversation state

Use tenant, user and run identifiers in memory keys and enforce them on the server. Test account switching, shared devices, session restoration and users removed from an organization.

Do not let a model choose which memory to read. Validate references and preserve the source identity of every memory write. Prevent summaries from combining records across tenants.

Delete or revoke access across primary memory, caches, backups and derived artifacts according to documented policy. Use canaries to verify behavior rather than assuming a database deletion reached every layer.

Secure tools and background work

Every tool should receive trusted tenant context and authorize the target resource. Test direct object references, bulk operations and endpoints that use a service credential.

Queued jobs must retain tenant identity and permission state. Decide whether execution uses authority at scheduling time or re-validates at execution time. For high-impact actions, stale authority should not survive indefinitely.

Confirm that retries, webhooks and callbacks cannot lose tenant context. Separate external destinations and credentials where consequence warrants stronger isolation.

Review administration and support access

Internal consoles, impersonation and support tools are common bypasses. Require strong authentication, scoped roles, purpose and auditable access. Display the active tenant prominently to reduce operator mistakes.

Test whether support identities can ask the agent to cross boundaries indirectly. Restrict bulk search and export. Require additional review for highly sensitive tenants or actions.

Break-glass access should expire, generate alerts and receive retrospective review. It must not become the normal route around an inconvenient permission model.

Prevent cache and observability leaks

Include tenant identity in response, retrieval and tool caches. Test collisions, normalization differences and anonymous-to-authenticated transitions. Do not share model context caches across incompatible access scopes.

Logs and traces need tenant-aware access control too. Central observability can become the easiest place to search every customer's prompts and records. Redact secrets and restrict raw content.

Validate analytics exports and support bundles. Aggregation should not expose small groups or identifiable text unintentionally.

Exercise lifecycle changes

Test tenant creation, migration, merger, suspension and deletion. Confirm that identifiers are never recycled into access to historical data. Validate region moves and backup restoration.

When a user changes organizations, terminate or reauthorize active sessions and delegated jobs. Rotate tenant-specific secrets after suspected compromise.

Document residual retention in backups and legal holds. Product promises should match technical behavior and contractual obligations.

Prove isolation with evidence

A finding should show initiating identity, expected tenant, requested resource, applied filters, retrieved context, tool arguments and observed effect. Record component versions and timestamps.

Distinguish an identifier leak from content disclosure and completed cross-tenant action. All matter, but their severity and remediation differ.

Retest from multiple paths after the fix. Keep cross-tenant canaries as continuous regression signals and alert immediately if any appears outside its authorized scope.

Set an isolation assurance cadence

Run canary tests after changes to identity, retrieval, caching, memory, tools and analytics. Schedule deeper cross-tenant reviews for high-impact systems even when releases are quiet.

Track every exception that uses global or support-level access. Require an owner, purpose, monitoring and expiry. Review whether a tenant-specific design can replace it.

Share evidence with enterprise buyers at the right level: architecture, test method and remediation process without exposing customer data or claiming absolute isolation.

Final review questions

Does every request carry trusted tenant context through APIs, queues, retrieval, memory, tools and logs? Do missing or conflicting identifiers fail closed? Can support or administrative paths bypass the same boundary?

Test membership changes, session restoration, cache invalidation, tenant deletion and backup recovery. Verify results with unique canaries and structured authorization evidence, not only model responses.

Finally, inspect third-party connectors and analytics sinks for equivalent isolation. Record any shared infrastructure and its controls. Tenant assurance is only as strong as the least isolated reachable component in the complete workflow.

Keep reading

September 25, 2026

Vector Database Security for RAG: Isolation, Access and Poisoning

A practical guide to securing vector databases used by RAG systems, including tenant isolation, ingestion controls, authorization, poisoning tests and evidence.

Read article
September 25, 2026

RAG Poisoning Security: How Malicious Documents Manipulate AI Agents

Understand and test RAG poisoning across document ingestion, retrieval, prompt injection, metadata, agent tools, memory and source remediation.

Read article