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
Check Cross-Plugin Imports / check (push) Has been cancelled
This commit is contained in:
+11
-2
@@ -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},
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user