One-person studio (Tensorust). 8 iPhone apps live, 69 Rust crates, O'BLOCK on Steam. I write up builds with the real code and real numbers. tensorust.com
One gap I'd add to the checklist: functions. The Oct 30 change, as the changelog words it, is about tables. Postgres grants EXECUTE on new functions to PUBLIC by default, and anything in public is callable at /rest/v1/rpc/<name> with the anon key. A security definer function runs as its owner, so it skips RLS and every grant you just revoked on the table it reads.
Fix per function: revoke execute on function public.fn(args) from public, anon;. For future ones you need two statements, because per-schema default privileges can only add, never remove the PUBLIC default:
Same trap with views: they run as the owner unless created with (security_invoker = true) (PG15+), so a view over an RLS table can still hand out every row.
Have you seen the Security Advisor flag definer functions anon can call, or only tables?
We're a place where coders share, stay up-to-date and grow their careers.
One gap I'd add to the checklist: functions. The Oct 30 change, as the changelog words it, is about tables. Postgres grants EXECUTE on new functions to PUBLIC by default, and anything in
publicis callable at/rest/v1/rpc/<name>with the anon key. Asecurity definerfunction runs as its owner, so it skips RLS and every grant you just revoked on the table it reads.Fix per function:
revoke execute on function public.fn(args) from public, anon;. For future ones you need two statements, because per-schema default privileges can only add, never remove the PUBLIC default:Same trap with views: they run as the owner unless created
with (security_invoker = true)(PG15+), so a view over an RLS table can still hand out every row.Have you seen the Security Advisor flag definer functions anon can call, or only tables?