Symfony apps silently bypass Postgres row-level security due to table ownership flaw
A widely used Symfony deployment pattern causes PostgreSQL row-level security (RLS) policies to be silently bypassed, exposing all tenant data. The issue arises because PostgreSQL table owners bypass RLS by default, and in most Symfony setups the same database role both owns the tables and handles application queries. Running SELECT queries without setting a tenant context returns all rows across tenants with no error or warning. The fix is to apply ALTER TABLE ... FORCE ROW LEVEL SECURITY, which makes the owning role subject to the same policies as any other role. The problem was documented and verified on PostgreSQL 18.3, and the relevant PostgreSQL documentation does note the owner bypass behaviour, though it is easy to overlook.
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