Supabase New Tables Get Default Grants Developers Never Wrote; Fix Via ALTER DEFAULT PRIVILEGES
Tables created in Supabase can come with privileges for the anon, authenticated and service_role roles without any explicit grant, because they inherit the creating role's default privileges. One developer's client portal had been revoking these table by table, which was error-prone. Row Level Security governs which rows are visible, but where RLS is forgotten, these extra privileges become the only barrier. The author found that a read-only query over pg_default_acl exposed different defaults between a local Supabase instance and production, so the environment being changed must be checked directly. Closing the defaults requires naming the owning role with FOR ROLE, and the supabase_admin role's defaults cannot be changed from the postgres role. Built-in PUBLIC EXECUTE defaults on functions also need separate handling, since a global revoke could affect functions from extensions owned by postgres.
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