Cover illustration for “Tenant Bleed Is a Product Bug Not an Infrastructure Problem”
Building With Agents

Tenant Bleed Is a Product Bug Not an Infrastructure Problem

November 19, 20268 min read1,853 words

Share

Text: Derek Tran

Cross-tenant leaks come from product design choices, and four fixes close them.

Tenant bleed is a product bug. Giving each customer an isolated, persistent AI agent requires separate compute and boundaries around identity, memory, credentials, and tools. A managed platform can make provisioning a per-user AI agent sandbox a single API call, but that call must establish those boundaries by default.

What tenant bleed actually is and where it comes from

Tenant bleed is any path that lets one user's agent memory, credentials, tool calls, or retrieved data get into another user's execution context. It is a specific failure of separation. The path opens when product code gives a tool too much scope, leaves tenant identity out of a cache key, or gives an agent credentials that reach another account. These are decisions about how the product works.

The phrase “product-layer” identifies where the boundary was lost. A runtime can execute exactly as configured while an agent reads data it should never have received. The decisive rule is that the model must never decide which tenant it serves. A prompt saying “you are now working for tenant B” must change nothing downstream, because tenant identity must come from authenticated context.

Why AI agents break isolation patterns that work fine in ordinary SaaS

Conventional SaaS applications usually enforce tenant separation at the API and database query layers. The application responds only to explicit requests. Agents change that pattern. They authenticate, search repositories, retrieve memories, invoke tools, and delegate authority across workflows. An API permission check does not cover a later search through a file system or vector index unless that search also enforces the tenant boundary.

Semantic search looks for approximate matches, so a query can return another tenant's data if it lacks a server-side tenant filter. A SQL query with an explicit tenant condition constrains which records can qualify. The corresponding restriction in an agent system must live in the retrieval service.

Conversation history keyed only by session or user can cross agent instances when tenant identity is missing. The key needs to include the tenant, user, and session. A prompt cache that leaves out tenant identity can also give one customer's response to another customer who asks the same question. Secure SaaS instincts remain useful, but they do not automatically cover these additional layers.

The four concrete design decisions that introduce bleed

First, accepting tenant identity from a prompt puts an authorization decision inside text that injected content can alter. The vulnerable surface is identity entering the workflow. The fix is to authenticate the user, issue a JWT with a tenant_id claim, and derive downstream filters server-side from that verified token. The account must not be chosen by tenant context that comes from the client or by model output.

Second, letting tools query without tenant scope exposes data beyond the caller's workspace. The vulnerable surface is the tool's execution authority. The fix is to give tools tenant-scoped tokens, check tenant claims at a gateway before execution, and bound each tool's root path to the tenant's namespace.

Third, keying memory by session or user alone leaves tenant separation out of the storage model. The vulnerable surface is shared conversation history. The fix is a composite key containing tenant and user, with session included for session-specific history. The same identity must remain attached when another agent instance retrieves that history.

Fourth, sharing platform-wide service credentials lets a request to do a small task run with the authority to do much more. The vulnerable surface is credential scope. The fix is short-lived credentials limited to the agent's task set and delegated tokens scoped to one resource. These four failures are code paths left open by the product, even when the underlying runtime performs correctly.

What actually happened when these decisions went wrong in production

Pillar Security's July 2026 “Week of Sandbox Escapes” published findings against Cursor, OpenAI's Codex CLI, Google's Gemini CLI, and Google's Antigravity. The findings concerned what happened to agent output after it left the sandbox, rather than a direct defeat of the isolation primitive. That distinction changes the architecture lesson. A sandbox does not automatically protect the application code that handles its output.

The NIST National Vulnerability Database recorded a critical vulnerability and supply-chain attack against OpenClaw in 2026. This illustrates a different entry point through the agent's dependencies. The dependency graph is part of how the product is designed. Infrastructure separation cannot substitute for controlling what software receives authority inside that environment, nor can it make a compromised dependency trustworthy.

The Zero Day Initiative's Pwn2Own Berlin 2026 introduced a coding-agents category with targets including Claude Code, OpenAI Codex, and Cursor. Researchers reported 47 unique zero-days and earned over $1.29 million over the whole event, totals that are not a count of tenant-bleed incidents.

Why prompt-level guardrails cannot substitute for structural enforcement

A system prompt telling an agent not to access another tenant's data is a request about behavior. It does not remove the permission to perform the action, and injected instructions can arrive through code comments, files, or tool responses. The action still runs with whatever authority the environment gives it.

Authorization must work no matter what the model does. A retrieval service must reject a query without a tenant filter. Application and infrastructure controls must independently enforce their boundaries. Prompt guardrails remain useful for steering ordinary behavior, but treating them as access control confuses guidance with enforcement.

How the integration layer becomes a tenant isolation boundary

For agents connected to Gmail, Slack, GitHub, and similar services, authentication and tool routing become part of tenant isolation. Each connection gives the agent authority to act outside its own runtime. The boundary therefore extends beyond the sandbox. How firmly a tool request stays tied to one integrated account depends on whether MCP endpoints are scoped per user or shared.

Composio illustrates the integration-layer pattern with infrastructure for more than 500 apps and thousands of tools. It handles authentication through OAuth, API keys, and other schemes, with credentials stored in its encrypted vault. Keeping those credentials out of the agent's context keeps secret storage separate from what the model does. It does not eliminate malicious agent actions, which its Firewall product aims to address. Its connectors work with Claude Code, Codex, OpenClaw, Hermes, and custom-built agents.

The isolation requirement is more specific than having connectors. Each MCP server URL should be scoped to one integrated account, with a hashed token resolved server-side to a tenant, region, and tool subset. A shared multi-tenant endpoint does not provide that same account-specific boundary. AWS recommends act-on-behalf delegation through OAuth 2.0 Token Exchange, RFC 8693. The delegated token records both the agent and original caller and is scoped to one resource.

The three isolation architectures and what they actually trade off

A fully isolated, or siloed, architecture gives each tenant separate infrastructure, including a vector database, file storage, and agent runtime. It provides the strongest resource separation of the three patterns. The cost is high, and updates become more complex. It suits tenants with regulatory or contractual requirements for dedicated resources. Separate resources still need correctly scoped integrations and identity.

A fully shared, or pooled, architecture places tenants on the same resources and separates them through software logic, typically tenant filters. It is the cheapest and easiest to scale. It relies on every code path that can reach tenant data applying the right restriction. A single missing filter can expose another tenant's data, while shared resources can also create “noisy neighbor” performance problems.

A hybrid architecture shares infrastructure while separating data into namespaces, workspaces, and per-tenant object-storage prefixes. It balances security and cost without dedicating every resource to every customer. The application still has to enforce access strictly. A namespace names a boundary, but an agent needs authorization to cross it. Choosing this pattern means accepting responsibility for those checks rather than inheriting separation from the cloud provider.

Compliance adds constraints to that choice. GDPR transfer restrictions apply to agent flows involving EU-resident data. The European Commission's enforcement page gives December 2, 2027 as the date for the Annex III high-risk AI rules. Transparency, documentation, logging, and human oversight are therefore product-design considerations for systems within that scope.

Why per-user isolation is a product requirement, not an infrastructure add-on

Per-user isolation must shape the product's data models, token scopes, tool configurations, and memory keys from the start. Infrastructure cannot infer the intended owner of a request when application code supplies the wrong tenant identity. MicroVMs, encrypted storage, and network namespaces constrain the reach of failures. They do not correct an authorized query sent to the wrong account.

The practical test belongs in product testing. A team should seed canary data in one tenant and try to retrieve it from another through vector retrieval, memory, tool calls, caches, and logs on every release. A deployment can pass a runtime-isolation check and still fail this test because a cache key or delegated credential crosses the boundary.

The consequences also follow the product's capabilities. An agent with access to inboxes, CRM entries, payment credentials, and code repositories exposes more than a conventional database query when its authority is mis-scoped. More tools mean more boundaries to enforce. Isolation therefore needs the same explicit ownership as authentication or billing, including specification, implementation, testing, and maintenance. It is part of what the customer is buying.

How do you give every customer an isolated AI agent with a single API call?

A correctly isolated production deployment starts with one persistent agent per customer and a separate identity for each instance. Tenant identity is encoded in a JWT and verified before downstream calls. Credentials are short-lived, assigned to individual agents, and limited to each agent's task set. Provisioning must establish these controls together. A new runtime without its identity boundary is not a complete customer environment.

Memory and retrieval must inherit that identity. Conversation history uses composite tenant, user, and session keys, vector storage uses per-tenant namespaces, and cache keys include tenant identity. The retrieval service enforces the filter before results reach the model. Tools use per-tenant MCP endpoints and OAuth-managed credentials kept outside the agent's reach. Act-on-behalf token exchange preserves both the agent's identity and the caller's identity during delegation.

Observability needs the same separation as execution. Every file access, memory retrieval, tool call, and log line needs a tenant tag, while access to logs remains tenant-scoped. Audit trails support security monitoring, while pooling them for shared debugging creates another way to expose data. Otherwise, the system can isolate the work correctly and expose its contents through the record of that work.

For a team seeking simpler operations, the practical route is managed hosting that enforces these controls by default and provisions the isolated environment through a single API call at customer onboarding. The selection criteria are persistent per-customer agents, verified identity, scoped credentials, isolated memory and retrieval, bounded tools, and tenant-controlled logs. Provisioning alone is not the full service. The platform must take on the ongoing work of maintaining, monitoring, and recovering those environments. Agent37, a managed hosting platform for AI agents that provisions an isolated, persistent agent for each customer through one API call, is one option teams can evaluate against these criteria.

Sources

  1. The Balkanization of Execution-Security Research for AI Coding Agents: Isolation, Access Control, and Time-of-Check-to-Time-of-Use Vulnerabilities

More in Building With Agents