If you built a Supabase app with Lovable, Bolt, Cursor or another AI coding tool, the dashboard probably shows RLS turned on for every table. That's a good start, but it only tells you that some policy decides who sees each row. It doesn't tell you whether that policy is the one you meant to write.

Below are six patterns that show up a lot in AI-generated and copy-pasted policies. Each one looks reasonable at a glance. Everything here is about checking your own project.

1. using (true) on a SELECT policy

create policy "Enable read access for all users" on public.orders for select using (true); 

A policy with no to clause applies to every role, including anon. So if the anon role still has its default grants on the table, anyone holding your public anon key (which ships in your front end) can read every row.

using (true) is fine for data that is genuinely public, like a product catalog. For anything tied to a person, scope it:

create policy "Users read their own orders" on public.orders for select to authenticated using ((select auth.uid()) = user_id); 

(Wrapping auth.uid() in a select is a Supabase-recommended performance tweak; it doesn't change who can read.)

2. "Authenticated" used as if it meant "the owner"

create policy "Logged in users can read" on public.messages for select to authenticated using (true); 

This reads as "only signed-in users", and that's exactly what it does: every signed-in user can read every message. If sign-ups are open, "signed-in user" means "anyone with an email address". Ask what each row should be tied to (a user_id, an org_id, a membership table) and put that in the using clause.

3. INSERT with with check (true)

create policy "Users can create posts" on public.posts for insert to authenticated with check (true); 

Nobody can read anything new here, but any signed-in user can insert a row with someone else's user_id. Combine that with a read policy based on user_id and you can get rows showing up in the wrong account. Check the owner column on the way in:

with check ((select auth.uid()) = user_id) 

4. Views that skip the table's RLS

A plain Postgres view runs with the privileges of the view's owner, which in Supabase is usually postgres. That means a view over a protected table can return rows that the table's policies would block. Supabase's database linter flags these as security definer views.

On Postgres 15 and later you can make the view respect the caller's RLS:

create view public.order_summaries with (security_invoker = true) as select id, user_id, total from public.orders; 

Or keep views that need elevated access out of an exposed schema entirely.

5. Policies that trust user_metadata

using ((auth.jwt() -> 'user_metadata' ->> 'role') = 'admin') 

user_metadata can be updated by the signed-in user from the client (supabase.auth.updateUser({ data: ... })). A policy that trusts it is a policy the user can rewrite. Supabase's docs point to app_metadata for anything used in authorization, since only the server side can change it. A roles or memberships table you control works too.

6. security definer functions in the public schema

create function public.get_all_users() returns setof public.profiles language sql security definer as $$ select * from public.profiles $$; 

A security definer function runs as its owner and ignores the caller's RLS. In an exposed schema it's also callable through the API, and new functions get EXECUTE granted to PUBLIC by default. If you need one, put it in a non-exposed schema, or revoke access and grant it back to only the roles that should call it:

revoke execute on function public.get_all_users() from public, anon; 

Also set search_path on these functions (set search_path = '') so they don't pick up objects from an unexpected schema.

A 10-minute review of your own project

Run these in the SQL editor of your project.

Tables in public with RLS turned off:

select c.relname as table_name from pg_class c join pg_namespace n on n.oid = c.relnamespace where n.nspname = 'public' and c.relkind = 'r' and not c.relrowsecurity; 

Every policy, with who it applies to and what it checks:

select tablename, policyname, roles, cmd, qual, with_check from pg_policies where schemaname = 'public' order by tablename, cmd; 

Read the qual and with_check columns line by line. You're looking for true, policies that only check the role, anything that reads user_metadata, and INSERT or UPDATE policies with no owner check.

Then check from the outside, the way a signed-out visitor would. Using your own project's URL and its anon key:

curl "https://YOUR-PROJECT-REF.supabase.co/rest/v1/orders?select=*&limit=5" \ -H "apikey: YOUR_ANON_KEY" 

An empty array ([]) for a private table is what you want. Rows coming back means a signed-out visitor can read them too. Repeat for each table that holds anything personal, and run the Security Advisor in the Supabase dashboard while you're there.

Wrapping up

None of these need a rewrite. Most fixes are one line in a policy: swap true for an ownership check, add a with check, set security_invoker on a view, move a role check from user_metadata to app_metadata.

If you'd also like an outside, read-only look at what a signed-out visitor can see on your own app, that's what we're building at Cheqvo.