Multi-tenant MCP server data isolation: app-level checks unreliable, DB RLS as last line of defense

Street_Inevitable_77 · reddit · 2026-08-06

A developer shares a security lesson from building a multi-tenant MCP server: application-level tenant checks are error-prone and can lead to cross-tenant data leaks. He recommends pushing enforcement down to the database layer using PostgreSQL row-level security (RLS) scoped to the session's tenant ID, with no bypass role. This ensures that queries missing tenant filters return zero rows instead of leaking data, failing closed rather than open. He asks others about their experience with DB-level isolation and RLS performance at scale.

Original post →

More from coding & agent

coding & agent channel →