fix: router db.refresh() nach commit bricht RLS-Kontext
SET LOCAL Werte (bypass_rls, company_id) sind transaktions-gebunden. Nach db.commit() ist der Kontext weg – ein nachfolgendes db.refresh() läuft in einer neuen Transaktion ohne RLS-Kontext und liefert 0 Rows. Da expire_on_commit=False gesetzt ist, sind alle Instanz-Attribute nach dem Commit bereits im Speicher vorhanden. Die expliziten db.refresh()-Aufrufe nach db.commit() in allen Routers sind daher redundant und wurden entfernt. test_rls.py: 6 neue Tests beweisen DB-seitige Mandanten-Isolation. conftest.py: _apply_rls() wendet RLS-Policies auf Test-DB an. migrations/0024: korrigiert auf op.execute(text()) API. migrations/env.py: SET LOCAL außerhalb Transaktion entfernt. Ergebnis: 8 failed (pre-existing), 126 passed – identisch zur Baseline vor RLS. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -638,3 +638,19 @@ Keine Commits in dieser Session.
|
||||
- update.sh | 53 +++++++++++++++++++++++------------------------------
|
||||
|
||||
---
|
||||
## 2026-05-23 21:51 – 21:58 (7m)
|
||||
**Beschreibung:** Claude Code Session
|
||||
**Projekt:** timemaster
|
||||
|
||||
### Commits
|
||||
- 6d4b8a9 agent-rls: PostgreSQL Row Level Security für Mandanten-Isolation
|
||||
|
||||
### Geänderte Dateien
|
||||
- DEVLOG.md | 79 ++++++++
|
||||
- backend/app/core/database.py | 6 +
|
||||
- backend/app/core/dependencies.py | 18 ++
|
||||
- backend/migrations/env.py | 4 +
|
||||
- .../migrations/versions/0024_row_level_security.py | 208 +++++++++++++++++++++
|
||||
- backend/tests/conftest.py | 4 +
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user