Hosted Supabase: can PUBLIC EXECUTE be revoked from existing supabase_admin-owned pg_catalog functions? #50363
Replies: 1 comment 1 reply
|
Here is the concrete breakdown of the hosted Supabase security model, catalog ownership boundaries, and recommended architecture for least-privileged direct connections: 1. Is there a supported self-service mechanism to remove
|
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I'm trying to establish the supported least-privilege boundary for a custom server-side PostgreSQL LOGIN on hosted Supabase.
I've found several related discussions, but they don't quite answer this specific case:
#49421 — pg_net objects owned by supabase_admin; confirms project postgres cannot revoke owner-granted privileges and discusses relying on the Data API exposure boundary.
#50046 — essentially the same ownership issue for existing unaccent functions with PUBLIC EXECUTE.
#50335 — similar issue restricting pg_net objects owned by supabase_admin.
#50325 — least-privilege custom PostgreSQL runtime role in the presence of PUBLIC TEMPORARY and supabase_admin-owned extension functions.
#48063 / #48259 — related questions about supabase_admin default privileges, although those concern future/default ACLs rather than ACLs on existing objects.
My case differs slightly because the custom role would have a direct PostgreSQL connection, so keeping a schema outside PostgREST's exposed db_schema does not by itself remove the role's effective SQL privileges.
Specific issue
On our hosted project, these existing PostgreSQL functions:
pg_catalog.lo_create(oid)
pg_catalog.lo_creat(integer)
pg_catalog.lo_from_bytea(oid, bytea)
are owned by supabase_admin and grant EXECUTE to PUBLIC.
We want a dedicated application LOGIN that is genuinely read-only and can execute only a very small allowlist of our own bounded read-only functions.
Because PostgreSQL privileges are additive, the custom role inherits PUBLIC EXECUTE on the lo_* functions even if we grant it no direct table privileges and revoke everything we control from that role.
Our project postgres role is:
not a superuser;
not a member of supabase_admin;
not the owner of these functions;
and does not appear to have the grant authority required to remove the PUBLIC grants.
We are intentionally not trying to obtain supabase_admin, escalate the hosted postgres role, or use an unsupported workaround.
Questions
Our alternative is to remove the application's direct PostgreSQL observer credential entirely and expose its small set of aggregate/read-only observations through narrowly permissioned functions. Before redesigning around that, I'd like to establish whether the direct-login model can be restricted as intended.
We haven't changed these ACLs or attempted role escalation in production. I'm primarily looking for the supported hosted-Supabase security model, rather than a PostgreSQL privilege workaround.
Thanks.
All reactions