Pedro (User B) can see and edit Ana's (User A) clients
- Severity:
- High
- Confidence:
- High · executed
Impact
Preconditions and role
Steps to reproduce
- 1Sign in as Ana and create the client “Sol Realty”.
- 2Sign out and sign in as Pedro.
- 3Open “My clients”: “Sol Realty” appears.
- 4Change its stage to “closed” and reload: the change is saved on Ana's client.
Expected
Pedro only sees and edits his own clients; the API rejects the change.
Observed
Pedro's list includes Ana's clients and the API accepts the change (204).
Evidence
GET /rest/v1/clients · Pedro
200 OK · 2 rows, 1 of Ana's
[{ "id": "c_01…", "name": "Sol Realty", "user_id": "<A>" }, …]PATCH /rest/v1/clients?id=eq.c_01… · Pedro
204 No Content · stage: "negotiation" → "closed"SELECT stage FROM clients WHERE id = 'c_01…'
"closed"Technical location
supabase/migrations/20260901_clients.sql · policy “Authenticated can read clients”Cause hypothesis
Prompt to fix it
Paste it into Claude, Cursor, Lovable, Bolt or another tool.
In my app, agents can see and edit other agents' clients. Fix access to the "clients" table so each user can only read and modify their own records (user_id = auth.uid()), both from the UI and when calling the API directly. - Create a new migration; don't edit previous migrations. - If there's an admin role that must see everything, keep that access with a separate policy. - Don't change other tables or other features of the app. - When you're done, explain what you changed so I can press "Test again" in UserB.
Was this finding useful?
Uses the included re-run. Nothing runs in this sample.