Postgres RLS setup check in Symfony: how missing FORCE and catalog blind spots hide risks
A developer building a row-level security (RLS) setup check for Symfony apps on PostgreSQL investigated whether a serving role with no table ownership could silently return false-clear results. Testing on PostgreSQL 18.3 with three roles and three tenant tables showed that pg_class and pg_namespace are readable by PUBLIC, so even an unprivileged role can correctly read ownership and RLS flags. However, two other failure modes remain: a role with no grants at all triggers a permission error via to_regclass(), and tables outside the default search_path may return empty results silently. The proposed fix uses a LEFT JOIN against pg_catalog by explicit schema and table name, converting invisible tables into detectable rows with a seen_in_catalog flag rather than silent omissions. The check sources its tenant table list from existing Doctrine entity metadata, requiring no new configuration in a standard Symfony application.
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