Question

Lovable app: users see each other's data after login

Solved · 18 views · asked by noor_builds · edited

Two test accounts, both see the same list of projects. I thought Supabase separated users automatically.

What I’ve tried

Asked Lovable to "make projects private per user". It added a filter in the frontend, but if I remove the filter in the network tab I still get everything.

Comment

2 answers

Marked as helpful by the asker
mira_dev · edited

Supabase does not separate users automatically, RLS does, and it is off by default on new tables. A frontend filter is decoration; the database must refuse.

alter table projects enable row level security;
create policy "own projects" on projects
  for all using (auth.uid() = owner_id) with check (auth.uid() = owner_id);

Then test it the way you already did: remove the filter in the network tab. You should get an empty list. Do this for every table with user data, and assume the same bug exists in every other table Lovable created.

Comment
lena_ops · edited

Supabase has a Security Advisor in the dashboard that lists tables without RLS. Run it after every Lovable change.

Comment