You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cli): add [api].auto_expose_new_tables to opt out of Data API default privileges
Cloud now exposes a "Default privileges for new entities" toggle that, when
disabled, revokes the default GRANTs to anon/authenticated/service_role on
schema public so freshly-created tables, views, sequences, and functions are
not reachable through the Data API without explicit GRANTs (supabase/supabase
discussion #45329). Local Supabase had no equivalent: bootstrap always
installed the default GRANTs, forcing users who opted in on cloud to keep
their local schema out of sync or ship a project-specific revoke migration.
Add an opt-in flag under [api] with default true (preserving today's local
behaviour) and have the local DB bootstrap run the same revoke SQL Studio
runs at cloud project creation when the flag is false. The flag is wired
through both the Go CLI (covering `supabase db reset` and legacy
`supabase start`) and the TypeScript stack bootstrap (covering the new
`supabase start` foreground/background flows in apps/cli/next).
https://claude.ai/code/session_011pZGRjHtkxjt1iZj5LYrqq
// Setup mock postgres: the revoke SQL must execute between the initial schema and roles.sql
277
+
conn:=pgtest.NewConn()
278
+
deferconn.Close(t)
279
+
conn.Query(utils.GlobalsSql).
280
+
Reply("CREATE SCHEMA").
281
+
Query(utils.InitialSchemaPg14Sql).
282
+
Reply("CREATE SCHEMA").
283
+
Query("alter default privileges for role postgres in schema public\n revoke select, insert, update, delete on tables from anon, authenticated, service_role").
284
+
Reply("ALTER DEFAULT PRIVILEGES").
285
+
Query("alter default privileges for role postgres in schema public\n revoke usage, select on sequences from anon, authenticated, service_role").
286
+
Reply("ALTER DEFAULT PRIVILEGES").
287
+
Query("alter default privileges for role postgres in schema public\n revoke execute on functions from anon, authenticated, service_role").
"When true (default), new tables, views, sequences and functions created in the `public` schema by `postgres` are automatically reachable through the Data API roles `anon`, `authenticated` and `service_role`. Set to false to match the new cloud default and require explicit GRANTs to expose entities through the Data API.",
0 commit comments