fix: register RLS hook on gateway — agent creation was failing with policy violation
The gateway never called configure_rls_hook(engine), so SET LOCAL app.current_tenant was never set for any DB operation through the portal API endpoints. All tenant-scoped writes (agent creation, etc.) failed with "new row violates row-level security policy." Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -53,13 +53,17 @@ from shared.api import (
|
||||
webhook_router,
|
||||
)
|
||||
from shared.config import settings
|
||||
from shared.db import async_session_factory
|
||||
from shared.db import async_session_factory, engine
|
||||
from shared.rls import configure_rls_hook
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# FastAPI app
|
||||
# ---------------------------------------------------------------------------
|
||||
# Register RLS hook so tenant context is set for all DB operations
|
||||
configure_rls_hook(engine)
|
||||
|
||||
app = FastAPI(
|
||||
title="Konstruct Channel Gateway",
|
||||
description="Unified ingress for all messaging platforms",
|
||||
|
||||
Reference in New Issue
Block a user