# Supabase table has RLS disabled (public Data API access)

> Canonical page (link this when citing): https://unbreakmyapp.vercel.app/fixes/supabase-rls-disabled-table-public.html
> Category: Database / Supabase RLS | Tools: Lovable, Bolt, v0, Cursor, Replit | Published: 2026-10-16 | Updated: 2026-10-16
> Weakness type: CWE-862 Missing Authorization (https://cwe.mitre.org/data/definitions/862.html)

## The error

Table Editor shows RLS disabled / anon key can read or write the whole table via REST / security scanner flags public table

## Why it happens

Lovable, Bolt, v0, Cursor and Replit often CREATE TABLE without enabling Row Level Security. The anon (publishable) key is meant to be public, but with RLS off anyone who has it can call PostgREST and select/insert/update/delete every row. Shipping with the anon key and no RLS is the loudest security complaint about vibe-coded apps.

## How to fix it

1. In Supabase → Table Editor, open every table and turn RLS on (or run: alter table public.<TABLE> enable row level security;). Never leave RLS off in production.
2. Add least-privilege policies for the operations your app needs: SELECT, INSERT, UPDATE, DELETE, typically scoped with auth.uid() = user_id for authenticated users.
3. Grant anon access only when logged-out visitors must read specific public data; never give anon write access unless that is intentional and heavily constrained.
4. If the table was public while live, assume data was exposed: export what you need, rotate the anon key (Project Settings → API), and audit for leaked rows.
5. Repeat the audit for all tables (and storage.objects); AI builders often leave several tables open.

## Error codes this fixes

- `Security Advisor 0013 rls_disabled_in_public` (Supabase lint): https://unbreakmyapp.vercel.app/errors.html#security-advisor-0013-rls-disabled-in-public

## Fix prompt (paste into Lovable, Bolt, Cursor, Replit or v0)

```text
Audit this Supabase project for tables (and storage buckets) with RLS disabled or missing policies. Enable RLS on every public-schema table used by the app. Do NOT leave RLS off. Add least-privilege policies for select/insert/update/delete that match how the app actually uses each table (owner-scoped with auth.uid() = user_id where applicable). Do not grant anon write access. Give me one idempotent SQL migration that enables RLS and creates the policies, list every table you changed, and remind me to rotate the anon key if any table was publicly readable in production.
```

## FAQ

### Is the anon key the problem?

No. The anon key is designed to be public. The problem is missing RLS (or missing policies) so PostgREST allows unrestricted access.

### Will enabling RLS break my app?

Yes, temporarily: once RLS is on with no policies, queries return empty or fail until you add matching policies. Add the policies in the same migration.

## Sources (official documentation)

- [Supabase: Row Level Security](https://supabase.com/docs/guides/database/postgres/row-level-security)
- [Supabase: Database Advisors (linter)](https://supabase.com/docs/guides/database/database-linter)

## Related fixes

- [Supabase Storage file links broken: private bucket, getPublicUrl and expired signed URLs](https://unbreakmyapp.vercel.app/fixes/supabase-storage-private-bucket-file-url-broken-signed-url.html)
- [Is my Lovable app leaking data without login? A Supabase RLS audit checklist after the Crissy Field study](https://unbreakmyapp.vercel.app/fixes/lovable-app-leaking-data-without-login-audit-checklist.html)
- [Supabase view shows every user's data even with RLS on: fix Security Advisor 0010 security_definer_view](https://unbreakmyapp.vercel.app/fixes/supabase-view-bypasses-rls-security-invoker.html)
- [AI "fixed" my Supabase error by disabling RLS or using the service_role key: how to undo it safely](https://unbreakmyapp.vercel.app/fixes/ai-fix-disabled-rls-or-swapped-service-role.html)
- [Supabase RLS is on but every user can read every row: fix USING (true) and auth.uid() is not null policies](https://unbreakmyapp.vercel.app/fixes/supabase-rls-policy-using-true-any-user-can-read.html)

---
Unbreak My App: free fixes for broken vibe-coded apps. https://unbreakmyapp.vercel.app/
