r/Supabase • Supabase team • Oct 21 '26

tips Reminder: new tables will require explicit API grants from October 30

Starting October 30, newly created tables in the public schema on existing Supabase projects will need explicit GRANT statements to be accessible through the Data and GraphQL APIs, including via supabase-js.

Existing tables keep their current grants and will continue working. RLS behavior is unchanged, and direct Postgres connections aren’t affected.

If your migrations or AI tools create tables, make sure they include the appropriate grants alongside your RLS policies.

Full details and SQL examples

8 Upvotes

14 comments sorted by

3

u/PopKoren Oct 21 '26

Useful heads up, especially for anyone whose migrations come from an AI agent, because the generated SQL usually creates the table and enables RLS but never adds a grant. I'd also encourage people to grant only what each role needs, for example select for anon on a public catalog table and nothing at all on internal ones, rather than pasting a blanket grant to anon and authenticated just to make the error go away. After the change it's worth a quick look at which tables the public API still exposes; Rowly, a scanner I made, reports that plus the deployed app's auth, endpoints and storage at https://rowly.me

1

u/Slightly_mad_woman Oct 22 '26

I do not think I really understand. If all my public tables have RLS and that’s explicit in the RLS policies and I don’t have any API calls to the tables do I need to be concerned about this?

1

u/Slightly_mad_woman Oct 22 '26

BUT I use a lot of Edge functions (maybe I set it up wrong) and I’m concerned about those.

2

u/zkousama Oct 22 '26

your existing tables are fine: they keep their grants. It only matters for tables created after october 30.

for those, edge functions are affected if they use supabase-js (or the REST API), because that goes through the same Data API, even with the service_role key. That key skips RLS, but it doesn't skip grants, so a new table needs a grant to service_role as well as to anon and authenticated. Supabase's own example grants all three in the same migration as the RLS policies. only direct Postgres connections (a connection string) are unaffected.

so the habit to build: every migration that creates a table also grants it, and grants each role only what it needs.

1

u/Secvura 27d ago

Worth adding: this only affects tables created after 30 Oct. Tables that already exist keep their grants, so an existing table with anon access and RLS off stays open after the change. Quick read-only check in the SQL editor:

select
    c.relname as table_name,
    c.relrowsecurity as rls_enabled,
    has_any_column_privilege('anon', c.oid, 'SELECT') as anon_has_any_select_privilege,
    has_any_column_privilege('authenticated', c.oid, 'SELECT') as authenticated_has_any_select_privilege
from pg_catalog.pg_class as c
join pg_catalog.pg_namespace as n on n.oid = c.relnamespace
where n.nspname = 'public'
  and c.relkind in ('r', 'p', 'f')
order by c.relname;

Any row with anon_has_any_select_privilege true and rls_enabled false is the one to look at first. Probably best not to paste results publicly, since table names can say more than intended.

1

u/Euphoric_Key7016 27d ago

so existing tables keep the old behaviour and new ones need a grant, meaning for the next year my schema is half one rule half the other and i have to remember which table is which. that's the part that gets me, not the grant itself, i'd write the grant in 4 seconds. and "if your migrations or AI tools create tables" yeah well my AI tool also forgets the RLS policies half the time so the grant is the least of my problems

1

u/No_Possibility_9086 26d ago

the half-and-half schema thing is annoying, agreed. What works better is making it a rule the AI can't skip: put a line in the project rules / knowledge file that every create table migration must also enable RLS, add policies and add the grants, all in the same file.

Then run a quick check every so often for tables where RLS is still off, something like select tablename from pg_tables where schemaname = 'public' and rowsecurity = false; and anything it lists should be a deliberate choice, not a leftover.

Do you write your own migrations or let the AI do it?

1

u/EarlyBumblebee8955 19d ago

"À partir du 30 octobre" c'est déjà passé non? Et du coup une table créée par migration après cette date, elle garde les grants par défaut ou il faut les écrire à la main? Parce que c'est là que la plupart des gens vont se faire avoir.

1

u/MentalAccident7434 19d ago

so the move is to create every table you'll ever need before October 30 and then never touch the schema again. got it.

1

u/IndividualLower2496 15d ago

make sure they include the appropriate grants" yeah because every AI tool that spits out a create table definitely remembers the grant.

1

u/Budget-Moment-4506 11d ago

Small thing, but October 30 has already come and gone, so it's "now require" rather than "will require", no? Unless the changelog wording is the future one and you just copied it.

1

u/Excellent-Beat8871 2d ago

un rappel posté le 22 novembre pour une date du 30 octobre. utile.