AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Pg_net Grants To Anon/Authenticated Cannot Be Revoked Due To Supabase_admin Ownership, Creating Latent SSRF Risk

Supabase projects default to granting EXECUTE on net.http_post/net.http_get and USAGE on net schema to anon/authenticated, but the net schema and functions are owned by supabase_admin. Project postgres role lacks grant option, so REVOKE commands silently no-op, leaving a privilege that could be exploited if the net schema is ever exposed via Data API.

highConfidence 85%Supabase

Origin Analysis

In PostgreSQL, only the object owner or a role with grant option can revoke privileges on an object. The pg_net extension creates the net schema and its functions as owned by supabase_admin. The project's postgres role is neither the owner nor a member of supabase_admin, and has no grant option on the existing grants, so REVOKE statements are accepted but have no effect (silent no-op).
1. Connect to Supabase SQL editor as postgres. 2. Run: REVOKE EXECUTE ON ALL FUNCTIONS IN SCHEMA net FROM anon, authenticated; 3. Run: REVOKE USAGE ON SCHEMA net FROM anon, authenticated; 4. Check: SELECT has_function_privilege('anon', 'net.http_post(text, jsonb, jsonb, integer)', 'EXECUTE'); Returns true, confirming revocation failed. 5. Check ownership: SELECT nspname, pg_get_userbyid(nspowner) FROM pg_namespace WHERE nspname='net'; Shows owner supabase_admin.

Fixing Code Block

Edge Case Audit

Revoking USAGE on the net schema will block any legitimate use of pg_net functions by anon/authenticated, including any application logic that calls net.http_* directly with the anon or authenticated role. Before applying, verify no application code depends on these roles having direct access. Rollback is straightforward: re-grant the privileges if needed. The change may be transient if a future pg_net extension upgrade re-applies default grants; monitor after upgrades. Concurrency: revoke is immediate and may cause in-flight queries using net functions to fail if they execute after revocation. Apply during a maintenance window.

Ecosystem Topology