Store namespaces are not isolated in the LangGraph.js Postgres and Redis stores
Description
Impact
@langchain/langgraph-checkpoint-postgres and @langchain/langgraph-checkpoint-redis contained access-control flaws in their store implementations.
Applications may be affected when they rely on store namespaces to isolate data. Under these conditions, an operation scoped to one namespace may act on data stored under another:
PostgresStore:searchandlistNamespacescould return items and namespace names from a sibling namespace whose name shares leading characters, such as["tenant", "ab"]for a search on["tenant", "a"]. Direct item retrieval, writes and deletes are not affected.RedisStore: namespaces were matched by the words in their labels, ignoring case, order and punctuation, and labels were not escaped. An operation on one namespace could read, replace or delete another namespace's documents, particularly when users can influence namespace labels.
Returned items may contain application or user data stored as long-term memory.
Patches
The issues are fixed in @langchain/langgraph-checkpoint-postgres version 1.0.6 and @langchain/langgraph-checkpoint-redis version 1.0.12.
Both versions match namespaces segment by segment and discard items that do not belong to the requested namespace. As a result, a search may return fewer results than the requested limit.
For Redis, upgrade every process that writes to the store: an older version can still replace or delete other namespaces' documents. Postgres 1.0.6 also rejects namespace labels containing :.
Workarounds
Upgrading is the recommended remediation.
Applications that cannot upgrade immediately should independently verify that every result belongs to the namespace the caller is authorized to access before exposing the result. This does not protect Redis writes and deletes, so on Redis, do not place untrusted input in namespace labels until you upgrade.