SELINA.ai
Sign in

Memory Namespacing, Not Just Encryption: The New OWASP and Microsoft Playbook for Agent Memory Security

Two of the most referenced security frameworks in software development now agree on something most agent builders still haven't internalized: encrypting memory at rest is necessary but nowhere near sufficient. OWASP's AI Agent Security Cheat Sheet and Microsoft's February 2026 SDL update both lay out concrete, overlapping controls for how agent memory should be isolated, validated, scoped, and expired. If you ship a product with persistent agent memory, this is your updated checklist. If you don't check against it, your auditors will.

Key Takeaways

What exactly changed in the OWASP and Microsoft guidance?

Two things landed close together and reinforced each other. In December 2025, OWASP released its Top 10 for Agentic Applications (2026 edition), which formally designated "ASI06: Memory & Context Poisoning" as a distinct risk class. Then in February 2026, Microsoft updated its Security Development Lifecycle with six new AI-era pillars, one of which is explicitly "AI memory protections." These are separate efforts by separate organizations converging on the same architectural prescription.

OWASP's AI Agent Security Cheat Sheet spells out the controls flatly: validate and sanitize data before storing in agent memory, implement memory isolation between users and sessions, set memory expiration and size limits, audit memory contents for sensitive data before persistence, and use cryptographic integrity checks for long-term memory. Microsoft frames the underlying problem as a collapse of traditional trust boundaries: cached memory creates risks of sensitive data leakage or poisoning, enabling attackers to skew results or force execution of malicious commands.

Neither document treats encryption as the answer. Both treat namespace isolation and write-validation as the answer.

Why does encryption alone fail for agent memory?

Encryption solves confidentiality at rest. It does not solve confidentiality at retrieval. This is the distinction most teams miss, and it's the one OWASP's guidance makes explicit.

Consider a multi-tenant agent where User A and User B share the same vector store. Every embedding is encrypted at rest. Good. Now User A issues a query. The database decrypts, runs a similarity search, and returns the top-k results. If there is no deterministic namespace or metadata filter scoping that query to User A's partition, the search can surface User B's embeddings. The encryption was intact the entire time. The leakage happened at query time, after decryption, because retrieval boundaries were never enforced at the data layer.

This is not a theoretical concern. 2026 multi-tenant RAG architecture guidance converges on the same point: secure multi-tenant retrieval requires deterministic data isolation at the vector database layer using namespaces and JWTs. The encryption checkbox is the easy part. The namespace enforcement is where teams actually fail.

We learned this ourselves. Selina's memory is encrypted at rest but is NOT end-to-end encrypted: a slice of each request necessarily reaches a frontier provider at inference time. That's an honest limit we state plainly. What we do control is how memory is partitioned and scoped before it ever reaches a model. The namespace boundary is the control that actually prevents cross-user leakage. The encryption is one layer beneath it.

What is memory namespace isolation, concretely?

Namespace isolation means shared infrastructure with logically separated data. You run one vector database cluster (for cost and operational sanity), but every tenant's data lives in its own namespace. Queries are scoped to a namespace before execution, not after. The database enforces the boundary, not your application code, and definitely not the model.

Vector memory architecture guides published in 2026 describe this as the standard for modern platforms. The implementation details vary by database (some use native namespace primitives, others use metadata filtering with strict access controls), but the principle is the same: the query never sees data outside its scope. It is not filtered after retrieval. It is scoped before retrieval.

This matters because the alternative, filtering at the application layer or asking the model to respect boundaries, is precisely the anti-pattern both OWASP and the broader architecture community now warn against.

Why is using the LLM as access control an anti-pattern?

Because LLMs are non-deterministic. Multiple 2026 architecture sources explicitly warn that relying on the model itself to enforce access boundaries during retrieval is an architectural mistake. The model might respect a system prompt instructing it to ignore User B's data 99% of the time. The 1% is your breach.

Microsoft's own SDL update acknowledges this dynamic directly: policy alone cannot manage non-deterministic systems and fast iteration cycles. If the model is your access-control layer, you have a probabilistic boundary where you need a deterministic one. This is the architectural equivalent of relying on a content filter to prevent SQL injection. It might catch most attempts. "Most" is not a security posture.

We see this pattern in the wild constantly. A team builds a RAG pipeline, dumps all tenant data into one index, adds a system prompt saying "only return results for the current user," and ships. It passes their demo. It fails under adversarial conditions.

What does OWASP's ASI06 (Memory & Context Poisoning) actually cover?

ASI06 defines the risk as agents relying on memory (conversation history, RAG indices, embeddings, persistent context stores) being corrupted with malicious or misleading data so that future reasoning, planning, or tool calls are skewed or unsafe. The critical detail: poisoned context can become embedded across multiple sessions or agents. One successful injection can propagate.

The OWASP GenAI project cited a real incident category where memory poisoning reshaped agent behavior long after the initial interaction. This is an observed pattern, not a theoretical one.

The prescribed mitigations are specific:

That last point deserves emphasis. If your agent can write to its own memory and those writes are later treated as trusted context, you have a self-reinforcing poisoning loop. The agent's hallucination in session N becomes its ground truth in session N+1.

How should you treat memory writes as a supply chain problem?

Every memory write should carry provenance metadata: who or what originated it, when, with what confidence, and when it should expire. This is the same discipline the software industry adopted for SBOMs (software bills of materials) after the supply-chain attacks of the early 2020s. OWASP's "provenance and trust-score decay" language maps directly to this model.

A memory entry sourced from a user's direct input might carry a high trust score. An entry derived from the agent's own reasoning might carry a lower one. An entry from an external tool call, lower still. Over time, entries decay. Expired entries get purged. This is what OWASP's cheat sheet means by "set memory expiration and size limits."

At Selina, we use a short retention window for non-content operational metadata. Content memory is encrypted at rest and scoped per user. We do not claim zero retention for operational data because that would be inaccurate. The honest version: metadata exists for a short window, content is encrypted, and the account is protected. Stating what we don't claim is as important as stating what we do.

What does Microsoft's Build 2026 follow-through look like in practice?

Microsoft's Build 2026 announcements turned the February SDL principles into shipping tooling. The open Agent Control Specification (ACS) defines eight lifecycle interception points: input, pre/post model call, pre/post tool call, output, startup, and shutdown. These are declared via a YAML manifest and work across Python, Node.NET, and Rust. The idea is straightforward: give builders deterministic hooks to inspect and gate every stage of an agent's execution, including memory reads and writes.

Their open-source Agent Governance Toolkit, released in April 2026, targets memory poisoning directly with a Cross-Model Verification Kernel that uses majority voting across models to validate high-stakes operations. The announcement explicitly references OWASP's December 2025 taxonomy.

Memory in Foundry Agent Service now includes procedural, user, and session memory as distinct types. This is the namespace concept made concrete at the platform level: different memory types have different scopes, different persistence rules, and different access controls.

How do you implement memory isolation if your stack doesn't have native namespaces?

Some vector databases support first-class namespace primitives. Others require you to build the boundary yourself with metadata filtering and strict access controls at the application layer. The key constraint, per current enterprise architecture guidance, is that the filter must be applied before the similarity search, not after. If the search runs first and the filter is applied to results, you have a timing window where cross-tenant data is in memory (the server's memory, not the agent's). That window is your vulnerability.

The practical checklist:

  1. Every vector write includes a tenant identifier in its metadata.
  2. Every query includes a mandatory filter on that identifier, enforced by a middleware layer that the calling code cannot bypass.
  3. The tenant identifier is derived from a verified JWT, not from the request body or a parameter the client controls.
  4. You test this with adversarial queries that attempt cross-tenant retrieval. Regularly. Automated.

If your database supports native namespaces, use them. They push the boundary enforcement into the database engine itself, which is a stronger guarantee than application-layer filtering. If it doesn't, the metadata-filter approach works, but you're accepting more responsibility for correctness in your own code.

What does the OWASP "Lethal Trifecta" mean for production agents?

OWASP's Agentic Skills Top 10 (AST10) introduces a concept they call the "Lethal Trifecta": an agent that has access to private data, exposure to untrusted content (including memory files), and the ability to communicate externally. When all three conditions are met, the attack surface is maximally dangerous. OWASP notes that most production agent deployments currently satisfy all three.

Memory namespace isolation directly addresses the middle condition. By scoping what untrusted content an agent can access, you shrink the trifecta. You can't eliminate it entirely (the agent still needs to read something, and some of that something will be user-supplied), but you can ensure that User A's poisoned memory entry never contaminates User B's context.

How bad is the attack feasibility, quantitatively?

Research is catching up to the threat models. One study on runtime memory injection found that crafted queries could get an agent to store poisoned reasoning traces with a roughly 98% injection success rate. A separate RAG-targeting attack technique achieved 62.6% end-to-end attack success against knowledge bases. These are not numbers that let you treat memory poisoning as a low-probability risk.

98% injection success means that if an attacker can write to your agent's memory (through a crafted input, a tool call, or a poisoned document in a RAG index), they will succeed almost every time. The defense has to be structural, at the write-validation and namespace layer, because the attack surface is simply too broad to cover with heuristic detection alone.

What does a complete memory security checklist look like in mid-2026?

Synthesizing the OWASP cheat sheet, the Microsoft SDL update, and the vector-database architecture guidance, here is the minimum set of controls you should be checking your agent stack against:

If you check all of these, you are ahead of most production agent deployments. If you check none, the two most authoritative security frameworks in the industry now explicitly say your architecture is deficient.

Where does Selina sit on this checklist, honestly?

We namespace memory per user. We encrypt content at rest. We maintain a short retention window for operational metadata. Files and transfers through SelinaSEND are end-to-end encrypted, zero-knowledge. Memory is NOT end-to-end encrypted and is NOT zero-knowledge encrypted, because inference requires a frontier provider to see a slice of the request. That's a hard constraint of the architecture, and we state it plainly rather than paper over it.

One area where running a real product gives you a perspective the frameworks don't cover well: bot and disposable-email defenses at the signup layer. We invest substantially in blocking automated and throwaway account creation. This matters for memory security because a poisoning attack often starts with an attacker creating accounts to probe the system. If you can limit account creation to real users, you reduce the volume of adversarial memory writes before they ever reach your validation layer. It's an unsexy control. It works.

We also route requests through a stack of frontier models, routed per task. We do not name which ones. The routing itself is a control surface: different tasks hit different models with different context windows, and memory scoping is enforced before the request leaves our infrastructure, not by the model at inference time.

What's the regulatory pressure behind all this?

The EU AI Act's high-risk AI obligations take effect in August 2026. The Colorado AI Act becomes enforceable in June 2026. Both impose requirements on how AI systems handle data, maintain audit trails, and manage risk. Memory poisoning and cross-tenant data leakage are exactly the kinds of risks these regulations target. If your agent stores user data in memory and you cannot demonstrate namespace isolation, write validation, and audit logging, you are going to have a difficult conversation with a regulator.

The OWASP and Microsoft guidance gives you a defensible architecture to point to. "We follow the OWASP AI Agent Security Cheat Sheet controls and align with Microsoft's SDL AI memory protections" is a sentence your compliance team can use. "We encrypt everything and trust the model to sort it out" is not.

Where is this heading?

OWASP's cheat sheet is still actively evolving on GitHub, with proposals to add formal secure agent testing and adversarial validation sections. Microsoft's ACS specification defines interception points that will likely become the default integration surface for memory-security tooling. The discipline of treating agent memory as a first-class security surface, not an afterthought bolted onto a RAG pipeline, is approximately six months old. It will be table stakes within twelve.

If you're building with agent memory today, do the namespace work now. Encryption is the floor. Namespacing is the wall.

If you want to see how we've implemented these controls in practice: start a free 7-day trial, no card required.

Frequently Asked Questions

What new guidance from OWASP and Microsoft addresses agent memory security?

OWASP's December 2025 Top 10 for Agentic Applications introduced 'ASI06: Memory & Context Poisoning' as a distinct risk, and Microsoft's February 2026 SDL update added an 'AI memory protections' pillar. Both independently converge on the same prescription: namespace isolation and write-validation, not just encryption, as the core controls.

Why isn't encrypting memory at rest enough to secure agent memory?

Encryption protects data at rest, but leakage happens at query time after decryption, when a similarity search can return another tenant's embeddings if there's no deterministic namespace or metadata filter scoping the query. The fix is enforcing retrieval boundaries at the data layer, not just encrypting stored data.

What is memory namespace isolation?

It means running shared infrastructure, like one vector database cluster, but keeping each tenant's data in its own logically separated namespace, with queries scoped to that namespace before execution. The database enforces the boundary deterministically, rather than the application code or the model filtering results after the fact.

Why do OWASP and Microsoft warn against using the LLM itself as an access-control mechanism?

Because LLMs are non-deterministic, a model instructed to respect user boundaries via a system prompt may still leak data in a small percentage of cases, which is enough to constitute a breach. Microsoft's SDL update explicitly notes that policy alone cannot manage non-deterministic systems, so access control needs to be enforced deterministically at the data layer instead.

What does OWASP's ASI06 risk category cover, and how does it recommend handling memory writes?

ASI06 covers memory and context poisoning, where malicious or misleading data corrupts an agent's stored memory and skews future reasoning, planning, or tool calls, sometimes propagating across sessions or agents. Recommended mitigations include validating writes before committing, segmenting memory by user and task, applying provenance and trust-score decay, and avoiding automatic re-ingestion of the agent's own outputs as trusted memory.

Sources & References

Michael C.

Michael C.

Founder & Principal Engineer, Selina Labs

Michael builds Selina, a privacy-first AI that remembers you across conversations. He ships security-sensitive AI in production — real attacks, real fixes, measured in minutes and dollars — and writes about privacy, security, and LLMs from that seat. Top Rated Plus and expert-verified on Upwork.

Learn more about Selina.ai