Supabase security for vibe-coded apps

Supabase security checklist for vibe-coded apps.

If an AI tool built your app on Supabase, the first thing to check is Row Level Security. Here's how to find out in about ten minutes whether other users can read your customers' data, and what to do if they can.

FIXED PRICE  ·  FOUNDER-LED  ·  READ-ONLY ACCESS, NDA IF YOU WANT ONE

Why this matters

The database is exposed on purpose. The rules are your job.

Supabase exposes your Postgres database through an API so your front end can talk to it directly. Row Level Security (RLS) is the rulebook that decides which rows each person can read or change. Switch it on and write sensible policies, and a user sees their own data. Leave it off, or write a policy that's looser than you meant, and they may see everyone's.

AI tools can generate tables without it, or policies that look right and aren't. That doesn't mean your app is broken. It means this is the first thing worth checking, because it's the thing an enterprise customer's security team will test first.

The checklist

Eight checks, in order of how much they matter

1. RLS is on for every table

Supabase's own guidance is to enable it on every table in an exposed schema. Use the query below to list any table in your public schema where it's off.

2. No policy says "true" for everyone

With RLS on and no policies, nothing is readable through the API, which is annoying but safe. The dangerous one is a policy like using (true), which lets everybody in. Read every policy.

3. Be careful with anything granted to anon

anon is the role for signed-out visitors. A policy on it exposes those rows to anyone on the internet. If a table doesn't need to be public, it shouldn't have one.

4. The service role key stays on the server

The service role (or newer "secret") key bypasses RLS entirely. If it appears in browser code, a public repo or an .env file that was committed, rotate it now and move it server-side.

5. Views don't bypass your rules

Views skip RLS by default. On Postgres 15 and later, create them with security_invoker = true so they respect the policies on the tables underneath.

6. Storage buckets are locked down

Check which buckets are public and what policies sit on the rest. Uploaded invoices, IDs and contracts are exactly what ends up in a public bucket by accident.

7. Test it as a second user

Log in as user A, copy an ID that belongs to user B, and try to read, edit and delete it. Then try the same logged out. If any of it works, you've found a blocker.

8. Changes live in migrations

Supabase recommends putting RLS changes in migrations so they're reproducible across environments, and testing allow and deny cases. Policies clicked together in a dashboard are easy to lose.

Check your own tables

Two bits of SQL to start with

Run these in the Supabase SQL editor. They only read, they don't change anything.

First, find tables in the public schema that don't have RLS switched on:

select schemaname, tablename, rowsecurity
from pg_tables
where schemaname = 'public'
  and rowsecurity = false;

Any row that comes back is a table to look at. To switch it on and let users read only their own rows, the shape is:

alter table public.projects enable row level security;

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

Swap in your own table and column names, and write a separate policy for each of select, insert, update and delete. If your app lets signed-out visitors do anything, that's a deliberate decision to make, not a default.

Based on Supabase's Row Level Security documentation. Check it for current details, as the platform changes.

If you find a problem

What to do next

  1. Close the gap first

    Switch RLS on and write the policies. If a key was exposed, rotate it.

  2. Work out whether anyone got in

    Check your logs for access you don't recognise. You may not be able to tell, and that's worth knowing too.

  3. Know your obligations

    If personal data of UK customers was exposed, UK GDPR can require you to report it to the ICO within 72 hours of becoming aware. I'm not a lawyer, so take advice if it applies.

  4. Fix the rest by priority

    One gap usually means others. Fix what blocks your next milestone and leave the rest. That's what the readiness review ranks.

Common questions

Supabase security, answered

What is Row Level Security in plain English?

It's a database setting that decides which rows each person is allowed to read or change. Without it, anyone holding your app's public key could potentially read or edit every row in a table. With it switched on and written properly, a user only sees their own data.

Is Supabase secure?

Supabase gives you the tools, but the responsibility for switching them on and writing the rules sits with whoever builds the app. That's the catch with AI-generated apps: the tool may have built something that works without the rules being right.

Is it safe to have the anon or publishable key in my front-end code?

Yes, that key is designed to be public. That's exactly why your policies matter: the key is visible to everyone, so Row Level Security is what protects the data. The service role (or secret) key is different and must never be in browser code.

Does this apply to Firebase too?

The idea does. Firebase has security rules that play the same role, and AI-built apps can leave them too open as well. The specifics differ, so check your Firestore or Storage rules.

Keep reading

Related guides

Fix a vibe-coded app

What breaks first, and why a rebuild is rarely the cheapest safe route.

Read the guide

Is your AI-built app ready for customers?

Ten checks you can do yourself, not just the database.

Run the checks

AI Product Readiness Review

A fixed-price review against your next commercial milestone.

See what's included
Ready when you are

Want someone to check the whole thing?

RLS is one of five areas. The readiness review covers ownership, security, reliability, performance and deployment, and ranks what matters for your next milestone.

Darryll Wolloff is the founder of TechConnex. He builds MVPs and fixes AI-built apps for early-stage founders, and still writes and ships production code himself. Last updated 17 November 2026.