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.
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.
- Fix for reads: recreate the view with
security_invoker = true(Postgres 15 and above) so it obeys the table's policies. - Fix for writes: revoke
insert,updateanddeleteon the view fromanonandauthenticated. - Older Postgres: revoke access to the view from
anonandauthenticated, or move it to a schema the API doesn't expose.
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?
- 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.
- SQL: run this in the SQL editor to list views in
publicthat 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') ); - 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'); - 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?
- Every table in
publichas RLS on, with a policy per operation. See our RLS check and fix guide. - No policy on private data says
using (true). Supabase notes this grants every visitor read access to every row the role can reach. - Security definer functions run as their creator and skip RLS too. Check who can execute them and that they use
auth.uid(), not a user id passed in. - No secret or service_role key in the browser. See anon key vs service_role key.
- Backups work and you'd notice a sudden drop in row counts.
Related guides
- Supabase "permission denied for table" (42501). A new table can be refused before RLS runs, because it is missing a GRANT.
- Anon key vs service_role key. The anon key in the browser is normal. The service_role key is not.
- Check and fix open Supabase RLS. Turn RLS on and replace policies that let everyone through.
- Are Supabase storage buckets public?. A public bucket skips access checks for downloads.
- Supabase infinite recursion detected in policy (42P17). The safe way to use a security definer function inside a policy.
- Is my Lovable app exposing data?. How to check after the Crissy Field study of public Supabase keys.
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.