blog / security

Is your Supabase leaking? RLS checks for vibe coders

Most AI-built apps on Supabase ship with tables anyone can read. Here are the four ways it goes wrong, and how to check your own repo in two minutes.

Bettr's Flow lens listing four Supabase findings: rls-off, no-policy, service-role and no-auth

If you built your app with Lovable, Bolt, Cursor or Claude Code on top of Supabase, there is a good chance anyone on the internet can read your users' data.

That is not a scare line. One study sampled 1,645 Lovable apps and found roughly 70% had Row Level Security (RLS) disabled. In May 2025, more than 170 Lovable apps exposed whole user tables to a single anonymous request — no login, no exploit.

Why this happens

Supabase ships the anon key to the browser on purpose. It is not a secret. What protects your data is RLS: rules in the database that decide which rows each user may see or change.

AI agents are great at building screens. They are much worse at remembering that every new table needs a policy. And because the app works, nobody notices.

The four mistakes

  1. RLS is off. Without RLS, the anon key can read and write every row of the table.
  2. RLS is on, but there is no policy. This blocks everything — safer, but the agent often "fixes" it with step 3.
  3. A policy that allows everything. using (true) looks like a policy and Supabase shows RLS as enabled — but it restricts nothing.
  4. The service-role key in the wrong place. The service-role key skips RLS completely. If it ends up in frontend code or a public route, every rule you wrote is gone.

Two cousins of these show up in API routes too: writes without validation (the request body goes straight into the database) and routes with no auth check.

How to check your own repo

Bettr's codebase map has a Flow lens that follows each data flow from the client, through the API route, to the database. It flags:

  • rls-off and no-policy on tables in your SQL migrations
  • service-role wherever the service-role key is used
  • write-without-validation and no-auth on routes

Open the codebase map, pick the Flow lens, and every flagged flow is listed with the file and line. Then press Ask agent to fix — Bettr hands the exact finding to the agent in your pane, and it adds the missing policy, validation or auth check the way your codebase already does it.

The lens shows where to look; your agent does the judging. Flows are found by pattern (fetch/axios, Next.js and Express routes, Supabase, SQL migrations), so if a flow you expect is missing, ask your agent to trace it by hand.

Frequently asked questions

Is the Supabase anon key a secret? No. It is meant to be public. Your data is protected by Row Level Security, not by hiding the anon key.

Does turning RLS on break my app? It can, until you add policies. RLS with no policy blocks all access — add a policy per table for what each user should see.

Can I check RLS without Bettr? Yes — review every table in the Supabase dashboard and read each policy. Bettr's Flow lens just finds the risky spots in your code for you and lets your agent fix them.

// keep reading

CLAUDE.md, AGENTS.md, GEMINI.md: write project instructions your AI agents actually follow

Which instructions file Claude Code, Codex and Gemini CLI read, what to put in it, what to leave out, and how to keep one AGENTS.md as the single source of truth.

Git worktrees for AI coding agents: a practical guide

Two agents in one checkout will collide. How git worktrees give each agent its own branch and folder: commands, naming, env files, merging, cleanup, pitfalls.

How to review what an AI coding agent changed before you commit

A practical checklist for reviewing AI agent changes: diff per turn, spot deleted tests, new dependencies and secrets, check blast radius, run the tests, commit small.

$ bettr

Give your agents a better terminal.

Free to download. Checks for updates itself. Runs on your machine — no telemetry.

macOS

Universal — Apple silicon & Intel

.dmg · 230 MB

Windows

64-bit installer

.exe · 120 MB

Linux

x86-64 · AppImage or Debian / Ubuntu

AppImage · 158 MB · .deb · 103 MB

v1.41.1 · free · checks for updates itself