diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bec7b7..3e00513 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- RLS-Advisor-Cleanup fuer alle uebrigen Public-Tabellen angelegt. - RLS-Migration fuer tenant-bezogene Tabellen mit Membership-basierten Policies angelegt. - Audit-Log-Migration mit append-only Triggern und Tenant-Zeit-Index angelegt. - VMID-Allokator-Migration mit transaktionssicherer Reservation pro Cluster angelegt. diff --git a/TODO.md b/TODO.md index 00358f6..9e55020 100644 --- a/TODO.md +++ b/TODO.md @@ -69,6 +69,7 @@ Arbeitsliste auf Basis von `proxmox-console-entwicklungsplan.md`. Die Entwurfsda - [x] Membership-basierte SELECT-Policies angelegt - [x] Audit-Log auf owner/admin beschraenkt - [x] Direkter Query als Nicht-Mitglied lokal verifiziert + - [x] Supabase-Advisor-Follow-up: RLS auf allen uebrigen Public-Tabellen aktiviert ## MVP-Backlog @@ -115,3 +116,4 @@ Arbeitsliste auf Basis von `proxmox-console-entwicklungsplan.md`. Die Entwurfsda - 2026-06-10: VMID-Allokator-Migration `0006_vmid_allocator` angelegt und mit 50 parallelen Reservierungen lokal gegen Supabase verifiziert. - 2026-06-10: Audit-Log-Migration `0007_audit_log` angelegt und Append-only-Verhalten lokal gegen Supabase verifiziert. - 2026-06-10: RLS-Migration `0008_rls_policies` angelegt und Mitglied/Nicht-Mitglied-Isolation lokal gegen Supabase verifiziert. +- 2026-06-10: RLS-Advisor-Cleanup `0009_rls_advisor_cleanup` angelegt; alle Public-Tabellen haben RLS aktiv. diff --git a/migrations/0009_rls_advisor_cleanup.down.sql b/migrations/0009_rls_advisor_cleanup.down.sql new file mode 100644 index 0000000..dac55ae --- /dev/null +++ b/migrations/0009_rls_advisor_cleanup.down.sql @@ -0,0 +1,8 @@ +DROP POLICY IF EXISTS profiles_self_update ON public.profiles; +DROP POLICY IF EXISTS profiles_self_select ON public.profiles; + +ALTER TABLE public.vmid_reservations DISABLE ROW LEVEL SECURITY; +ALTER TABLE public.cluster_vmid_allocators DISABLE ROW LEVEL SECURITY; +ALTER TABLE public.clusters DISABLE ROW LEVEL SECURITY; +ALTER TABLE public.profiles DISABLE ROW LEVEL SECURITY; +ALTER TABLE public.schema_migrations DISABLE ROW LEVEL SECURITY; diff --git a/migrations/0009_rls_advisor_cleanup.up.sql b/migrations/0009_rls_advisor_cleanup.up.sql new file mode 100644 index 0000000..df41417 --- /dev/null +++ b/migrations/0009_rls_advisor_cleanup.up.sql @@ -0,0 +1,16 @@ +ALTER TABLE public.schema_migrations ENABLE ROW LEVEL SECURITY; +ALTER TABLE public.profiles ENABLE ROW LEVEL SECURITY; +ALTER TABLE public.clusters ENABLE ROW LEVEL SECURITY; +ALTER TABLE public.cluster_vmid_allocators ENABLE ROW LEVEL SECURITY; +ALTER TABLE public.vmid_reservations ENABLE ROW LEVEL SECURITY; + +CREATE POLICY profiles_self_select + ON public.profiles + FOR SELECT + USING (id = public.current_profile_id()); + +CREATE POLICY profiles_self_update + ON public.profiles + FOR UPDATE + USING (id = public.current_profile_id()) + WITH CHECK (id = public.current_profile_id());