// guide · Supabase · updated Oct 26, 2026
Supabase's October 30 change: fix “42501 permission denied” without turning off RLS
Short answer
On October 30, 2026, Supabase stops automatically exposing new tables in the public schema to the Data API (the REST and GraphQL layer that supabase-js calls). Existing tables keep working. After that date, a new table returns42501 permission denied until you add a GRANT. The fix is a grant plus Row Level Security plus policies, added together. Turning RLS off is never the fix.
What changes, and when
Until now, every table you created in public was automatically granted select, insert, update and delete for the anon, authenticated and service_role roles, so it showed up in your client right away. That also meant a table an AI tool created without RLS was readable by anyone holding your public anon key. Supabase is removing those automatic grants in stages (Supabase changelog):
- April 28, 2026: optional at project creation.
- May 30, 2026: the default for all new projects (rolled out gradually).
- October 30, 2026: applied to all existing projects.
Supabase also lists a final reminder email to project owners for October 23.
Who is affected
You need to act if any of these is true:
- Your app reads or writes
publictables throughsupabase-js, another Supabase client library, GraphQL, or direct calls to/rest/v1/. Almost every Lovable and Bolt app does. - Your migrations create tables without explicit
GRANTstatements. - An AI coding tool (Lovable, Bolt, Cursor, Claude Code, Replit) or a script creates tables and expects them to work immediately.
You are not affected if your app only talks to Postgres over a direct connection string (an ORM or server using DATABASE_URL), and the storage, auth, realtime and custom schemas are not part of this change.
What the error looks like
A query against a new table with no grant fails with a clear error instead of returning empty data:
{
"code": "42501",
"message": "permission denied for table your_table",
"hint": "Grant the required privileges to the current role with: GRANT SELECT ON public.your_table TO anon;"
}In the browser you may only see a 401 or 403 from the client library (Supabase: Database API 42501 errors). The hint names the role and privilege that are missing, which also lets an AI agent fix it.
The safe fix: grant, enable RLS, add policies
Grants and RLS are separate layers. The grant decides whether a role can touch the table at all; RLS decides which rows it sees. Without the grant, Postgres rejects the query before RLS is checked. Add all three in one migration (adapted from Securing your API):
-- 1. Grant only what each role needs
grant select on public.your_table to anon; -- only if logged-out visitors should read it
grant select, insert, update, delete on public.your_table to authenticated;
grant select, insert, update, delete on public.your_table to service_role;
-- 2. Turn on Row Level Security
alter table public.your_table enable row level security;
-- 3. Add policies that limit rows to their owner
create policy "users can read their own rows"
on public.your_table
for select
to authenticated
using (auth.uid() = user_id);Replace your_table and user_id with your real table and owner column. To see what a table currently grants:
select grantee, privilege_type
from information_schema.role_table_grants
where table_schema = 'public' and table_name = 'your_table';Three “fixes” that make your app less safe
- Disabling RLS (
alter table ... disable row level security). After a grant, that hands every row to anyone with your anon key, the pattern behind CVE-2025-48757 in Lovable apps. - Granting everything to everyone. Supabase's rollback SQL (
grant ... on all tables in schema public to anon, authenticated, service_role) restores the old behavior, but it also re-exposes tables you meant to keep private. Giveanonwrite access only when you truly need it. - Switching the browser to the
service_rolekey. It bypasses RLS completely and anyone can copy it from your JavaScript bundle. It belongs only on a server.
Tell your AI coding tool
Paste this into Lovable, Bolt, Cursor or Claude Code (as a project rule or system prompt) so new tables come out right the first time:
From now on, every time you create a table in the Supabase public schema, put these in the SAME migration:
1. Explicit GRANT statements for only the roles that need the table (anon only if logged-out visitors must read it; never give anon insert/update/delete unless I confirm).
2. ALTER TABLE ... ENABLE ROW LEVEL SECURITY.
3. Policies scoped to the row owner (auth.uid() = user_id or the real owner column). No USING (true) on tables with personal data.
If you ever see a 42501 "permission denied for table" error, fix it with the missing GRANT. Never fix it by disabling RLS or by using the service_role key in the browser.Optional: switch now instead of waiting
Supabase lets you adopt the new behavior on an existing project today by running the same statements the dashboard runs at project creation. Existing tables keep their grants:
alter default privileges for role postgres in schema public
revoke select, insert, update, delete on tables from anon, authenticated, service_role;
alter default privileges for role postgres in schema public
revoke usage, select on sequences from anon, authenticated, service_role;Test on a branch or staging project first. Supabase's changelog also has rollback SQL if a new table breaks.
Check your repo before and after
The October 30 change only covers new tables. Tables you already have keep the old automatic grants, so the real risk is still an existing table without RLS or with a using (true) policy. RescueMyRepo's free scan reads your Supabase migrations and flags tables where RLS is never enabled, permissive “allow all” policies, write grants to anon, public storage buckets, and leaked service_role keys, with a fix prompt for your AI tool. For this change specifically, it also lists every table your app queries with supabase.from() whose migrations never GRANT access to anon or authenticated: those are the tables that will return 42501 on a new project, a preview branch or a fresh environment.
FAQ
Will my existing Supabase tables break on October 30, 2026?
No. Per Supabase's changelog, existing tables keep their current grants and stay reachable. The change affects tables created in the public schema after the new behavior reaches your project.
Why does my new Supabase table return 42501 permission denied?
The role making the request (usually anon or authenticated) has no GRANT on the table, so Postgres rejects the query before Row Level Security is even checked. Add the minimum GRANT that role needs, then enable RLS and add policies.
Should I disable Row Level Security to fix the 42501 error?
No. RLS is not the cause. Grants decide whether a role can touch a table at all; RLS decides which rows it can see. Disabling RLS after granting access lets anyone with your public anon key read and change every row.
Does this affect apps that connect to Postgres directly?
No. Supabase says the change only affects the Data API (PostgREST, GraphQL, supabase-js and the other client libraries). Apps that use a direct Postgres connection string, psql or an ORM on a server are not affected.
How do I find which of my tables have no GRANT before October 30?
In the database, run select grantee, privilege_type from information_schema.role_table_grants where table_schema = 'public' and table_name = 'your_table'; for each table. In the repo, look for migrations that create a public table your app queries with supabase.from('table') but never run a GRANT to anon or authenticated. RescueMyRepo's free scan does that repo check automatically and lists the tables.
My AI tool fixed 42501 with GRANT ALL. Is that a problem?
Often, yes. GRANT ALL to anon or authenticated also hands out TRUNCATE, REFERENCES and TRIGGER, and Row Level Security policies do not apply to TRUNCATE. Replace it with only the privileges each role needs (usually select for anon, select/insert/update/delete for authenticated), with RLS enabled and policies in the same migration.
Does it apply to the storage, auth or realtime schemas?
No. Supabase's FAQ says only default privileges in the public schema change; storage, auth, realtime and custom schemas keep their current grants and defaults.