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.
- User A saves a unique marker in a thread and in the Store.
- 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.
- 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
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"
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-postgresandlanggraph-checkpoint-sqlite3.1.1. -
CVE-2026-115883: namespace labels containing
.reached other namespaces. Fixed inlanggraph-checkpoint-sqlite3.1.2 andlanggraph-checkpoint-postgres3.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.onhandlers 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 (5)
Good check — and the gap you name at the end is the one I'd add first: leaks through semantic search and cached trajectories. The HTTP paths you probe are exact-key lookups, so a missing handler fails open loudly. A semantic cache fails open quietly, because the key is a similarity score, not an id.
Two read paths worth adding to the two-user probe:
One thing not to lean on yet: entity agreement on read matches. "Activate user 4471" vs "deactivate user 4471" score 0.853 cosine in the adversarial eval I ran (18 polarity pairs, 0 false positives), so a threshold alone will not separate them. Writes should replay only on an exact match, never fuzzy — and a hit should never be served past a declared external_write, or when there is no taint info and the context changed. Those two rules are merged and shipping in the next core release, and they are the difference between a leak that looks like a speedup and one that looks like a breach.
The honest caveat: read-match entity agreement is still an open problem, not a shipped feature — so for now the tenant-scoped key plus exact-match-only writes is the load-bearing part. Your two-token probe is the right shape for it; I'd just run it against the cache layer too.
Thanks for this, genuinely — it’s the most useful comment I could have gotten. Your point about caches is the one that stuck with me: the HTTP paths I probe fail loudly, but a semantic cache fails quietly, and that’s the harder case. Your “replay the wrong command” post made the same thing click for me — a near-match on actions isn’t the same as a near-match on text.
So I pointed my two-user check at a local copy of your open semantic-cache layer. I have got some notes from the run I would rather share with you directly than in a comment thread — what’s the best way to reach you?
A handler on thread read is not enough. Thread search, store read, and store search are separate auth callbacks. If any one of them is missing, that path stays open while the path you tested looks locked.
The other miss is trusting metadata the client sends. On create, overwrite the owner with the authenticated identity and return that same filter from the read and search handlers. If you only check an owner field that the request body supplied, the other user can put the first user's id in the body and pass the check.
Thanks @osamamalik , both points are right.
On the first: that is why the check grades each path on its own. Thread read, state, history, thread search, Store read and Store search each get a separate result, and each needs user A to read her own data first, so a handler on one path can't make the others look locked.
On the second: the check doesn't cover that yet. Today user B reads A's data by id and by namespace, but it never tries an app whose handler trusts an owner value from the request. I have added it to the list.
Are there other paths you would test beyond those six? Runs, assistants and crons are the ones I am unsure about.
Some comments may only be visible to logged-in visitors. Sign in to view all comments.