forked from fahrPool/fahrPool
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.
|
||
|---|---|---|
| docs/superpowers | ||
| supabase | ||
| web | ||
| .gitignore | ||
| CLAUDE.md | ||