← All posts

The one Supabase setting that leaks everything

Steven Nagie, Founder, Aspenglow1 min read
  • Security
  • Going to production

Row-level security is off by default, and an AI builder will happily ship a working app that never turns it on.

A generated app talks to the database with the anon key. That key is public — it ships in the browser bundle, by design. What stops a visitor reading every row is row-level security, and it is off until you turn it on.

Checking it

Every table you care about should come back with rowsecurity set to true:

select tablename, rowsecurity from pg_tables where schemaname = 'public';

Enabling it without writing a policy denies everything, which looks like the app breaking. That is the correct order — deny first, then grant deliberately.

  • Enable RLS on every table in the public schema.
  • Write one policy per access pattern you actually want.
  • Test as an anonymous visitor, not as the service role.

That last point is where most self-checks go wrong: the service role bypasses RLS entirely, so testing with it proves nothing.