One leaked memory ID is enough to fail a tenant isolation test. Start with two synthetic tenants that share local record IDs. Check that neither can read, search, change or delete the other’s data - even through agent tools, caches or background jobs.
This checklist covers five areas:
- Scope: map every memory store and processing path, and use server-verified tenant identity.
- Reads and searches: test forged tenant fields, missing filters, search results and cache reuse.
- Writes and poisoning: check bulk imports, tool calls, queued jobs and concurrent requests for changes without permission.
- Deletion and recovery: verify access revocation, removal of derived data, backup restores and event replay.
- Release checks: retain test records and require engineering, security and service-owner approval.
The release rule is simple: zero cross-tenant disclosures or changes without permission, with every known memory path tested.
::: @figure
{AI Agent Memory: Tenant Isolation Test Checklist}
:::
2. Checklist: Block cross-tenant reads and searches
Test reads, search modes and shared identifiers
Start with read paths. Search and retrieval often leak tenant data before writes do.
Using Tenant A’s session, try to access Tenant B’s memory, document, conversation and workspace IDs through APIs and agent tools. Search for B’s canaries using vector, full-text, metadata and hybrid retrieval. Repeat with tenant-local memory IDs, document names and user IDs. Then test partial matches, synonyms, empty queries and broad searches. Record the same-tenant control result alongside each cross-tenant failure.[2][4]
Check more than the returned text. Inspect identifiers, snippets, highlights, scores, facets, totals, pagination cursors and later pages. Compare inaccessible records with non-existent ones to find revealing errors or repeatable timing differences. A single foreign identifier counts as a failure, even if the response contains no memory content.[2]
Test forged tenant IDs and missing filters
Keep A’s authenticated session fixed while changing tenant fields in paths, query strings, bodies, headers, cookies, claims, tool arguments and model-generated calls. Verify that the system ignores client-supplied scope fields.[5] Tampered tokens must fail validation.
Test omitted, blank, null, duplicated and conflicting scopes, along with wildcard and unsupported filter operators. In a controlled test, remove the application’s tenant predicate. The remaining boundary must reject access or return no foreign data, rather than broaden the query.[1]
For every rejection, check both the response and the security audit event. The response must not confirm that B’s record exists. The event should include the timestamp, correlation ID, authenticated tenant, operation, resource type, decision and reason code. It must omit canary content, tokens and foreign metadata. Confirm that the event reaches monitoring and stays tenant-scoped there.[1]
Check retrieval permissions and cache isolation
Make B’s content highly relevant to A’s query. Then inspect retrieval candidates, hybrid branches, reranking inputs and prompt assembly. Apply tenant restrictions before ranking, and recheck permissions before content enters the model context or is returned.[5]
Warm semantic-search, response, retrieval, embedding, application and HTTP caches with B’s canary. Repeat the query as A, then reverse the order. Test near-identical queries, pagination, concurrent requests and permission changes. Cache keys must preserve tenant and access scope, and cache hits must not bypass authorisation.[5][6]
Test connection reuse too: the next tenant request must not inherit the previous request’s tenant context.[1]
3. Checklist: Block cross-tenant writes and memory poisoning
Test creates, updates, upserts and bulk imports
After testing read leakage, check state changes. Set up Tenant A and Tenant B with overlapping local IDs. First, verify that each tenant can change only its own data.
Example overlapping ID:
memory_id=123.
Authenticate as A, then submit B’s identifier through request bodies, URLs, query strings, metadata, embedding payloads and tool arguments. Derive tenant scope server-side and reject conflicting, missing or forged tenant values. Try creating a B-owned memory, changing B’s preferences, replacing B’s summary and upserting B’s persistent instructions. Include administrative APIs. Repeat with the tenant field omitted, null, malformed or duplicated. Missing tenant context must return no rows and permit no writes.[1][2][7][8][9]
Submit A-only, B-only and mixed-tenant batches, including duplicate identifiers within one tenant. Check the documented behaviour: either reject the whole batch or process only authorised items, with clear per-item results. For atomic batches, one forged B item must leave zero writes, embeddings or jobs across the entire batch. Where partial success is allowed, accepted items must belong to A. Rejected items must receive a clear denial without exposing B’s data. Repeat with retries, and verify that idempotency keys cannot cross tenant boundaries.
After every denial, use privileged, test-only access to inspect the database, vector index, search index, object store, cache, outbox and job queue. Confirm that nothing was changed or queued without permission. Keep a separate security audit event with the actor, authenticated tenant, attempted target, operation, decision, timestamp and correlation ID - but no sensitive payloads.[1][3]
Test agent tools, queued jobs and poisoning attempts
Apply the same boundary to memory writes made through tools and ingestion. Treat model output, retrieved text and tool arguments as untrusted input. Test direct tool calls and multi-step agent plans using forged ownership fields and foreign storage paths. Invoke every tool with server-set tenant context and forged selectors:
Test
tenant_id=B, B’s object ID, a B-prefixed storage path and a request tosave this memory for Tenant B.
The tool must reject the forged selector with a generic denial. Enforce authorisation at the final write boundary.[10]
Treat poisoned inputs as attempts to change persistent memory. Pass controlled poisoning fixtures through documents, tool responses, filenames, metadata and summaries. Verify that ingestion preserves ownership and provenance, handles content as data, never promotes user memory into shared memory without approval, and never treats stored privilege claims as permissions. Start a new session and confirm that rejected or quarantined content is neither retrieved nor acted upon.[11][12][13][14]
Queue an authorised A mutation, then tamper with or replay its payload under B. Check that the message carries authenticated, immutable tenant context and a correlation ID. Revoke the initiating user’s membership before execution, then repeat the check at retry, resume and dead-letter replay. Workers must re-establish trusted tenant context and re-authorise before writing. Denied work must leave no records, embeddings, cache entries or follow-on jobs without permission, while preserving the audit trail.[3][10]
Test connection reuse and concurrent requests
Check that isolation holds during connection reuse and concurrent execution. Alternate A and B mutations across pooled workers, database connections, vector clients, cache clients and queue consumers, using identical local record IDs.
Run concurrent writes with deliberate pauses between authorisation and commit. Cancel requests, force timeouts and retry after partial failures. Look for inherited permissions, duplicate commits, orphaned vectors and jobs created after failed transactions. Use production-like, non-privileged roles and pooling. Tenant context must be task-scoped or transaction-scoped, and cleared before reuse - including on error paths.[8]
4. Checklist: Test deletion, access revocation and recovery
Deletion must respect the same tenant boundary as reads and writes.
Test direct, bulk and administrator deletion
Try deleting another tenant’s data through memory IDs, namespaces, search-result IDs and batch IDs. Test forged tenant fields and bulk deletes with missing, empty or conflicting filters. Foreign and nonexistent records must return identical responses, with no clues in counts, job IDs or agent replies. Check that authorised A deletions succeed while B’s records stay unchanged. Use production-equivalent roles, service accounts and authorisation paths.[1][20]
Test support and administrator access separately. Cover permitted tenants, required approvals, access expiry and emergency access. A support role scoped to A must not delete B’s memory. Keep protected audit records containing the actor, authenticated tenant, target tenant, operation, result, reason, timestamp and correlation ID.[18][19]
Check derived-data deletion and access revocation
After permitted deletion, check raw content, chunks, embeddings, summaries, caches, conversation state, traces, exports and queued work. Searches must not return deleted representations, and pending summarisation jobs must not recreate them. Record the access-blocking and purge deadlines, measured completion time, and object versions and replicas.[1][21]
Test revocation separately. Revoke the user, agent or service token that authorised access, then retry reads, searches, tool calls, exports and queued jobs against retained and derived data. Access must stop within the required revocation window, even if physical copies remain. Document retention periods, legal holds and backup expiry separately: inaccessible data is not necessarily deleted.[15][17]
Test backup restores and event replay
Restore a two-tenant backup in an isolated environment. Apply deletion records and revoked permissions before enabling requests or workers. Check that removed memory stays inaccessible and that an A-only recovery reveals no B data.
Replay older creation and update events, including duplicate deliveries. Deletion tombstones must prevent deleted data from returning. Repeat these tests after schema migrations, index rebuilds, re-embedding and backfills, and retain event-ordering and reconciliation evidence.[16][1] Use the results as release gate input for the final sign-off section.
5. Conclusion: Make tenant isolation a release gate
Once deletion and replay checks pass, make tenant isolation the final release gate.
Run the full test suite before every release
Before every release, run tenant-context unit, integration, storage-policy and adversarial end-to-end tests. Cover changes to prompts, models, tools, schemas, retrieval, indexes, caches, permissions, database policies and workers. Release only when every memory path enforces trusted tenant identity and every cross-tenant attempt fails.[1]
Use production-equivalent roles, connections and pooling. Block the build if any memory store is unclassified, a required policy is missing, row-level security is disabled, or request roles have superuser or row-level-security-bypass privileges.[1]
Classify failures and keep release evidence
Any unexpected cross-tenant result or unmet required control blocks release. Apply these classifications consistently. No exception can waive an isolation failure.
| Failure type | Impact | Severity | Release action |
|---|---|---|---|
| Content exposure | Another tenant’s memory or answers disclosed | Critical | Block; investigate exposure |
| Metadata leak | Foreign IDs, counts or existence revealed | High | Block; correct the leak |
| Write without permission | Foreign memory changed or poisoned | Critical | Block; assess and repair affected data |
| Deletion/access-revocation failure | Retained or recoverable unauthorised access | High or Critical | Block; verify remediation |
| Audit failure | Missing tenant context, policy decision, object ID or trace evidence | High | Block; restore reliable evidence |
Record the test version, build or release ID, environment, trusted tenant identity, request/response metadata, policy decision, affected object, deletion evidence and remediation status. Redact evidence, and keep logs, traces, evaluations and exports scoped by tenant.
Record engineering, security and service-owner sign-off
Use the recorded evidence to complete sign-off.
Test date: 23 November 2026
Build/release ID and environment:
Tenants and roles tested: fixture details
Evidence: test results, deletion evidence and remediation retests
Unresolved non-blocking exceptions: owner, mitigation and expiry date, or none
Engineering, security and service-owner approvals: name, role and date for each
Each signer must confirm that trusted tenant identity is enforced, every known memory path is covered, adversarial tests pass, deletion evidence has been reviewed and no blocking failures remain.
FAQs
How can I automate isolation tests before each release?
Add policy violation checks to your CI/CD pipeline. Use GitOps to deploy test pods across tenant namespaces, then attempt cross-tenant access. Correctly configured services must return 403 Forbidden.
Version your datasets, memory schemas and infrastructure configurations. Before each deployment, replay the full test suite against held-out conversations, with a separate memory namespace for each test case. Block the release if any cross-user memory access is detected.
How do I detect forged tenant IDs and missing filters?
Validate tenant IDs at every layer, from the gateway to downstream services. Don’t rely on model instructions. Check each request against the session’s authorised tenant ID, and reject mismatched or forged IDs.
Enforce tenant scope and tenant-bound credentials for all reads, writes, searches and deletions. Before each release, attempt cross-tenant operations across namespaces using forged IDs and missing filters. Confirm that access is blocked in every case.
How can I verify deletion across all memory stores?
Test that deletions remove records from all relevant storage, indexes and caches without affecting other tenants. Check tenant boundaries across every deletion path and audit log.
Use a two-tier memory system, with retention policies and legal hold checks controlling deletion. Require an approval ID and confirmation for each action. Document the deletion process and retention triggers, and include these tests in readiness checks before every release.