P0+P1 fixes: RCE sandbox, SQL injection, RLS tenant isolation, DB roles, test syntax, attachment, permission registry, membership check
Check Cross-Plugin Imports / check (push) Has been cancelled

This commit is contained in:
Agent Zero
2026-07-29 12:28:08 +02:00
parent 81ae5b7cb6
commit 26bf8d3a31
12 changed files with 423 additions and 39 deletions
+11 -2
View File
@@ -99,10 +99,19 @@ async def get_db() -> AsyncGenerator[AsyncSession, None]:
async def set_tenant_context(session: AsyncSession, tenant_id: uuid.UUID | str) -> None:
"""Set PostgreSQL session variable for RLS tenant context."""
"""Set PostgreSQL session variable for RLS tenant context.
Sets both app.current_tenant_id (new standard) and app.tenant_id
(legacy, used by migration 0044 policies) for backward compatibility.
"""
tid = str(tenant_id)
await session.execute(
text("SELECT set_config('app.current_tenant_id', :tid, true)"),
{"tid": str(tenant_id)},
{"tid": tid},
)
await session.execute(
text("SELECT set_config('app.tenant_id', :tid, true)"),
{"tid": tid},
)