Supabase is a common backend for Lovable, Bolt, and Cursor apps. Row-level security is the mechanism that keeps users from reading each other's data. AI tools get it wrong in predictable ways.
RLS is off entirely
The most common mistake. The table exists, the data is there, but RLS is disabled, so the anon key can read and write everything. Enable RLS on every table that holds user data, then add policies.
Policies that are too permissive
Policies like USING (true) or policies that check a column the client can set grant access to everyone. A policy must tie the row to the authenticated user, typically via auth.uid().
Checking the frontend instead of the database
The UI hides records, but the database returns them. The test is not "does the screen look right"; it is "does the API return another user's row." Test with a second account and a direct API call.
Service-role key in client code
The service-role key bypasses RLS. If it appears in the browser bundle or a client-side function, every user has admin access. Move it server-side only and rotate it if it was ever exposed.
How to verify
- List every table and confirm RLS is enabled.
- Read every policy and confirm it references
auth.uid()or a trusted server value. - Create two test users and attempt cross-account reads and writes through the API, not the UI.
- Scan the shipped JavaScript for
service_roleandSUPABASE_SERVICE_ROLE.
Run the 24-point checklist → See the production readiness audit →