LatchDog

← Guides

rls_disabled_in_public: how to fix Supabase Security Advisor errors

Short answer: rls_disabled_in_public is the Supabase Security Advisor error for a table in your public schema that has Row Level Security (RLS) turned off, which Supabase describes as "Anyone with your project URL can read, edit, and delete all data in this table". Fix it with alter table public.your_table enable row level security;, then add the narrowest policy your app needs, because with RLS on and no policy nothing is readable through the API. The three related lints, policy_exists_rls_disabled, security_definer_view and function_search_path_mutable, each have a one-line SQL fix further down.

Where these errors come from

The Security Advisor is Supabase's built-in database linter. Supabase calls advisors "deterministic checks that ship with the platform", and you can run them in Studio (Security Advisor), through the MCP get_advisors tool with type set to security, or with the CLI command supabase db advisors (Supabase: Advisors). Each finding has a number and a level. The ones in this guide:

LintLevelSupabase's summary
0013_rls_disabled_in_publicERRORTable publicly accessible
0007_policy_exists_rls_disabledINFOSecurity policy not enforced
0010_security_definer_viewERRORView bypasses row-level security
0011_function_search_path_mutableWARNUnsecured function search path

Supabase also says "Some findings may be intentional, so check them against your intended schema and access model before you change anything." Read each finding, decide whether that table, view or function is meant to be public, then apply the fix. Run the SQL in the SQL editor or, better, as a migration.

rls_disabled_in_public: a public table with RLS off

Supabase's explanation: "Tables in the public schema are accessible over Supabase APIs. If row level security (RLS) is not enabled on a public table, anyone with the project's URL can CREATE/READ/UPDATE/DELETE (CRUD) rows in the impacted table." In practice the "anyone" is whoever has your public anon or publishable key, and that key is in your frontend by design (see is the Supabase anon key safe to expose?). Supabase's RLS guide is blunter about grants: "A table in an exposed schema without RLS is readable and writable by any role with a grant on it ... Adding policies doesn't remove them." (Supabase: Row Level Security)

List the tables that trigger it, and whether the anon role can currently select from them:

select
  c.relname as table_name,
  c.relrowsecurity as rls_enabled,
  has_table_privilege('anon', c.oid, 'select') as anon_can_select,
  has_table_privilege('authenticated', c.oid, 'select') as authenticated_can_select
from pg_class c
join pg_namespace n on n.oid = c.relnamespace
where n.nspname = 'public'
  and c.relkind in ('r', 'p')
  and not c.relrowsecurity
order by 1;

Every row is a table with RLS off. anon_can_select = true means a signed-out visitor with your public key can read it today. false means the missing grant is blocking the API for now, but the table still has no RLS, so fix it anyway.

The fix for a table

-- 1. Turn RLS on
alter table public.your_table enable row level security;

-- 2. Take back the default grants, then give back only what the app needs
revoke all on table public.your_table from anon, authenticated;
grant select, insert, update, delete on table public.your_table to authenticated;

-- 3. Add a policy for each operation the app needs (owner-only example)
create policy "owner can read" on public.your_table
  for select to authenticated
  using ((select auth.uid()) = user_id);
create policy "owner can insert" on public.your_table
  for insert to authenticated
  with check ((select auth.uid()) = user_id);

Step 1 is the lint's own fix. Supabase notes that "after enabling RLS you will not be able to use the anon role to read or write data to the table via Supabase APIs until you create row level security policies", so your app will show empty lists until step 3 is done. Steps 2 and 3 follow Supabase's "Secure a table with RLS" procedure in the RLS guide: enable RLS and set the grants, then "write a policy per operation" (the guide's examples use to authenticated and (select auth.uid()) = user_id). Write update and delete policies the same way, and give update both using and with check. The service role and secret keys bypass RLS, so your server code keeps working.

Two exceptions to the owner-only pattern:

Check the result with the query above (the table should now show rls_enabled = true) and with the outside test near the end of this page.

New tables and the October 30, 2026 grants change

Supabase's changelog says new tables in public "will no longer be exposed to the Data API automatically": a gradual rollout as the default for new projects from May 30, 2026, and "On October 30, 2026 the setting will be applied it to all existing projects" (Supabase changelog). It also says "Existing tables are not affected in your project, they keep their current grants and stay reachable", and "RLS behavior remains unchanged." So an old table with RLS off can stay exposed until you fix it, while a new table needs an explicit grant before the API sees it. That date has now passed, but we can't tell from outside whether your project has been switched over, so run the query above and read anon_can_select. Keep doing all three steps (grant, enable RLS, policy) on every new table, especially when an AI tool creates it.

policy_exists_rls_disabled: policies that do nothing

Lint 0007 is rated INFO, but it describes a trap: "A security policy exists but has no effect because Row-Level Security hasn't been turned on for the table." Supabase's rationale: policies "will not be enforced until the table is updated to enable row level security". You wrote policies, so you probably believe the table is protected. It isn't. If anon still has a grant, the table is as open as one flagged by lint 0013, and the two lints often appear together.

select p.tablename, count(*) as policies
from pg_policies p
join pg_class c on c.oid = format('%I.%I', p.schemaname, p.tablename)::regclass
where p.schemaname = 'public'
  and not c.relrowsecurity
group by 1
order by 1;

The fix is the same statement, alter table public.blog enable row level security;. Before you run it, read the policies, because they are about to start applying (select policyname, cmd, roles, qual, with_check from pg_policies where tablename = 'blog';). A policy that was never enforced may be wrong or missing for one operation, and turning it on can break a page that only worked because nothing was checked. Also check the grants as in the previous section, since policies never take a grant away.

The opposite lint: RLS on, no policy

Lint 0008 (rls_enabled_no_policy, INFO, "No access rules defined") is what you see after fixing 0013 and before writing policies: "Row-Level Security is enabled but no policies exist, so no data can be read or written through the API." Add the policy your app needs. If you want the table closed to the API on purpose, Supabase recommends making the intent explicit: create policy none_shall_pass on public.blog for select using (false);

security_definer_view: views that skip RLS

Lint 0010 (ERROR): "A view in the public schema runs with elevated privileges and ignores Row-Level Security, which could expose more data through the API than intended." Postgres views run with their owner's permissions by default, and Supabase's advice is "always set with (security_invoker=on) when a view should respect RLS policies." For a view that already exists:

alter view public.your_view set (security_invoker = true);

security_invoker is a supported ALTER VIEW ... SET option (PostgreSQL: ALTER VIEW), and Supabase says it was "introduced in Postgres 15". With it on, the view is only as safe as the tables behind it, so every table it reads needs RLS, a policy and the right grant. Finding the affected views, the revoke and private-schema alternatives, materialized views, and the 42501 error you may hit afterwards are all covered in Supabase views bypass RLS: how to find and fix security definer views, so we won't repeat them here.

function_search_path_mutable: functions with an open search path

Lint 0011 (WARN): "Without a fixed search path, this function could behave unpredictably or be exploited to reference unintended database objects." Supabase's rationale: when a function doesn't set its search_path, it inherits the caller's, so "Malicious users could potentially exploit the search_path to direct the function to use unexpected objects". Their recommendation: "pinning functions' search_path to an empty string, search_path = ''".

List functions in public that don't pin it (extension-owned functions are left out):

select p.proname as function_name,
  pg_get_function_identity_arguments(p.oid) as args,
  p.prosecdef as security_definer
from pg_proc p
join pg_namespace n on n.oid = p.pronamespace
where n.nspname = 'public'
  and p.prokind = 'f'
  and not exists (select 1 from pg_depend d where d.objid = p.oid and d.deptype = 'e')
  and not exists (select 1 from unnest(coalesce(p.proconfig, '{}')) cfg where cfg like 'search_path=%')
order by 1;

Pin one function without rewriting it:

alter function public.your_function(integer, text) set search_path = '';

Use the argument types from the args column. ALTER FUNCTION ... SET configuration_parameter is documented by PostgreSQL (PostgreSQL: ALTER FUNCTION), and Supabase's own fix uses create or replace function ... set search_path = ''. Supabase's warning applies to both: "once you set the search_path = '' all references to tables/functions/views/etc in your function's body must be qualified with a schema name." Change from orders to from public.orders inside the function body, or the function will fail with a "relation does not exist" error. Test each function after the change. A function that is security definer deserves the most care: Supabase's RLS guide says to "Set search_path = '' on every security definer function" and never to put one in an exposed schema, because it "is callable over the Data API with the creator's privileges". Lints 0028 and 0029 flag exactly that, and their fix is revoke execute on function public.your_function(integer, text) from anon, authenticated, public; or alter function ... security invoker;.

Other Security Advisor errors you may see next

LintLevelWhat it means and the documented fix
0023_sensitive_columns_exposedERROR"Sensitive data publicly accessible": a table exposed through the API, with RLS disabled and column names such as password, token or ssn. It is the same root cause as 0013, so enable RLS as above.
0015_rls_references_user_metadataERRORA policy trusts user_metadata, which end users can change. Supabase says there is "no one-size-fits-all solution" to replacing it; its RLS guide notes that raw_app_meta_data cannot be updated by the user.
0016_materialized_view_in_apiWARNMaterialized views can't be protected by RLS, so all their data is visible to every API user. Supabase's fix: revoke select on public.your_mat_view from public, anon, authenticated;
0024_permissive_rls_policyWARNA policy such as using (true) or with check (true) allows every row to the roles it names. Add a real condition unless the table is meant to be public.
0028 / 0029WARNA security definer function is executable by anon (0028) or authenticated (0029), so it can be called at /rest/v1/rpc/<name>. Supabase's fixes: revoke execute on function public.f(int) from anon, public; (use authenticated for 0029), or alter function public.f(int) security invoker;.

Paste-in fix prompt for Lovable, Bolt or Cursor

Review what your AI tool changes before you accept it, and run it against a copy of your database first if you can:

My Supabase Security Advisor reports rls_disabled_in_public, policy_exists_rls_disabled,
security_definer_view and function_search_path_mutable. Please, showing me the SQL
migration first and applying nothing until I approve:
1. For every table in the public schema with RLS off: "alter table public.NAME enable
   row level security;", then "revoke all on table public.NAME from anon, authenticated;",
   then grant back only the privileges the app needs to authenticated (and to anon only
   if the data is meant to be public), then one policy per operation using
   "to authenticated using ((select auth.uid()) = user_id)" or the right owner column.
   For tables that already have policies, show me the policies before enabling RLS.
2. For every view in public that should respect RLS: "alter view public.NAME set
   (security_invoker = true);" (Postgres 15+), and make sure every table or view it reads has RLS,
   a policy and a grant. For views the browser does not need: revoke from anon and
   authenticated, or move them to a private schema.
3. For every function in public without a pinned search_path: set search_path = '' and
   schema-qualify every table, function and view name inside its body. For security
   definer functions the browser does not call: revoke execute from anon, authenticated
   and public.
4. Do not disable RLS, do not write "using (true)" policies for private data, do not grant
   anything to anon unless the data is public, and never put a service_role or sb_secret_
   key in client code. Do not change unrelated code.
Then give me the SQL to re-check each item and explain which role can read what.

Check it from the outside

Only test your own project, and only with the anon or publishable key your site already ships (never a secret key):

curl "https://YOUR-PROJECT-REF.supabase.co/rest/v1/your_table?select=*&limit=1" \
  -H "apikey: YOUR_PUBLISHABLE_OR_ANON_KEY"

What LatchDog does here (and doesn't)

LatchDog keeps watching your live app after launch. Starter ($19/month, up to 3 apps) and Pro ($39/month, up to 10 apps) re-scan it automatically every day and after every deploy (triggered by a deploy hook from your host or CI), and email you only when something changes. Nothing to install: you verify your domain once. For the errors on this page:

Also useful alongside this: Supabase RLS for vibe-coded apps, Supabase views bypass RLS, is the Supabase anon key safe to expose? and how to monitor a Supabase app for leaked keys and open RLS.

Sources

Read directly on 2026-10-31: Supabase Advisors (lints 0007, 0008, 0010, 0011, 0013, 0015, 0016, 0023, 0024, 0028, 0029), Row Level Security, the October 30, 2026 grants change, PostgreSQL ALTER VIEW and ALTER FUNCTION. We ran the SQL on this page against a local PostgreSQL 18 copy with stand-in anon and authenticated roles; your project's Postgres version and roles may differ, so test on a copy. Supabase changes these pages, so check them if something here no longer matches your dashboard.

Keep watching your app, not just checking it once

LatchDog keeps watching your live app after launch. Starter ($19/month, up to 3 apps) and Pro ($39/month, up to 10 apps) re-scan it automatically every day and after every deploy (triggered by a deploy hook from your host or CI), and email you only when something changes. Nothing to install: you verify your domain once.

Start with the free check (headers, HTTPS, leaked keys in your JavaScript, source maps, .env/.git). Open-table checks run after you verify your domain. See plans

Free, read-only public check: no sign-up, no card. Headers, HTTPS, leaked keys in your JavaScript (always masked), public source maps and exposed .env/.git files. Supabase table checks run after you verify you own the domain.

Want the open-table check too? Get my free deep scan: sign in with your email (no password) and verify you own the domain. Your first deep scan is free and adds CORS, more of your JavaScript and, if your app uses Supabase, whether anyone can read its tables and views with your public key.