DEV Community

Vedant Agarwal
Vedant Agarwal

Posted on Edited on

Can user B read user A's memory in your LangGraph app? A two-user check

If you run a LangGraph app for more than one user, each user's saved conversations and long-term memory need to stay private. I wanted a way to check that from the outside, as two real users, instead of trusting that my handlers were right. This post describes the check, what it found on a sample app, and what it found on an affected and a fixed version of LangGraph's SQLite store.

How isolation works in LangGraph

A LangGraph server keeps two kinds of memory per user:

  • Threads: saved conversation state and history.
  • The Store: long-term memory, organised into namespaces.

The server authenticates callers with the auth handler your app provides. Access to threads and Store items is then limited by the @auth.on handlers your app adds. The official guides show the pattern for threads and for the Store.

I think that is a reasonable design, because only the app knows who owns what. It does mean that isolation depends on code each team writes, and a missing handler does not raise an error. Requests simply succeed.

I call this failure an agent memory spill: one user of an agent app can read memory the app stored for another user, through the server's ordinary read paths, because a per-user access check is missing or wrong.

What happens without the handlers

I built a small sample app with no model in it: one graph that saves and recalls a value, two fixed test users, and an auth handler that checks their tokens. I ran it on a local LangGraph dev server (LangGraph 1.2.23) in two forms.

Sample app What user B could do with user A's data
Authenticates users, no @auth.on handlers Read A's thread, its state and history, find it in thread search, read and search A's Store items, and get A's saved value back by asking the agent
Adds an owner filter for threads and an own-namespace check for the Store None of those

Nothing about the first app looks broken when you use it as one user.

The check

The check is part of stranger-test, an open-source tool I maintain. It is free, Apache-2.0, and uses only the Python standard library. It needs a server you run and two test users' tokens.

  1. User A saves a unique marker in a thread and in the Store.
  2. User A reads the marker back on every path. If A cannot read her own marker on a path, that path is reported as not exercised and can never count as a pass.
  3. User B tries each path: A's thread by id, thread search, the Store item by namespace and key, and Store search. If you give it your agent's inputs, it also has B ask the agent.

Each path is graded, and the run as a whole is LEAK, OK or INCONCLUSIVE. A server with no authentication at all is reported as an observation, because the two callers are then the same user.

Try it with no setup, against a bundled practice server:

pip install stranger-test
stranger-test confirm agent-memory --demo
Enter fullscreen mode Exit fullscreen mode

Then against your own server on localhost, with two test tokens:

stranger-test confirm agent-memory http://127.0.0.1:2024 --token-a "$ALICE" --token-b "$BOB"
Enter fullscreen mode Exit fullscreen mode

The guide has a copy-paste auth snippet with two test users, for a dev app that has no auth yet.

The store underneath can also get it wrong

Correct handlers are not the whole story. LangGraph's Postgres and SQLite stores have had namespace-matching bugs, all fixed, including:

  • CVE-2026-71433: a namespace prefix search crossed segment boundaries. Fixed in langgraph-checkpoint-postgres and langgraph-checkpoint-sqlite 3.1.1.
  • CVE-2026-115883: namespace labels containing . reached other namespaces. Fixed in langgraph-checkpoint-sqlite 3.1.2 and langgraph-checkpoint-postgres 3.1.3.

Other researchers reported both, and both are public. I did not find them. I wanted to know whether a two-user check would catch that kind of bug, so I ran it against the real SqliteStore, behind a small app that correctly limits each user to their own namespace. The two test users' ids were ali and alice, so one id is a string prefix of the other. alice saved an item, and ali searched his own namespace.

langgraph-checkpoint-sqlite Result
3.1.0 (affected) LEAK: ali's search of his own namespace returned alice's item
3.1.1 (fixed) OK

Every other exercised path was clean on both versions, because the app's own checks blocked them. The scripts are in the repository under integration/langgraph/ if you want to reproduce it.

What to do

  • Upgrade the store packages to the fixed versions above.
  • Add @auth.on handlers for threads and for the Store, then check that they hold with two real tokens.
  • Do not treat a thread id or a namespace as proof of who is asking.

Limits

  • The check covers what it can reach over the server's HTTP API. A clean result is not a proof of isolation.
  • The store-boundary path needs two test accounts whose ids are prefix siblings.
  • It does not test leaks through semantic search.
  • I ran it against LangGraph’s local dev server, including with the server’s Store set to the real SQLite store, not against a production deployment.
  • Run it only against servers you run or are authorized to test.

If you run a multi-user LangGraph server and try it, I would like to hear which read paths I am missing. Issues are open on the repository.

Top comments (0)