Skip to content
VibeSafeDaily

Over-open rules

New Supabase tables fail with 'permission denied' (42501) after October 30

Cataloged October 27, 2026 · Supabase · Lovable · Bolt · Cursor

Symptom

Starting October 30, 2026, Supabase applies a new default to every existing project: a table you create in the public schema is not reachable through the Data API until you grant it. Your old tables keep working. The next table your AI tool adds, through a migration, the SQL editor, or an MCP call, comes back from supabase-js with error 42501, permission denied for table, even with RLS and a policy in place. Server code using the service role key gets the same error. Projects created since the May 30 rollout already behave this way.

Root cause

The Data API that supabase-js calls has two separate layers. Grants decide whether a role such as anon, authenticated, or service_role may touch a table at all. Row level security decides which rows that role gets. Until now, Postgres default privileges gave select, insert, update, and delete on every new public table to all three roles, so a new table was reachable the moment it existed, protected or not. Supabase's April 28, 2026 breaking-change notice removes those default grants: the new behavior became the default for new projects from May 30, and on October 30, 2026 it is applied to all existing projects. Existing tables keep their current grants. Tables created afterwards need an explicit grant, and without one Postgres rejects the query before RLS comes into play. PostgREST answers with code 42501, permission denied for table, and a hint naming the missing statement, such as GRANT SELECT ON public.your_table TO anon. Supabase's reason is that agents, CLI scripts, and AI platforms now create tables with no human reviewing the diff, and the old default exposed tables a developer forgot to protect. The notice tells builders who use AI coding tools to update the tool's system prompt or use Supabase's agent skill so the grant step is included. A tool that writes only create table, enable row level security, and create policy now produces a table the app cannot see. The tempting fix is the bulk rollback from the same notice, grant ... on all tables in schema public to anon, authenticated, service_role, which makes every table in public reachable again, including ones you meant to keep private. Direct Postgres connections (psql, an ORM, a server with a connection string) are not affected, and neither are tables in auth, storage, realtime, or custom schemas. 42501 also comes back when an insert or update is blocked by an RLS policy, so read the message: permission denied for table means a missing grant.

Before and after

The before migration creates a protected table that the Data API cannot see after the change. The after migration adds the grants Supabase's notice puts first, for only the roles the app uses.

Before

create table public.notes (
  id uuid primary key default gen_random_uuid(),
  user_id uuid not null default auth.uid(),
  body text
);
alter table public.notes enable row level security;
create policy "read own notes" on public.notes
  for select to authenticated
  using ((select auth.uid()) = user_id);

After

create table public.notes (
  id uuid primary key default gen_random_uuid(),
  user_id uuid not null default auth.uid(),
  body text
);
grant select, insert, update, delete on public.notes to authenticated;
alter table public.notes enable row level security;
create policy "read own notes" on public.notes
  for select to authenticated
  using ((select auth.uid()) = user_id);

Fix prompt

In this project only. Do not test against anyone else's app.

1. Find every migration or SQL file that creates a table or view in the public schema (create table, create view, in supabase/migrations or wherever this project keeps SQL). For each one, tell me whether the same file has explicit grant statements for anon, authenticated, and service_role.

2. For each table the app reads or writes through supabase-js or /rest/v1, list which role does which operation: anon (signed-out pages), authenticated (signed-in users), service_role (server code or edge functions using the secret key). Show me the call sites.

3. Write a new migration that, for each of those tables, grants only what each role actually uses, then turns on RLS and adds policies, in this order:
   grant select on public.<table> to anon;  (only if signed-out visitors truly need to read it)
   grant select, insert, update, delete on public.<table> to authenticated;  (trim to the operations the app uses)
   grant select, insert, update, delete on public.<table> to service_role;  (only if server code uses it)
   alter table public.<table> enable row level security;
   one policy per granted operation for anon and authenticated, scoped with (select auth.uid()) where rows belong to a user.

4. Do not run grant ... on all tables in schema public, grant all, or alter default privileges ... grant to bring the old behavior back. That makes every table in public reachable again, including private ones. Do not switch browser code to the service role key to get around the error.

5. If an insert fails with permission denied for sequence, grant usage, select on that one sequence only to the roles that insert. Supabase's change also removes the default sequence grants.

6. Add a rule to this project's AI instructions (for example AGENTS.md, .cursor/rules, or the project knowledge file): every new table in public needs explicit grants, RLS, and policies in the same migration.

7. Tell me how to verify on my own app: apply the migration to a local or branch database first, then call each table from the app signed out and signed in, and confirm signed-out reads work only where I granted anon.

Do not print keys, tokens, or user data. Do not edit unrelated files.

Paste this into the coding tool that has your own project open.

2-minute self-check

These steps are for an app you own. Do not run them against someone else's project.

  1. In your own Supabase project's SQL editor, run Supabase's default-privileges query: select case d.defaclobjtype when 'r' then 'tables' when 'S' then 'sequences' when 'f' then 'functions' end as object_type, a.grantee::regrole as role, string_agg(a.privilege_type, ', ' order by a.privilege_type) as privileges from pg_default_acl d cross join lateral aclexplode(d.defaclacl) a where d.defaclrole = 'postgres'::regrole and d.defaclnamespace = 'public'::regnamespace and a.grantee in ('anon'::regrole, 'authenticated'::regrole, 'service_role'::regrole) group by 1, 2 order by 1, 2; If no tables rows come back, new tables in your project already get no grants, and every table you add needs its own.
  2. In your own repo, run grep -l -i 'create table' supabase/migrations/*.sql | xargs grep -L -i 'grant ' to list migrations that create a table with no grant in the same file. Each one is a table that would not be reachable over the Data API if it were created after the change.
  3. For a table that already returns the error, run select grantee, privilege_type from information_schema.role_table_grants where table_name = 'your_table'; If the role your app uses is missing the operation, that is the 42501. If the grants are there and only inserts or updates fail, look at the RLS policies instead.
  4. Open Security Advisor in your own dashboard. Supabase says that through October 30 it flags affected tables per project and shows the remediation SQL.

Common questions

My existing tables still work. Do I need to do anything before October 30?

Supabase says existing tables keep their current grants and stay reachable. What breaks is the next table created in public after the change reaches your project, whether it comes from the SQL editor, a migration, the Management API, MCP, the CLI, or an AI coding tool. Make grants part of every new table's migration now, so the first new table after October 30 works.

Can I just run the rollback SQL from Supabase's notice to get the old behavior back?

Supabase documents a rollback that restores default grants for future tables and grants every table in public to anon, authenticated, and service_role, then says to revoke any table you want private one by one. That puts you back on the default the change removes, where every new table is reachable over the Data API on creation, protected or not. Per-table grants with RLS and policies in the same migration are the safer fix.

Does this change Storage, Auth, or apps that use a direct database connection?

No. Supabase's notice says tables in storage, auth, realtime, and custom schemas keep their current grants and defaults, and apps that only talk to Postgres over a direct connection, such as psql, an ORM, or a server with a connection string, are not affected.

Sources

Same symptom

Same platform