langchain-enterprise-rbac
LangChain Enterprise RBAC (Python)
Overview
A B2B SaaS team shipped their first RAG feature for two tenants. The factory
code looked innocent: build PineconeVectorStore once at module import with
namespace="acme-corp" (the first tenant), convert it to a retriever, store
it in a module global, reuse on every request. Six weeks later tenant "Initech"
went live. Their first search returned three documents from Acme Corp.
The singleton retriever had captured the Acme namespace at process start.
RunnableConfig.configurable["tenant_id"] was being passed in — but the
retriever never read it, because the filter was baked in. Every request for
every tenant hit the same Pinecone namespace. Security review caught it three
days later and put a hold on the SOC2 renewal. This is pain-catalog entry
P33, the single most common cause of cross-tenant leak in LangChain 1.0
production.
This skill fixes it with four workstreams: