Skip to content

Supabase and PostgresNetwork access and auditreference

Extension-owned tables on Supabase Postgres: what the postgres role can change

Tables that PostGIS and some other extensions create in public are owned by the platform role supabase_admin, so the project owner’s postgres role cannot revoke their grants, enable row-level security (RLS) on them or change their owner. The baseline finding, that public.spatial_ref_sys was writable by anon over the Data API (application programming interface) and over pg_graphql, is in Locking down Supabase. This page is about the next question: which levers the postgres role has, what each does, what moving PostGIS to schema extensions changes, which other extension tables are in the same state, and what the advisor says. The worked case is PostGIS’s spatial_ref_sys; one survey module repeats the catalog reading for the other extensions the image ships.

TL;DR

  • As postgres, revoke all ... from anon, authenticated, public on public.spatial_ref_sys returned WARNING: no privileges could be revoked and anon still held INSERT; enable row level security, create policy and alter table ... owner to postgres all failed 42501: must be owner of table; set role supabase_admin failed 42501 (EA03a). A postgres-owned control table in public had the same anon grants and postgres could revoke them and enable RLS (EA01c).
  • Two levers the postgres role does have: a plpgsql trigger raising 42501 for anon and authenticated closed both the REST (representational state transfer) and the GraphQL path (0 of 11 write requests took effect) with the grant left in place, and drop extension postgis cascade removed the table (EA03c, EA03d). Narrowing PostgREST’s exposed schemas closed REST for every table in public and left pg_graphql writes working (5 of 5) (EA03b).
  • As supabase_admin, which a hosted customer is not: revoking INSERT, UPDATE, DELETE and TRUNCATE closed all writes (0 of 11) and left reads and st_transform working, while RLS with no policy blocked the writes and broke anon’s st_transform with Cannot find SRID (4326) in spatial_ref_sys (EA03e).
  • Creating PostGIS in schema extensions gave the table no anon grant (0 of 11 writes). The support route, an extrelocatable flip around ALTER EXTENSION postgis SET SCHEMA extensions run as supabase_admin, moved the table with its grant: anon kept arwdDxtm, REST answered 406 PGRST106 Invalid schema: extensions (0 of 6 writes) and pg_graphql took 5 of 5 (EA04a, EA04b).
  • The docs’ relocation block as written failed on this image at ALTER EXTENSION postgis UPDATE TO "next" with 22023; without that step it completed. extensions.postgis_full_version() then failed because a plpgsql function still named public.postgis_lib_version() (EA04b).
  • Across the image’s other extensions, 9 tables with RLS off had INSERT, UPDATE or DELETE granted to anon: 1 from postgis, 3 from address_standardizer_data_us, 2 from pg_partman, 1 from wrappers and 2 in schema net from pg_net; the 7 in public were reachable over REST and pg_graphql (EA05).
  • On a local copy of splinter’s SQL the advisor named PostGIS’s objects when they were in public (9 lints, including rls_disabled_in_public for the table) and none of them after the table was in extensions, with anon still able to write it (EA07a).
SituationChoiceWhy
Enabling PostGIS on a projectcreate extension postgis schema extensionsTable owned by supabase_admin with no anon grant: 0 of 11 writes took effect (EA04a)
PostGIS already in public, only the postgres roleA trigger that raises for anon and authenticated, or drop and re-create after a backuprevoke, RLS, policy and owner changes all failed; the trigger closed both paths (EA03a, EA03c, EA04a)
The platform can act as supabase_adminRevoke INSERT, UPDATE, DELETE and TRUNCATE from anon and authenticated0 of 11 writes; reads and st_transform still worked (EA03e)
PostGIS relocated by the support routeCheck the ACL in the new schemaThe grant moved with the table; pg_graphql took 5 of 5 writes (EA04b)
You must keep PostGIS in public and want GraphQL closedRevoke USAGE on schema extensions only after testing your own functionsIt closed pg_graphql for tables there and also broke direct calls to extensions.* functions (EA04d)
Another extension in publicAudit relations and ACLs after create extension7 anon-writable tables from 4 extensions in public (EA05)
Extension table in public,owner supabase_admin,anon holds write grantsWho can act?postgres role onlysupabase_adminTrigger raising 42501 for anon(closes REST and GraphQL,grant stays)Drop and re-createin schema extensions(drops geometry columns)REVOKE write privileges(0 of 11 writes)

The same flow as text:

  1. The table is in public, owned by supabase_admin, with write grants for anon and authenticated.
  2. With only the postgres role, REVOKE, RLS, policies and owner changes fail; use a trigger that raises for anon and authenticated, or drop and re-create the extension in schema extensions.
  3. With supabase_admin, revoke INSERT, UPDATE, DELETE and TRUNCATE from anon and authenticated.

EA01a read the roles first: postgres is not a superuser (rolsuper, createrole, bypassrls are f, t, t) and is not a member of supabase_admin, but is a member of supabase_privileged_role; postgis is in supautils.privileged_extensions. After create extension postgis schema public as postgres, spatial_ref_sys and the views geometry_columns and geography_columns are owned by supabase_admin with RLS off, and the only grantor in any ACL (access control list) is supabase_admin (EA01b). Statements as postgres on public.spatial_ref_sys:

StatementResult
revoke all ... from anon, authenticated, publicok, WARNING: no privileges could be revoked for "spatial_ref_sys" (12 notices in all); anon still holds INSERT
revoke insert, update, delete, truncate ... from anon, authenticatedthe same warning; anon still holds INSERT
revoke all ... from anon granted by supabase_adminERR 0A000: grantor must be current user
set role supabase_adminERR 42501: permission denied to set role "supabase_admin"
alter default privileges for role supabase_admin in schema public revoke all on tables from anon, authenticated, service_roleERR 42501: permission denied to change default privileges
alter table ... enable row level securityERR 42501: must be owner of table spatial_ref_sys
create policy ... on spatial_ref_systhe same error
alter table ... owner to postgresthe same error
alter extension postgis set schema extensionsERR 0A000: extension "postgis" does not support SET SCHEMA
update pg_extension set extrelocatable = true where extname = 'postgis'ERR 42501: permission denied for table pg_extension
revoke usage on schema public from anon, authenticated (in a transaction, rolled back)ok; has_schema_privilege('anon','public','usage') stays true inside it

The last row: public’s ACL carries a PUBLIC entry (=U/pg_database_owner), so a revoke from anon alone changes nothing. That reading was not separated by a revoke from PUBLIC, which was not run. After all of these the write set was repeated: 11 of 11 still took effect. The 11 write requests are the PostgREST POST, PATCH and DELETE of a seeded row by anon, a POST and DELETE by authenticated, a PATCH that rewrites an authority row with its own value (200, 1 row; the value read before and after is [{"auth_name":"EPSG"}]), and pg_graphql insert, update and delete through SQL and through POST /rpc/graphql (EA02a). Every PATCH and DELETE targets a row seeded as supabase_admin first, so it stays meaningful when the INSERT before it was refused. A postgres-owned control table with its grants revoked answers anon’s POST and GET with 401 42501 permission denied for table in the same rig (EA02b).

Narrow PostgREST’s exposed schemas (EA03b)

Section titled “Narrow PostgREST’s exposed schemas (EA03b)”

As postgres, alter role authenticator set pgrst.db_schemas = 'graphql_public' plus pg_notify('pgrst', 'reload config') and 'reload schema' was accepted. While it was in force REST answered 404 PGRST205 Could not find the table 'graphql_public.spatial_ref_sys' in the schema cache to every request (0 of 6 REST writes took effect), and the 5 pg_graphql writes (3 through SQL, 2 through POST /rpc/graphql) still took effect (5 of 5). Restoring the setting brought REST back (200 rows=1). It closes the REST path for every table in public, not for this table, and does not touch pg_graphql.

A plpgsql function that raises 42501 when current_user is anon or authenticated, with a row-level BEFORE INSERT OR UPDATE OR DELETE trigger and a BEFORE TRUNCATE trigger on the table, both created by postgres without error. With them: 0 of 11 write requests took effect; anon’s TRUNCATE (in a rolled-back transaction) failed with the trigger’s error; the postgres role’s own insert and delete worked. postgres then got 42501: must be owner of relation spatial_ref_sys for drop trigger and must be owner of table spatial_ref_sys for alter table ... disable trigger (by name and disable trigger user). drop function ... cascade on the function it owns returned ok (NOTICE: drop cascades to 2 other objects), left 0 triggers on the table, and the 11 writes took effect again. The trigger leaves the grant in place; it is removable by postgres through its function. A design choice, not a fix of the grant.

drop extension postgis cascade as postgres returned ok on a table with 8500 rows; the table was gone, REST answered 404 42P01 relation "public.spatial_ref_sys" does not exist, and the pg_graphql field answered Unknown field "spatial_ref_sysCollection" on type Query.

With PostGIS re-created in public, run as supabase_admin, which the rig can do and a hosted customer cannot:

StatementResult
alter table ... enable row level security, no policyok; 0 of 11 writes (the POST answered 401 42501 new row violates row-level security policy for table "spatial_ref_sys"); anon’s REST read 200 rows=0; st_transform(st_setsrid(st_makepoint(1,1),4326),990401) went from POINT(1 1) to ERR XX000: Cannot find SRID (4326) in spatial_ref_sys
revoke insert, update, delete, truncate ... from anon, authenticatedok, no notice; ACL entries become anon=rxtm/supabase_admin and authenticated=rxtm/supabase_admin; 0 of 11 writes (REST 401 42501 permission denied for table spatial_ref_sys; the GraphQL mutation fields disappear, Unknown field "insertIntospatial_ref_sysCollection" on type Mutation); reads and the st_transform call still worked
alter default privileges for role supabase_admin in schema public revoke all on tables from anon, authenticated, service_roleok; pg_default_acl for that role becomes {postgres=arwdDxtm/supabase_admin}; as postgres, drop and re-create in public gives {supabase_admin=arwdDxtm/supabase_admin,postgres=arwdDxtm/supabase_admin,=r/supabase_admin} (anon none, PUBLIC r) and anon’s POST answered 401 42501

RLS without a read policy therefore breaks anon’s use of PostGIS reprojection.

Route 1 (EA04a), drop and re-create as postgres. Before: a user table ea04_places(id, name, geom geometry(Point,4326)) with 3 rows and a user row with spatial reference identifier (SRID) 990402 in spatial_ref_sys.

StepResult
drop extension postgis cascadeok, NOTICE: drop cascades to column geom of table ea04_places; the table had id:integer, name:text and still 3 rows; the SRID row was gone with its table
Re-created in extensions: owner and ACLowner supabase_admin, {supabase_admin=arwdDxtm/supabase_admin,postgres=a*r*w*d*D*x*t*m*/supabase_admin,=r/supabase_admin} (anon none, PUBLIC r); 8500 rows
has_table_privilege for anon, authenticated and service_rolet/f/f/f/f
pg_default_acl for supabase_admin in extensions{postgres=a*r*w*d*D*x*t*m*/supabase_admin}
REST404 42P01 on the default profile; 406 PGRST106 Invalid schema: extensions with Accept-Profile: extensions
Writes0 of 11 took effect (pg_graphql: the mutation fields are absent; the collection field resolves for reads)

Route 2 (EA04b), the support route as supabase_admin, with PostGIS first re-created in public and the same fixtures. The Supabase PostGIS guide’s troubleshooting section describes it: PostGIS is no longer relocatable and the ways out are drop and re-create or a support-run block that sets extrelocatable = true around ALTER EXTENSION postgis SET SCHEMA extensions.1

StepResult
The docs’ block, statement by statement inside begin: update pg_extension set extrelocatable = true, then alter extension postgis set schema extensionsboth ok
Then alter extension postgis update to "next"ERR 22023: extension "postgis" has no update path from version "3.3.7" to version "next"; after rollback the extension was still in public, relocatable=false, with the 3 rows, the geometry column and the SRID row intact
The block without that step (... set schema extensions; alter extension postgis update;, NOTICE: version "3.3.7" of extension "postgis" is already installed, then extrelocatable = false, commit)worked: extension schema extensions, relocatable=false; the user table kept its geometry column, 3 rows and the SRID row
spatial_ref_sys afterwardsin extensions with the ACL it had in public: anon arwdDxtm, grantor supabase_admin, has_table_privilege t/t/t/t/t for anon, authenticated and service_role
Calls afterwardsextensions.postgis_version() works; extensions.postgis_full_version() fails ERR 42883: function public.postgis_lib_version() does not exist, so at least that plpgsql function still names the old schema

On this image the docs’ block as written does not complete; the docs’ recipe may target another PostGIS version, and the hosted version is not measured.

Exposure after route 2: anon has USAGE on schema extensions. PostgREST on the default exposure answered 406 PGRST106 Invalid schema: extensions to the table, so 0 of 6 REST writes took effect; pg_graphql took 5 of 5 (3 through SQL, 2 through POST /rpc/graphql). This reproduces “anon writes extensions.spatial_ref_sys over GraphQL after PostGIS was moved to extensions”, and only on this route, not on route 1. The reason a table in extensions is a GraphQL field while extensions is not an exposed REST schema is the search path: pg_graphql builds its context from the schemas on current_schemas(false) on which the caller holds USAGE, and PostgREST adds db_extra_search_path to each request’s search path. That is source-read and documented; the rig set the extra search path to public,extensions, and removing extensions from it was not run. The mechanism is set out in Locking down Supabase.23

EA04c: with extensions added to the exposed schemas (alter role authenticator set pgrst.db_schemas = 'public, graphql_public, extensions' as supabase_admin, the same role-setting mechanism as EA03b), 11 of 11 writes took effect with Accept-Profile and Content-Profile set to extensions (REST 201 and 200). That shows what an exposed extensions schema would add; a project that exposes it for another reason is not measured.

EA04d, postgres in the route-2 state:

StatementResult
revoke all on table extensions.spatial_ref_sys from anon, authenticated, publicthe same warning; anon keeps INSERT
revoke usage on schema extensions from anon, authenticated (postgres owns the schema)ok; closes pg_graphql for the table (0 of 11 writes; the fields become Unknown field)
While it is in force: select extensions.uuid_generate_v4(), a plpgsql function in public that calls it, a SQL function that calls iteach ERR 42501: permission denied for schema extensions for anon
An insert by anon into a public table whose column default is extensions.uuid_generate_v4()still worked (reading, not separated: the default’s function is resolved when the table is created, so no schema lookup happens at insert time)
grant usage on schema extensions to anon, authenticatedthe 5 GraphQL writes and all four calls worked again

72 extensions of the image’s 78 in pg_available_extensions were not already installed (the image has pg_graphql, pg_stat_statements, pgcrypto, plpgsql, supabase_vault and uuid-ossp after the rig’s setup). Each was created as postgres with create extension "<name>" schema public cascade: 64 were created and 8 failed 42501 permission denied to create extension (file_fdw, intagg, pageinspect, pg_freespacemap, pg_surgery, pg_visibility, wal2json, xml2). After each, the extension and anything its CASCADE added were dropped and the relations in public were back at baseline. 20 of the 64 own at least one relation (67 distinct relations, from 17 extensions once cascade-added ones are attributed to their owner).

Tables with RLS off on which anon holds INSERT, UPDATE or DELETE: 9, from 5 extensions (the catalog reading; the Data API probe is EA05b, with PostgREST on PGRST_DB_TX_END=rollback so its POSTs left no rows):

TableExtensionOwneranonReachable over
public.spatial_ref_syspostgis (and the extensions that cascade it: pgrouting, postgis_raster, postgis_sfcgal, postgis_tiger_geocoder, postgis_topology)supabase_adminrawdPostgREST and pg_graphql (EA02)
public.us_gaz, public.us_lex, public.us_rulesaddress_standardizer_data_ussupabase_adminrawdPostgREST (GET 200; POST of {} 201, rolled back) and pg_graphql (collection field resolves)
public.part_config, public.part_config_subpg_partmanpostgresrawdPostgREST (GET 200; POST of {} 400 23502, authorised and refused by a NOT NULL) and pg_graphql (resolves)
public.wrappers_fdw_statswrapperssupabase_adminrawdPostgREST (GET 200; POST 400 23502) and pg_graphql (resolves)
net._http_response, net.http_request_queuepg_netsupabase_adminrawdanon has USAGE on schema net; PostgREST 406 PGRST106 Invalid schema: net; the pg_graphql collection fields named after the tables answered Unknown field (the field names tried may not be the names pg_graphql uses for tables in net)

Other findings of the survey (anon column: select, insert, update, delete):

  • 11 views in public carry anon rawd: hypopg (2), pg_buffercache, pg_stat_monitor, pg_partman’s table_privs, pgtap (2), geometry_columns, geography_columns, raster_columns and raster_overviews. Whether a write through them is possible was not probed; PostGIS’s own two are views over catalogs.
  • pgsodium (5 relations), pg_repack (2), pgmq (pgmq.meta) and the 34 tables of postgis_tiger_geocoder in tiger: anon holds no privilege, or r only on some of the tiger tables, and has no USAGE on tiger, repack or pgmq.
  • pg_cron: cron.job is r--- and cron.job_run_details is r--d, both with RLS on and anon without USAGE on cron.
  • pg_tle (pgtle.feature_info) and postgis_topology (topology.layer, topology.topology): anon r---, with USAGE on the schema.

The local copy of splinter’s SQL (sha256 b6f5941265cf21093f807f3707bc48ae651a49e9b50d6b0ed9a4165f7292841c, 73,774 bytes, whose header says “main branch @ 2026-07-03”) ran as supabase_admin with pgrst.db_schemas set to public, graphql_public, with a postgres-owned RLS-off table ea07_control in public as the positive control.4 Upstream at commit cc529aa (2026-11-17) differs from that copy in the level and remediation of lints 0020 and 0021 and by one added lint (autovacuum_disabled); the 0013 lint is identical.

StateLints returnedNaming PostGIS’s objects
PostGIS in public9rls_disabled_in_public (public.spatial_ref_sys, ERROR), extension_in_public (WARN), anon_security_definer_function_executable and authenticated_security_definer_function_executable (WARN, each for the three overloads of public.st_estimatedextent); the control is named by rls_disabled_in_public
dropped and re-created in extensions1 (the control)none
relocated to extensions (anon keeps INSERT, UPDATE, DELETE)1 (the control)none

So on this lint SQL the extension-owned table in public is named like any other, and the table that is writable by anon in extensions after the support route is not named at all. Reading the lint (source-read, not a measurement): 0013 rls_disabled_in_public requires the table’s schema to be in pgrst.db_schemas and excludes a list of schemas by name that includes extensions, net, pgsodium, tiger, topology and vault. Whether the hosted advisor runs this version, with this setting, is not measured. The lab’s earlier measurement that the advisor did not lint a pg_tle extension’s objects (in schema hdr) is summarised in the lockdown page; EA07a refines it: two lints do name extension-owned objects when they are in public, and what the unlinted cases share is the schema outside public, a likely reading and not a separated one. An open issue on the supabase repository, 47206, reports the advisor flagging spatial_ref_sys with “RLS Disabled” while the user cannot enable RLS (last updated 2026-11-01 when read); EA07a reproduces the flag locally.5

  • A hosted project (EA06): the hosted role behind the SQL endpoint, hosted default privileges for supabase_admin, the hosted PostGIS and splinter versions, the gateway in front of PostgREST and pg_graphql, and whether a hosted PostgREST reads pgrst.db_schemas from the authenticator role.
  • The platform’s real support procedure for relocating PostGIS and the dashboard’s disable and enable flow; EA04 runs the docs’ block and a drop and create as stand-ins.
  • Dump and restore of an extension-owned table’s ACL (whether pg_dump carries the anon grant into the restored schema).
  • Another image, another Postgres major or another PostGIS version (only 17.11.0.018 with PostGIS 3.3.7; PG (PostgreSQL) 15 was not run).
  • Relations an extension creates later (at first use, from a worker, or on update), and extension versions other than the image default.
  • pg_graphql introspection (__schema, __type) answered Unknown field on pg_graphql 1.6.2 through graphql.resolve; not investigated, so existence of a field was probed by querying it. The GraphQL names of tables in schema net; revoke usage on schema public from PUBLIC; the advisor’s result on a hosted project.
  • Repeat runs: the artifact is one full run (n = 1).
  • “Took effect” means the write is visible in the table, not that the request returned 2xx. An earlier smoke run counted PATCH and DELETE of a row the refused POST had just failed to create as effects at HTTP (Hypertext Transfer Protocol) 200 with 0 rows, and a 200 affectedCount=0 GraphQL cell; both were fixed so that PATCH and DELETE target rows seeded as supabase_admin and affectedCount=0 and rows=0 read as no write. The artifact is from the fixed modules.
  • The pg_stat_user_tables counters for spatial_ref_sys read 8500 / 0 / 0 before the writes; after 10 inserts, 3 updates and 10 deletes they read deltas of 7 / 1 / 7 at 3 s and 10 / 3 / 10 at 15 s, so a counter read soon after a write can undercount (EA02c; see Postgres statistics counters).
  • One run, n = 1, nothing repeated: counts such as 11 of 11 are the size of the write set, not a rate.
PracticeEvidenceModule
Create PostGIS in schema extensionsIn public anon held arwdDxtm (11 of 11 writes); in extensions it held nothing (0 of 11)EA01b, EA04a
Back up before a drop and re-create in publicIt dropped the geometry column of your tables and the SRID rows you addedEA03a, EA04a
Check the ACL after a platform relocationThe grant moved with the table: anon arwdDxtm, pg_graphql 5 of 5 writesEA04b, EA07a
Ask the platform to revoke write privileges as supabase_adminRevoking INSERT, UPDATE, DELETE, TRUNCATE closed all 11 writes; reads and st_transform kept workingEA03e
Do not enable RLS without a read policy on spatial_ref_sysanon’s st_transform failed Cannot find SRID (4326) in spatial_ref_sysEA03e
Use a raising trigger when only postgres can act0 of 11 writes with the grant in place; removable by dropping its function with CASCADEEA03c
Do not narrow exposed schemas to protect one tableREST lost every public table; pg_graphql writes still worked 5 of 5EA03b
Test your own functions before revoking USAGE on extensionsIt closed pg_graphql for the table and broke 4 direct and function-wrapped calls of extensions.* functionsEA04d
Audit extension tables after enabling extensions, whatever the Data API opt-in saysThe opt-in alter default privileges for role postgres left spatial_ref_sys at anon arwdDxtm; 7 anon-writable tables from 4 extensions in publicEA01d, EA05
Read has_table_privilege('anon', '<schema>.spatial_ref_sys', 'insert') to detect itt for anon, authenticated and service_role in public; t/f/f/f/f in extensions after a clean createEA01b, EA04a

The experiment is experiments/extension-acl in supabase-lab. It needs Docker and the two images (about 1.2 GB and 0.5 GB); the full run took 81 s with the images cached.

make unit # tests of lib/ and EA06's skip path (no Docker)
make probe # every module; writes evidence/<ts>/
make probe ONLY=EA02
EXTENSION_ACL_SPLINTER_SQL=/path/to/splinter.sql make probe ONLY=EA07
ClaimStatusHow it was checked
The postgres role’s levers on spatial_ref_sys and what each doesmeasured, n = 1, a control beside each claimEA03a to EA03e, facts
Drop and re-create, and the support-route relocation, with the ACL and exposure after eachmeasured, n = 1EA04a to EA04d, same facts
64 of 72 extensions created; 9 anon-writable tables from 5 extensionsmeasured (catalog), Data API reachability probed for 7EA05, EA05b, same facts
Advisor lints in three PostGIS statesmeasured on a local copy of splinter’s SQLEA07a, same facts
pg_graphql schema visibility from the search pathsource-read and documented23the lockdown page; the rig set the extra search path, removing it was not run
PostGIS no longer relocatable; the support blockdocumented1; the block failed at update to "next" on this imageEA04b
Hosted behaviournot measuredEA06 skipped

One docs-versus-runtime point, not filed upstream (filed: no): the support block failed at update to "next" on PostGIS 3.3.7, and the docs recipe may target another PostGIS version.

  1. Supabase, “PostGIS,” Supabase Docs (Troubleshooting: moving PostGIS to a different schema). https://supabase.com/docs/guides/database/extensions/postgis ↩ ↩2

  2. Supabase, “sql/load_sql_context.sql,” pg_graphql, GitHub, tag v1.6.2. https://github.com/supabase/pg_graphql/blob/v1.6.2/sql/load_sql_context.sql ↩ ↩2

  3. PostgREST, “Configuration: db-extra-search-path,” PostgREST Documentation. https://docs.postgrest.org/en/stable/references/configuration.html#db-extra-search-path ↩ ↩2

  4. Supabase, “splinter,” GitHub (splinter.sql, lint 0013 rls_disabled_in_public). https://github.com/supabase/splinter ↩

  5. Supabase, issue 47206, GitHub. https://github.com/supabase/supabase/issues/47206 ↩