feat: add tenant authorization middleware

This commit is contained in:
Philipp
2026-06-11 08:14:22 +02:00
parent b08b52dd1b
commit 452d4c5f71
10 changed files with 432 additions and 1 deletions
+13 -1
View File
@@ -82,11 +82,21 @@ Arbeitsliste auf Basis von `proxmox-console-entwicklungsplan.md`. Die Entwurfsda
- [x] `profiles` wird idempotent per `insert ... on conflict` erstellt/aktualisiert
- [x] Profil-Sync-Middleware mit Unit-Tests angelegt
- [x] `/me` fuehrt Profil-Sync vor Handler-Ausfuehrung aus
- [x] E4-T01: Mitgliedschafts-Resolver
- [x] Tenant-Mitgliedschaft aus `profiles`/`memberships` anhand JWT-`sub` geladen
- [x] Tenant-ID aus Request-Route ableitbar gemacht
- [x] Mitgliedschaft und Rolle im Request-Context bereitgestellt
- [x] Nicht-Mitglieder erhalten `403`
- [x] E4-T02: Policy-/Permission-Funktion
- [x] Rollen und Aktionen zentral definiert
- [x] `Can(role, action)` angelegt
- [x] Tabellengetriebene Unit-Tests fuer Rollen/Aktionen angelegt
- [x] `cluster.manage` fuer Tenant-Rollen bewusst verweigert
- [x] E4-T03: Autorisierungs-Middleware
- [x] Deklarativen `Require(action, handler)` Helper angelegt
- [x] Rollenpruefung nutzt zentrale `rbac.Can` Policy-Funktion
- [x] Fehlende oder unzureichende Rechte liefern `403`
- [x] Tenant-Membership-Endpunkt exemplarisch mit `project.read` geschuetzt
- [x] E10-Vorgriff: Frontend-Prototyp
- [x] Supabase Auth Login/Registrierung angebunden
- [x] Backend-`/me` Profil-Sync-Pruefung angebunden
@@ -97,7 +107,7 @@ Arbeitsliste auf Basis von `proxmox-console-entwicklungsplan.md`. Die Entwurfsda
- [ ] E1: Supabase Auth, JWT-Middleware und Profil-Sync
- [ ] E2: Datenmodell, Migrationen, RLS und VMID-Allokator
- [ ] E3: Envelope-Encryption, Cluster-Repository und Proxmox-Client
- [ ] E4: RBAC, Policy-Funktion und Autorisierungs-Middleware
- [ ] E4: RBAC, Membership-Resolver, Policy-Funktion und Autorisierungs-Middleware
- [ ] E6: Worker-Grundgeruest und UPID-Polling
- [ ] E5: VM-Liste, Detail, Power-Aktionen und Reconciliation
- [ ] E7: SSH-Keys, Templates und Provisioning
@@ -142,3 +152,5 @@ Arbeitsliste auf Basis von `proxmox-console-entwicklungsplan.md`. Die Entwurfsda
- 2026-06-10: Profil-Sync-Tests erfolgreich; lokaler `/me` Request legt genau ein `profiles`-Profil an.
- 2026-06-10: RBAC-Policy-Funktion mit tabellengetriebenen Rollen/Aktions-Tests erfolgreich.
- 2026-06-10: Frontend-Prototyp mit Supabase Auth und Backend-`/me` Check erfolgreich gebaut.
- 2026-06-11: Membership-Resolver mit Middleware-Tests fuer erlaubte, fehlende und verbotene Tenant-Zugriffe angelegt.
- 2026-06-11: Autorisierungs-Middleware mit Tests fuer erlaubte, fehlende und verweigerte Permissions angelegt.