Anonymous sign-in gives a visitor a signed-in session without asking for an email address or a password. The visitor can start using the app at once, for example to fill a shopping cart or try a feature, and turn the session into a real account later.
How it works in Supabase
When it is switched on in a Supabase project, the app can create an anonymous user with one call. That user gets an ID and a session like anyone else. According to the Supabase guide to anonymous sign-ins, the session uses the authenticated role, the same role as users who signed up properly. The only difference is a claim in the session, is_anonymous, which is true.
Why it matters for access rules
Many Row Level Security policies are written for the authenticated role, on the idea that a signed-in person is someone with an account. With anonymous sign-in on, that idea no longer holds. Anyone can get a signed-in session with one request, so every policy written as "to authenticated using (true)" is open to anyone who asks.
A rule that keeps users apart by comparing the owner column with the user's own ID still works, because an anonymous user owns nothing yet. The rules at risk are the wide ones: those that let every signed-in user read a whole table, add records to it or change them.
What to check
- Whether anonymous sign-in is switched on. The project's public sign-up settings say so, and the setting is under Authentication in the dashboard.
- If it is on and the app does not use it, switch it off.
- If the app does use it, make the policies that should only apply to real accounts tell the two apart, for example by adding
(auth.jwt()->>'is_anonymous')::boolean is falseto their condition. - Supabase recommends a captcha in front of anonymous sign-in, since each session is a new user in the project.
The same widening happens when a project lets anyone sign up without confirming an email address. In both cases "signed in" is a much lower bar than the policies assume. Five policies that leave a table open shows where that bites.