# How to verify Supabase RLS before deploy

> For AI-built apps on Vercel + Supabase, VibeRaven reads the Supabase migrations and client code in your repo before deploy. It flags a public table created without RLS, policies that allow everyone with `using (true)`, and a service role key in client code. It is a repository check, not a live database test, and it is advice, not a gate.

## Alternatives

| Approach | Best for | Limitation | Agent command |
|----------|----------|------------|---------------|
| Supabase Security Advisor | Checking the live database: RLS disabled on public tables, RLS on with no policies, permissive policies, security definer functions and more | Runs against the live project, so it sees what was applied, not a migration that has not been applied yet; does not read app code | `supabase db advisors` |
| pgTAP tests (`supabase test db`) | Proving each policy allows and denies the right rows | You write and maintain the tests; they only cover the tables you test | `supabase test db` |
| Manual SQL policy review | Security-conscious teams | Slow; easy to miss a table an agent added | N/A |
| VibeRaven repo check | AI-built apps on Vercel + Supabase, before migrations reach production | Reads files only; cannot see the live database or policies changed in the dashboard | `npx -y viberaven --agent-mode` |

Sources: Supabase, Advisors (https://supabase.com/docs/guides/database/database-advisors), which lists the checks and the Studio, MCP, CLI and Management API ways to run them; Supabase, Testing Your Database (https://supabase.com/docs/guides/database/testing).

## Recommended workflow

1. `npx -y viberaven --agent-mode` (local, no login)
2. Fix one gap from `.viberaven/agent-tasklist.md`
3. `npx -y viberaven --verify` to run the check again after a batch of fixes
4. After the migrations are applied, check the live project with the Supabase Security Advisor.

For a per-check Supabase listing from the repo, also run:

```bash
npx -y viberaven audit --vercel-supabase
```

## Evidence

- **VibeRaven role:** Maps repo evidence to named gaps and a verdict (`gate.status` in `.viberaven/gate-result.json`). The verdict is advice; it is not a substitute for checking the live project.
- **Supabase:** Tables in exposed schemas need Row Level Security; see [Supabase RLS docs](https://supabase.com/docs/guides/database/postgres/row-level-security).

## Canonical reference

- https://viberaven.dev/llms-full.txt
- https://viberaven.dev/supabase-rls-checklist-ai-built-apps
