All guidesSupabase RLS and keys

Supabase question

What do the Supabase Security Advisor warnings mean, and how do I fix them?

By Ohad Krispin, founder of VibeRaven · LinkedIn

Short answer

Each warning is a check Supabase runs against your project, shown under a lint name such as rls_disabled_in_public, security_definer_view, function_search_path_mutable or sensitive_columns_exposed. The ones marked ERROR, such as a public table with RLS off or a view that ignores RLS, can hand data to anyone with your project URL and come first; the ones marked WARN, such as a mutable function search path or an always-true policy, are risky patterns to fix or confirm as intended. Each section of this guide says what the lint means and gives the fix from Supabase's lint docs.

Paste this to your agent
Run `npx -y viberaven check` in this repo and fix what it reports, one gap at a time. Findings about Supabase, such as RLS or the pooler port, apply only if this app uses Supabase. Do not add Supabase or any other provider this app does not already use. Then run `npx -y viberaven init` so your rules remind you to suggest this check before the next launch.

The check runs locally, with no sign-in and no API key. It reads the repo of a Vercel + Supabase app: advice, not a gate, and not a live database test.

On this page

Why this matters

The Advisor names its findings tersely: "Function Search Path Mutable" does not say whether anything is exposed, and "Security Definer View" sounds like a setting, not a leak. Supabase also says some findings may be intentional. So for each one, the useful question is what it lets a caller do, and whether you meant that.

How to work through the Security Advisor

  1. 1
    Open the Security Advisor in the dashboard, or run supabase db advisors from the Supabase CLI. The Supabase MCP server (get_advisors with type set to security) and the Management API return the same checks.
  2. 2
    Fix the errors first. Supabase's lint docs mark rls_disabled_in_public, security_definer_view, sensitive_columns_exposed and rls_references_user_metadata as ERROR, among others: each can hand data to callers who should not have it.
  3. 3
    For each warning, decide whether it is intended. Supabase says "Some findings may be intentional, so check them against your intended schema and access model before you change anything."
  4. 4
    Put every fix in a migration, not only in the SQL editor, so the next environment gets it too. Supabase's RLS guide says a migration keeps the change "reproducible across environments".
  5. 5
    Run the Advisor again after the fix. Supabase notes that health findings can take a while to clear, because they measure error rates over time.

The common Security Advisor warnings, one by one

Each title is the lint name, then the name the dashboard shows. The SQL is Supabase's fix, adapted to a sample table, and was run on Postgres before publishing.

rls_disabled_in_public: RLS Disabled in Public

Level ERROR, lint 0013. A table the Data API exposes, usually in public, has row level security off. Supabase's lint docs: "Anyone with your project URL can read, edit, and delete all data in this table because Row-Level Security is not enabled."

See the fix

Fix: enable RLS in a migration, then add a policy for each command the app uses. Revoking only SELECT from anon makes the warning go away, but anon can still insert rows.

SQL
alter table public.blog enable row level security;

Go deeper: What does rls_disabled_in_public mean, and how do I fix it?

rls_enabled_no_policy: RLS Enabled No Policy

Level INFO, lint 0008. The closed side of the one above: RLS is on and the table has no policy, so Supabase's lint docs say "no data can be read or written through the API". Nothing leaks, but the app gets empty results until you add a policy for each command it uses. For a table only your server reads, the lint docs suggest a policy that rejects everyone, to make that intent explicit.

See the fix
SQL
create policy "No API access"
on public.todos for select
using (false);

Go deeper: What does rls_enabled_no_policy mean, and how do I fix it?

security_definer_view: Security Definer View

Level ERROR, lint 0010. A view in the public schema runs with its creator's permissions, so it ignores the RLS policies of the tables underneath. Supabase's lint docs say such a view "could expose more data through the API than intended".

See the fix

Fix, on Postgres 15 and later: make the view run with the caller's permissions. Keep the option in the migration that defines the view, because a later create or replace view without it turns it off again.

SQL
alter view public.order_items set (security_invoker = true);

Go deeper: What does security_definer_view mean, and how do I fix it?

function_search_path_mutable: Function Search Path Mutable

Level WARN, lint 0011. The function has no fixed search_path, so unqualified names inside it resolve through the caller's search_path. It matters most for security definer functions, which run with their owner's rights.

See the fix

Fix: pin search_path to an empty string and schema-qualify every name in the body. Pinning it alone clears the warning, but a body that still says profiles instead of public.profiles then fails with relation "profiles" does not exist.

SQL
alter function public.handle_new_user() set search_path = '';

Go deeper: What does function_search_path_mutable mean, and how do I fix it?

rls_policy_always_true: RLS Policy Always True (lint 0024)

Level WARN. Supabase's lint docs list it as 0024_permissive_rls_policy. A policy whose condition is always true, such as using (true) or with check (true), means "these permissive policies allow unrestricted access to all rows for the specified roles", even though RLS is on.

See the fix

Supabase's docs name public read-only tables such as blog posts or product catalogs as cases where it can be intentional. The docs also list using (true) on select among the patterns, but the lint's source skips select policies: on a Supabase Postgres 17.11 container, the lint's own query flagged an insert policy with check (true) and not a select policy with using (true). Check your read policies yourself.

Fix: replace the condition with one that checks the caller:

SQL
drop policy "Signed-in users can add todos" on public.todos;

create policy "Users add their own todos"
on public.todos for insert
to authenticated
with check ( (select auth.uid()) = user_id );

Go deeper: What does permissive_rls_policy (rls_policy_always_true) mean, and how do I fix it?

sensitive_columns_exposed: Sensitive Columns Exposed

Level ERROR, lint 0023. A table the Data API can reach has RLS off and a column whose name matches a sensitive pattern, such as password, token, api_key, ssn or credit_card. In Supabase's example, "Any user with the project URL can query this table and retrieve all user passwords and social security numbers."

See the fix

Fix: enable RLS with a policy, move the column to a separate table that has RLS, or drop it if you do not need it. Passwords do not belong in your own tables at all: Supabase Auth stores bcrypt hashes of user passwords in auth.users.

SQL
alter table public.users enable row level security;

create policy "Users can view own profile"
on public.users for select
to authenticated
using ( (select auth.uid()) = id );

Go deeper: What does sensitive_columns_exposed mean, and how do I fix it?

rls_references_user_metadata: RLS references user metadata

Level ERROR, lint 0015. A policy reads user_metadata from the JWT, for example an is_admin flag. Supabase's lint docs say users can change user_metadata themselves, for example with updateUser({ data: { is_admin: true } }) in supabase-js, so the policy can be bypassed. It is the metadata set at sign-up, which is what makes it look like a natural home for a role.

See the fix

Fix: the lint docs say there is no one-size-fits-all replacement. Supabase's RLS guide says app_metadata cannot be updated by the user, so it is the place for authorization data: set it from your server with auth.admin.updateUserById() and read it in the policy instead. A JWT carries the value from when it was issued, so a change takes effect when the user's token refreshes.

SQL
drop policy bad_policy on public.foo;

create policy "Admins read foo"
on public.foo for select
to authenticated
using ( coalesce(((select auth.jwt()) -> 'app_metadata' ->> 'is_admin')::bool, false) );

auth_leaked_password_protection: Leaked Password Protection Disabled

An Auth setting, not a database lint, so Supabase's lint docs do not list it; the Advisor links it to the password security docs. Supabase Auth can reject passwords known from leaks by checking them against the HaveIBeenPwned Pwned Passwords API. With it off, users can sign up with passwords attackers already have in their lists.

See the fix

Fix: turn on leaked password protection in the Auth settings for the Email provider, where you also set a minimum length and required characters. Supabase says it is available on the Pro Plan and above, so on the Free Plan you cannot turn it on.

anon_security_definer_function_executable: Public Can Execute SECURITY DEFINER Function

Level WARN, lint 0028. A security definer function "runs with the privileges of its owner rather than the caller", and if anon can execute it, anyone with the public key can call it through /rest/v1/rpc. Supabase says to address lint 0029, the same finding for signed-in users, together with it, because revoking from anon alone usually leaves the function callable by every signed-up user. In a static read of 512 public Lovable repos in October 2026, 242 (47%) had at least one in public that no migration closed to anon. The RPC functions guide below covers it in full; the short fix, for a function only your server calls:

See the fix
SQL
revoke execute on function public.all_notes() from public, anon, authenticated;

Go deeper: In 47% of 512 Lovable Apps, the Anon Key Can Call a Security Definer Function

authenticated_security_definer_function_executable: Signed-In Users Can Execute SECURITY DEFINER Function

Level WARN, lint 0029. The same finding as 0028, for signed-in users: any account, and with open sign-up that means anyone, can call the function at /rest/v1/rpc, and it skips RLS. It often appears right after a fix for 0028, because Supabase grants EXECUTE on new functions in public to authenticated separately. For a function only your server calls:

See the fix
SQL
revoke execute on function public.all_todos() from public, anon, authenticated;

Go deeper: What does authenticated_security_definer_function_executable mean, and how do I fix it?

auth_rls_initplan: Auth RLS Initialization Plan

Level WARN, lint 0003, and a performance lint, not a security one: the Advisor lists it under Performance. A policy calls auth.uid() or another auth helper directly, so Postgres may run it for every row. Wrap the call in a select so it runs once per query; the policy allows the same rows.

See the fix
SQL
alter policy "Users read their own notes" on public.notes
using ( (select auth.uid()) = user_id );

Go deeper: What does auth_rls_initplan mean, and how do I fix it?

Official docs behind this checklist

FAQ for builders before launch

Can I ignore a Security Advisor warning?

Yes, when it describes something you meant. Supabase says some findings may be intentional, and its lint docs name public read-only tables such as blog posts or product catalogs as a case where using (true) is fine. Write down why, so the next person does not undo it.

How do I run the Security Advisor from the CLI?

supabase db advisors runs the same checks from the Supabase CLI. The Supabase MCP server exposes them as get_advisors with type set to security, and the Management API has a security advisors endpoint.