Row Level Security is the difference between "the anon key is public by design" and "the anon key reads every customer record".
Why it goes wrong
A public anon key is normal. The problem is a table with RLS disabled, a policy that allows every row, or a policy that covers reads but not writes.
A safe policy
alter table public.orders enable row level security;
create policy "own orders"
on public.orders
for select
using (auth.uid() = user_id);
Common AI mistakes
- RLS enabled on the table but no policy, so the table is closed (not a finding).
- A policy with
using (true), which makes every row public. - A policy on
selectbut not oninsert,update, ordelete. - A
service_rolekey shipped in the browser bundle.
Retest
After the change, run the scan again with the anon key. The table should return 401 or 403, not rows.