Cannot revoke anon/authenticated EXECUTE on net schema (pg_net) — REVOKE silently no-ops due to supabase_admin ownership
Context
Security review flagged that anon/authenticated retain EXECUTE on net.http_post/net.http_get (and USAGE on the net schema itself). This is a potential SSRF vector if that schema is ever reachable via the Data API — the database could be made to issue arbitrary outbound HTTP requests.
What we observed
Both the net schema and its functions are owned by supabase_admin. Our project's postgres role has no membership in supabase_admin and no grant-option over the existing grants, so we cannot revoke them ourselves:
-- Attempt 1: function-level revoke
REVOKE EXECUTE ON ALL FUNCTIONS IN SCHEMA net FROM anon, authenticated;
-- Completes with no error, but has_function_privilege() confirms the grant is unchanged.
-- Attempt 2: schema-level revoke
REVOKE USAGE ON SCHEMA net FROM anon, authenticated;
-- Same silent no-op — schema owner is also supabase_admin (confirmed via pg_namespace.nspowner).We also tried the drop/recreate approach sometimes suggested for non-relocatable extensions (inside a transaction, rolled back before committing, so nothing was actually changed):
BEGIN;
DROP EXTENSION pg_net;
CREATE EXTENSION pg_net;
-- freshly recreated extension and its objects are immediately re-owned by supabase_admin again, not postgres
ROLLBACK;This didn't help either — ownership is reset to supabase_admin regardless of who runs CREATE EXTENSION.
What we've already ruled out
postgresrole membership: confirmed not a member ofsupabase_admin(viapg_auth_members), so noSET ROLEescalation path exists on our side.- Confirmed these are direct grants to
anon/authenticated(viainformation_schema.role_table_grants), not inherited viaPUBLIC. - Confirmed via a direct REST API request (with a real
anonkey) thatnet.http_postcurrently returns404— thenetschema isn't in our project's exposed-schemas list, so the grant isn't exploitable through the standard Data API today. But the underlying grant is still wrong, and would become exploitable immediately if exposed-schemas config ever changes, or if a function we add later callsnet.http_*without realizing the broad grant already exists.
Relation to #46919
#46919 covers the extension_in_public advisory (extension's pg_extension.extnamespace pointing at public) and has a documented Support-assisted fix. That's a different, narrower problem — relocating the extension's namespace doesn't touch the EXECUTE/USAGE grants described here, since net.http_* already lives in the net schema regardless of where the extension itself is registered. We couldn't find an existing issue covering the grant problem specifically.
Request
- Is there a supported way for a project's
postgresrole to manage grants onsupabase_admin-owned objects likenet, short of a Support ticket per project? - If not, please treat this report as a request for Supabase to default
anon/authenticatedgrants onpg_netfunctions to none (orservice_role-only) on new and existing projects, rather than requiring each project to file a support ticket individually.
Happy to provide more detail if useful.
Source: supabase/supabase