Replies: 2 comments
-
|
You may know this with your investigation, but default for postgis is extensions schema when using Supabase UI. You really need to install it in this schema. |
Beta Was this translation helpful? Give feedback.
-
|
@GaryAustin1 is right that extensions schema is the target, but the migration from public is the hard part when you have dependent cols. note that DROP EXTENSION postgis CASCADE would destroy your pas_records.location column. But you can back up the data, migrate the extension, and restore: 1. sql-- 1. Back up geography data as WKT text (survives extension removal) 2. Drop the dependent column (not the whole table) 3. Now CASCADE is safe since no user columns depend on postgis 4. Reinstall in extensions schema 5. Recreate the column 6. Restore from backup 7. Clean up This moves postgis out of public, which means spatial_ref_sys is no longer in the public schema, no longer exposed via PostgREST, and the lint should clear. FYI if you have multiple tables with geography/geometry columns, you'd need to back up and recreate all of them. Test this on a branch database first with supabase db branch (paid plan), or duplicate the project on free tier. Also For your broader question about platform defaults: agreed that this should be fixed at install time. Every project that followed the older docs is stuck in the same state. Let me know if that works! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Project ref:
vnzamkfyoboshkptyfmp(Free tier). Already filed via dashboard support form as SU-384481; cross-posting here per Supabase's own confirmation message that Free-tier non-outage issues are encouraged on GitHub Discussions.The exposure is real, not just a lint finding
The Security Advisor flags
public.spatial_ref_sysas RLS-disabled (lint0013_rls_disabled_in_public). I verified this is actually exploitable: with only the public anon key, I can hit the REST API and bothPATCHandDELETEreturn HTTP 204.The PostGIS reference data is publicly modifiable by anyone with the project URL.
Every privilege-escalation path is platform-blocked for project owners
public.spatial_ref_sysis owned bysupabase_admin, and every attempt to fix it aspostgresis rejected:ALTER TABLE … ENABLE ROW LEVEL SECURITY42501: must be owner of table spatial_ref_sysREVOKE INSERT/UPDATE/DELETE/TRUNCATE FROM anon, authenticatedsupabase_admin— can revoke)SET ROLE supabase_admin42501: permission denied to set role "supabase_admin"SET SESSION AUTHORIZATION supabase_admin42501: permission denied to set session authorizationREASSIGN OWNED BY supabase_admin TO postgres42501: Only roles with privileges of role "supabase_admin" may reassign objects owned by itGRANT supabase_admin TO postgres42501: "supabase_admin" role memberships are reserved, only superusers can grant themSame failure mode via:
postgres)/v1/projects/<ref>/database/query(alsopostgres)DROP EXTENSION postgis; CREATE EXTENSION postgis;is also not a workaround for any project that usesgeometryorgeographycolumns — it CASCADEs and wipes user data. In our casepublic.pas_records.locationis ageographycolumn, so this would destroy data.What would fix it (server-side, as supabase_admin)
Either of these clears the lint AND closes the actual REST exposure:
Option A — RLS enabled with public SELECT:
Option B — keep RLS off, revoke write privileges:
PostGIS function calls only need
SELECTon this table for SRID lookups, so either path is non-breaking.Bigger question
Would Supabase consider changing the default
postgisextension installation so this isn't a per-project fix? The lint fires on every project that installs PostGIS inpublic(the default), and the project owner has no way to silence it correctly. A platform-side default of "RLS on + SELECT-to-public policy" onspatial_ref_sysat extension install time would close this for all projects.Cross-reference: support ticket SU-384481.
Thanks for any pointer to the right fix path.
Beta Was this translation helpful? Give feedback.
All reactions