ALTER TABLE ... ENABLE ROW LEVEL SECURITY plus one policy that works for your test account is not the finish line. Two bypasses sit outside the policy list, so a policy-by-policy review never sees them.
1. The table owner is not subject to RLS
relrowsecurity = true only means the table participates in RLS. Unless relforcerowsecurity is also true, the table owner bypasses the policies. If a migration, a helper job or an old service account owns your tables, "RLS is on" is a misleading status line.
select c.relname, c.relrowsecurity, c.relforcerowsecurity, r.rolname as owner, r.rolsuper, r.rolbypassrls from pg_class c join pg_roles r on r.oid = c.relowner where c.relnamespace = 'public'::regnamespace and c.relkind = 'r'; Do not flip FORCE ROW LEVEL SECURITY blindly: the owner is then subject to the policies too, and a too-narrow policy set can break legitimate writes. Check the owner first, then decide between FORCE and re-owning the table with a low-privilege role.
2. SECURITY DEFINER functions and unpinned search_path
A definer function runs with its owner's privileges. If that owner is privileged, and anon can EXECUTE it, an attacker gets owner-level behaviour without touching any table policy. An unpinned search_path adds a second problem: resolution can be steered at call time.
select p.proname, p.prosecdef, r.rolname as owner, r.rolsuper, r.rolbypassrls, p.proconfig as pinned_settings, pg_get_function_identity_arguments(p.oid) as args from pg_proc p join pg_roles r on r.oid = p.proowner where p.pronamespace = 'public'::regnamespace and p.prosecdef = true order by p.proname; Fix direction: set search_path = '' in the function definition, validate auth.uid() inside the function, and REVOKE EXECUTE ... FROM anon unless the endpoint is genuinely public.
A composition trap worth knowing
Permissive policies combine with OR, restrictive ones with AND. pg_policies.permissive stores the full strings PERMISSIVE / RESTRICTIVE — not single letters. A checker that looks for P / R substrings silently skips every row, then reports "no findings". That is why I also persist a fingerprint of the objects actually scanned (object names plus a catalog snapshot hash) and refuse to overwrite a baseline on an empty or malformed scan. First run = baseline; later runs = new and resolved findings only.
The ten read-only catalog checks behind that baseline are in a free nightly n8n drift monitor — it queries only pg_catalog, pg_policies, pg_roles and information_schema, reads no application rows and writes nothing.
Honest limit: catalog drift is not an exploit test. A clean diff means the checked catalog shapes did not change; it is not proof that no data is reachable.