MondayMedic

Guide

Supabase view bypasses RLS by default

MondayMedic checks for common public mistakes. It is not a full security audit, and a good score does not mean your app is safe.

Yes, by default. A Supabase view runs with its owner's rights (usually postgres), so it ignores the Row Level Security policies on the tables it reads. On Postgres 15 and above, set security_invoker = true on the view so it obeys those policies, and revoke insert, update and delete on it from anon and authenticated.

Paste your policies into our free RLS checker.

Check your live app first. Paste your app's public link into the free MondayMedic check. It reads only public pages and scripts, takes about a minute and needs no account. It flags Supabase tables the public key can read and secret keys in the browser. It does not log in or change data, and it is not a full security audit.

Check my app free

The short answer

Yes, by default a Supabase view bypasses Row Level Security (RLS). Supabase's docs say views "bypass RLS by default because they are usually created with the postgres user", and Postgres creates them with the owner's rights. So a view over a locked table can hand out every row your policies were meant to hide.

Why is this so easy to get wrong?

A common pattern in apps built with Lovable, Bolt or Cursor: you want users to see a list of each other's profiles, the RLS policy on profiles blocks it, so the AI adds a view such as public_profiles. It works. But the view now runs as postgres, and anyone holding your public anon key can query it through the REST API, logged out.

In October 2026 one builder posted on X that his app lost 35,000 profiles overnight. He wrote that he had bypassed RLS with a view so users could see each other's profiles, and hadn't revoked Supabase's default anon permissions, so the public key could delete everyone through it.

How do I check my views in two minutes?

  1. Security Advisor: in the Supabase dashboard, open Advisors, then Security Advisor. A Security Definer View warning (lint 0010) names each view that runs with its owner's rights.
  2. SQL: run this in the SQL editor to list views in public that are not set to run as the caller:
    select c.relname as view_name
    from pg_class c
    join pg_namespace n on n.oid = c.relnamespace
    where n.nspname = 'public'
      and c.relkind = 'v'
      and not exists (
        select 1 from unnest(coalesce(c.reloptions, '{}')) o
        where o in ('security_invoker=true', 'security_invoker=on', 'security_invoker=1')
      );
  3. Grants: see who can write through each view:
    select table_name, grantee, privilege_type
    from information_schema.role_table_grants
    where table_schema = 'public'
      and grantee in ('anon', 'authenticated')
      and privilege_type in ('INSERT', 'UPDATE', 'DELETE')
      and table_name in (select table_name from information_schema.views where table_schema = 'public');
  4. From the outside: open your app logged out, or paste its link into the free check, and see whether the view answers the public key with rows.

How do I fix a view that bypasses RLS?

Make the view obey the policies on its tables:

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

Then remove write access you don't need:

revoke insert, update, delete on public.public_profiles from anon, authenticated;

If the view existed only to show a few public columns, it will now return only what the table's policies allow. Add a narrow select policy on the table for exactly the rows that should be public, or keep the view for column filtering only.

What else should I lock down at the same time?

Add MondayMedic as a preferred source on Google

Related guides

FAQ

Do Supabase views respect row level security?

Not by default. Postgres creates views with the owner's rights, and on Supabase the owner is usually postgres, which bypasses RLS. On Postgres 15 and above, create the view with security_invoker = true so it runs as the caller and obeys the table's policies.

Can someone delete data through a Supabase view?

Yes, if the view is simple enough to be updatable and the anon or authenticated role still has delete or update grants on it. Revoke insert, update and delete on views from anon and authenticated unless you really need them.

How do I find views that bypass RLS?

Open Security Advisor in the Supabase dashboard and look for the security definer view warning (lint 0010), or run the SQL query in this guide to list views in the public schema without security_invoker.

Is my anon key the problem?

No. The anon or publishable key is meant to be public. The problem is what that key can reach. Fix the view and the grants, not the key.

Will MondayMedic catch this?

The free check tests from the outside whether tables and views answer the public key with rows. It reads only and never writes or deletes, so it can't prove whether a delete would work. Use the SQL checks here for that.

Sources