db: add temporary-password marker backfill
This commit is contained in:
parent
46b4e94689
commit
93d13d3878
15
ops/sql/SUPABASE-V17.7.4-PASSWORD-SECURITY.sql
Normal file
15
ops/sql/SUPABASE-V17.7.4-PASSWORD-SECURITY.sql
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
-- Caterium v17.7.4: move mandatory temporary-password state to server-controlled app metadata.
|
||||||
|
-- Legacy user_metadata is client-editable and must not be trusted for this security state.
|
||||||
|
|
||||||
|
begin;
|
||||||
|
|
||||||
|
update auth.users
|
||||||
|
set raw_app_meta_data = coalesce(raw_app_meta_data, '{}'::jsonb)
|
||||||
|
|| jsonb_build_object(
|
||||||
|
'must_change_password', true,
|
||||||
|
'password_policy_version', 'v1774'
|
||||||
|
)
|
||||||
|
where lower(coalesce(raw_user_meta_data->>'must_change_password', '')) = 'true'
|
||||||
|
and lower(coalesce(raw_app_meta_data->>'must_change_password', 'false')) <> 'true';
|
||||||
|
|
||||||
|
commit;
|
||||||
Loading…
Reference in New Issue
Block a user