Prisma and Drizzle bypass Supabase Row Level Security by default, exposing all data
Popular ORMs like Prisma and Drizzle connect directly to Postgres using the 'postgres' role, which owns app tables and carries the BYPASSRLS attribute, causing all Row Level Security policies to be silently skipped. Unlike the Supabase JS client, which routes queries through PostgREST and enforces RLS via unprivileged roles, ORMs open a raw SQL connection that bypasses those protections entirely. This means a query that correctly returns only one tenant's data via supabase-js could return every tenant's data when run through an ORM. The bypass is not due to superuser privileges — Supabase withholds those from postgres — but rather because of table ownership rules and the BYPASSRLS attribute assigned to the role. Developers are advised to point their ORM's connection string to a dedicated, non-owner role without BYPASSRLS to restore proper policy enforcement.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in