Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.
Python agentic-aiai-securityalert-triageblue-teamcybersecuritydetection-engineeringincident-responselanggraphllm-agentsmcpmitre-attackmodel-context-protocolpurple-teamsecurity-operationsself-hostedsiemsoarsocthreat-detectionthreat-intelligence
fix(taxii-live): run the suite as the runtime role, not the superuser
Beenu Arorad973307db577
diff --git a/.github/workflows/taxii-live.yml b/.github/workflows/taxii-live.ymlindex 921c8a2c3..5a58eca53 100644--- a/.github/workflows/taxii-live.yml+++ b/.github/workflows/taxii-live.yml@@ -46,7 +46,16 @@ jobs:--health-retries 20env:- TAXII_DSN: postgresql+asyncpg://aisoc:aisoc_ci_only@localhost:5432/aisoc+ # The runtime role, not the owner. POSTGRES_USER (aisoc) is a+ # superuser and ignores every RLS policy even under FORCE ROW LEVEL+ # SECURITY, so a suite proving tenant scoping while connected as it+ # would pass with the policies removed.+ TAXII_DSN: postgresql+asyncpg://aisoc_app:aisoc_app_ci_only@localhost:5432/aisoc+ # The owner, used only to run migrations and to seed the fixture's+ # two tenants — rows the runtime role is correctly not allowed to+ # write, because its RLS WITH CHECK requires a tenant it has not+ # been given.+ TAXII_DATABASE_MIGRATION_URL: postgresql+asyncpg://aisoc:aisoc_ci_only@localhost:5432/aisocPGPASSWORD: aisoc_ci_only# Not a bypass environment. The suite constructs its principal# directly, but a tree where `development` is in scope could grow a@@ -86,6 +95,14 @@ jobs:# the tenant's whole store on every request. Asserted rather than# assumed: a migration that ran and created nothing is the shape this# repository keeps finding.+ - name: Give the runtime role its password+ run: |+ set -euo pipefail+ psql -h localhost -U aisoc -d aisoc -v ON_ERROR_STOP=1 -q -c \+ "ALTER ROLE aisoc_app WITH PASSWORD 'aisoc_app_ci_only';"+ psql -h localhost -U aisoc -d aisoc -v ON_ERROR_STOP=1 -q -c \+ "GRANT USAGE ON SCHEMA public TO aisoc_app;"+- name: The paging index existsrun: |set -euo pipefail@@ -101,6 +118,7 @@ jobs:working-directory: services/apienv:ISOLATION_TAXII_DSN: ${{ env.TAXII_DSN }}+ ISOLATION_TAXII_ADMIN_DSN: ${{ env.TAXII_DATABASE_MIGRATION_URL }}DATABASE_URL: ${{ env.TAXII_DSN }}run: python -m pytest ../../tests/isolation/test_taxii_server_live.py -v --tb=short@@ -111,6 +129,7 @@ jobs:working-directory: services/apienv:ISOLATION_TAXII_DSN: ${{ env.TAXII_DSN }}+ ISOLATION_TAXII_ADMIN_DSN: ${{ env.TAXII_DATABASE_MIGRATION_URL }}DATABASE_URL: ${{ env.TAXII_DSN }}run: |set -euo pipefail@@ -135,6 +154,7 @@ jobs:working-directory: services/apienv:ISOLATION_TAXII_DSN: ${{ env.TAXII_DSN }}+ ISOLATION_TAXII_ADMIN_DSN: ${{ env.TAXII_DATABASE_MIGRATION_URL }}DATABASE_URL: ${{ env.TAXII_DSN }}run: |set -euo pipefaildiff --git a/tests/isolation/test_taxii_server_live.py b/tests/isolation/test_taxii_server_live.pyindex 9a3decd92..83bbbaec2 100644--- a/tests/isolation/test_taxii_server_live.py+++ b/tests/isolation/test_taxii_server_live.py@@ -47,6 +47,21 @@ def _dsn() -> str:return value+def _admin_dsn() -> str:+ """The owner connection, used only to seed and tear down fixtures.++ The suite itself runs as the DML-only runtime role, because a suite+ proving tenant scoping while connected as a superuser would pass+ with every RLS policy removed. The runtime role cannot insert a+ tenant — its WITH CHECK requires a tenant it has not been given —+ so the fixture needs the owner, and nothing else does.+ """+ value = os.environ.get("ISOLATION_TAXII_ADMIN_DSN", "").strip() or _dsn()+ if value.startswith("postgresql://"):+ return value.replace("postgresql://", "postgresql+asyncpg://", 1)+ return value++@pytest_asyncio.fixture(scope="module", loop_scope="module")async def engine():from sqlalchemy.ext.asyncio import create_async_engine@@ -59,7 +74,18 @@ async def engine():@pytest_asyncio.fixture(scope="module", loop_scope="module")-async def world(engine):+async def admin_engine():+ from sqlalchemy.ext.asyncio import create_async_engine++ eng = create_async_engine(_admin_dsn())+ try:+ yield eng+ finally:+ await eng.dispose()+++@pytest_asyncio.fixture(scope="module", loop_scope="module")+async def world(admin_engine):"""Two tenants, each with a collection and indicators.Tenant B exists so every read in this suite is a cross-tenant read@@ -72,7 +98,7 @@ async def world(engine):tenant_b = uuid.uuid4()base = datetime(2026, 10, 11, 9, 0, 0, tzinfo=UTC)- async with engine.begin() as conn:+ async with admin_engine.begin() as conn:for tid, slug in ((tenant_a, "taxii-a"), (tenant_b, "taxii-b")):await conn.execute(text("INSERT INTO tenants (id, name, slug) VALUES (:id, :n, :s)"),@@ -127,7 +153,7 @@ async def world(engine):"base": base,}- async with engine.begin() as conn:+ async with admin_engine.begin() as conn:for tid in (tenant_a, tenant_b):await conn.execute(text("DELETE FROM tenants WHERE id = :id"), {"id": str(tid)})