1
0
Fork 0
Go to file
Jonny 92adebd710 fix: never derive new user role from raw_user_meta_data (privilege escalation)
Fixes a CRITICAL finding from automated security review of a9e67ce: the
handle_new_user() trigger read the role from
new.raw_user_meta_data ->> 'role', which is attacker-controllable in
certain GoTrue flows (OAuth, invite links). A user could set
role: admin in their own signup metadata and self-escalate.

Every new user now always gets role = 'readonly' on creation; an admin
must explicitly promote via SQL/Table Editor afterwards (enforced later
by the "Admins aktualisieren alle Profile" RLS policy in Task 3).

Edited the already-applied migration file directly rather than adding a
new one, since this project has no deployment/production data yet.

Verified: inserting a user with raw_user_meta_data = {"role": "admin"}
still results in role = readonly in public.profiles.
2026-07-04 11:48:26 +02:00
docs/superpowers docs: fix plan to prevent role privilege escalation via user metadata 2026-07-04 11:42:16 +02:00
supabase fix: never derive new user role from raw_user_meta_data (privilege escalation) 2026-07-04 11:48:26 +02:00
web chore: scaffold Next.js app with Vitest 2026-07-04 10:58:26 +02:00
.gitignore chore: ignore .worktrees/ directory 2026-07-04 10:52:45 +02:00
CLAUDE.md chore: initial commit - requirements and foundation design spec 2026-07-04 10:27:07 +02:00