LeakLatch

Blog · November 21, 2026

Your Supabase users can make themselves admin if RLS trusts user_metadata

A common AI-written policy checks auth.jwt() -> 'user_metadata' ->> 'role' = 'admin'. It looks safe. It isn't.

Supabase's RLS docs warn that user_metadata can be modified by authenticated end users. Any signed-in user can call supabase.auth.updateUser({ data: { role: 'admin' } }) from the browser console, refresh their session, and pass your admin policy.

Fix: store roles and plan flags in raw_app_meta_data (users can't change it) or in a roles table, and point your policies there. Also write auth.uid() IS NOT NULL AND auth.uid() = user_id, since auth.uid() is null for logged-out requests.

Source: https://supabase.com/docs/guides/database/postgres/row-level-security

Check your live app for readable Supabase tables and leaked keys with a free, read-only scan at https://leaklatch.vercel.app