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

19 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 Oct 28 '26

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 Oct 28 '26

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/EarlyBumblebee8955 23d 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 22d 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 18d 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 15d 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 6d ago

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

1

u/Basic-Ball-4061 3d ago

Good that they gave us a months-long warning instead of flipping it overnight, but existing tables keeping their grants means whatever's already wide open stays open. Go through the Security Advisor and revoke anon on anything a signed-out visitor shouldn't read, then put the GRANT in the same migration as your RLS policy so it doesn't get forgotten.

1

u/InterestingSet7643 2d ago

ok so the part everyone keeps quoting is "existing tables keep their current grants and will continue working" and I genuinely can't tell if that's meant to reassure me or not, because it basically means everything I've had sitting in public since like 2023 with an anon select is going to keep sitting there being readable, that's not a fix that's just not making new problems. and yes fine, new tables need the grant, I get it, but my ai tool still spits out create table + enable rls + policy and forgets the grant every single time, so now I get 42501 at 1am and spend ten minutes convinced my policies are wrong when actually postgres just never let me near the table at all. the error hint is nice I'll give them that. anyway I still think the real problem was never the default on new tables

1

u/Flimsy-Awareness4340 1d ago

so it only kicks in for tables that don't exist yet. great news for everyone who already got it wrong.

1

u/Inevitable_Bar_9673 1d ago

october 30 was a month ago, why is this still written like its coming next week. "will require" no, it already requires, its been requiring since the 30th. And the worst part is the AI tools line, because everyone i've talked to in the last three weeks has the same story, some builder scaffolds the table with the policies and the indexes and everything looks beautiful and there is no grant anywhere, so the request comes back 42501 permission denied and everyone sits there staring at RLS for an hour because obviously its RLS right, it cant be anything else, except RLS was never the problem, RLS is untouched, its a seperate layer, the changelog says it in plain english, grants control whether the role touches the table at all and RLS controls which rows, two different things, and nobody reads the changelog they just read the error and go but i have a policy. and you cant grep a vibe either, that's the thing with the AI builders, the migration looks fine, nothing to review, and then its broken in prod. at least the old tables kept their grants so its only the new stuff.