Bug Description
The profiles table in Supabase has no Row Level Security policy scoping reads to the authenticated user's own row. Using the publicly exposed VITE_SUPABASE_ANON_KEY, any visitor can retrieve the email address and profile data of every registered user.
Steps to Reproduce
- Extract
VITE_SUPABASE_ANON_KEY from the browser bundle.
- Run:
curl 'https://<project>.supabase.co/rest/v1/profiles?select=id,email' \
-H 'apikey: <anon_key>' -H 'Authorization: Bearer <anon_key>'
- Observe: all profile records returned without authentication.
Root Cause
RLS is not enabled on profiles, or the policy is missing the USING clause that restricts reads to the owner:
-- missing policy:
CREATE POLICY "users view own profile"
ON profiles FOR SELECT
USING (auth.uid() = id);
Impact
Mass PII exposure: names, emails, and profile metadata of all registered users harvested without any authentication.
Proposed Fix
ALTER TABLE profiles ENABLE ROW LEVEL SECURITY;
CREATE POLICY "owner_read" ON profiles
FOR SELECT USING (auth.uid() = id);
CREATE POLICY "owner_update" ON profiles
FOR UPDATE USING (auth.uid() = id);
Bug Description
The
profilestable in Supabase has no Row Level Security policy scoping reads to the authenticated user's own row. Using the publicly exposedVITE_SUPABASE_ANON_KEY, any visitor can retrieve the email address and profile data of every registered user.Steps to Reproduce
VITE_SUPABASE_ANON_KEYfrom the browser bundle.Root Cause
RLS is not enabled on
profiles, or the policy is missing theUSINGclause that restricts reads to the owner:Impact
Mass PII exposure: names, emails, and profile metadata of all registered users harvested without any authentication.
Proposed Fix