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(2.4): merge main, record the ASIA example-key fixtures, and bind the ticker's ending
Beenu Arora839c78611110
diff --git a/.gitleaksignore b/.gitleaksignoreindex 916773f16..fe606f9c2 100644--- a/.gitleaksignore+++ b/.gitleaksignore@@ -97,6 +97,24 @@ tests/test_support_bundle.py:jwt:44tests/test_support_bundle.py:private-key:62tests/test_support_bundle.py:generic-api-key:112+# The session fixtures named by the paragraph above. Each is the literal+# `ASIAIOSFODNN7EXAMPLE` standing in for the `accessKeyId` a CloudTrail+# `userIdentity` carries, because that field is the session key and a+# fixture that holds something other than a key-shaped value would assert+# the deriver works on input it will never see.+services/fusion/tests/test_sessions.py:aws-access-token:162+services/fusion/tests/test_sessions.py:aws-access-token:166+services/fusion/tests/test_sessions.py:aws-access-token:178+services/fusion/tests/test_sessions.py:aws-access-token:179+services/ingest/internal/graph/session_test.go:aws-access-token:97+services/ingest/internal/graph/session_test.go:aws-access-token:100+services/ingest/internal/graph/session_test.go:aws-access-token:118+services/ingest/internal/graph/session_test.go:aws-access-token:121+services/ingest/internal/graph/session_test.go:aws-access-token:132+services/ingest/internal/activity/session_test.go:aws-access-token:203+services/ingest/internal/activity/session_test.go:aws-access-token:207+services/ingest/internal/activity/session_test.go:aws-access-token:285+# Asserts that `api_key = '...'` in an LLM response is classified as a leak.# The string is "sk-AbCdEf0123456789xyz", invented for the assertion.services/agents/tests/test_llm_contract_extra.py:generic-api-key:185diff --git a/scripts/check_session_projection.py b/scripts/check_session_projection.pyindex 10fa0fcdd..6b065d900 100644--- a/scripts/check_session_projection.py+++ b/scripts/check_session_projection.py@@ -213,8 +213,8 @@ def check_no_invented_keys(files: list[Path], root: Path) -> list[str]:if INVENTED_KEY.search(line):findings.append(f"{rel}:{line_no}: builds a session key rather than reading one. An absent "- f"session is a real answer; a fabricated grouping makes \"what else did this "- f"session do\" answerable with a number that means nothing."+ f'session is a real answer; a fabricated grouping makes "what else did this '+ f'session do" answerable with a number that means nothing.')return findings@@ -245,7 +245,12 @@ def self_test() -> int:consumer.write_text(original)# 2. The closed set drifting in one of its three declarations.- consumer.write_text(original.replace('("vendor_session", "vendor_credential", "vendor_flow", "derived")', '("vendor_session", "vendor_credential", "derived")'))+ consumer.write_text(+ original.replace(+ '("vendor_session", "vendor_credential", "vendor_flow", "derived")',+ '("vendor_session", "vendor_credential", "derived")',+ )+ )if not any("KEY_KINDS" in f for f in run(work)):failures.append("a shrunken Python closed set was not detected")consumer.write_text(original)@@ -258,7 +263,9 @@ def self_test() -> int:migration.write_text(sql_original)# 3. A consumer inventing a key when the block is absent.- consumer.write_text(original + '\n\ndef _fallback(principal, ip, ua):\n session_key = f"{principal}|{ip}|{ua}"\n return session_key\n')+ consumer.write_text(+ original + '\n\ndef _fallback(principal, ip, ua):\n session_key = f"{principal}|{ip}|{ua}"\n return session_key\n'+ )if not any("builds a session key" in f for f in run(work)):failures.append("an invented fallback key was not detected")consumer.write_text(original)@@ -286,8 +293,10 @@ def self_test() -> int:for failure in failures:print(f"SELF-TEST FAILED: {failure}")return 1- print("self-test OK: the gate detects a second deriver, a drifted closed set in either "- "declaration, an invented fallback key, and a declaration that is missing entirely.")+ print(+ "self-test OK: the gate detects a second deriver, a drifted closed set in either "+ "declaration, an invented fallback key, and a declaration that is missing entirely."+ )return 0diff --git a/services/fusion/app/workers/consumer.py b/services/fusion/app/workers/consumer.pyindex f14ffeb32..5c255e20e 100644--- a/services/fusion/app/workers/consumer.py+++ b/services/fusion/app/workers/consumer.py@@ -422,9 +422,7 @@ class FusionWorker:await self._fuse_and_persist(alert, source_event_id=validation.source_event_id, session=session)- async def _fuse_and_persist(- self, alert: RawAlert, *, source_event_id: str | None = None, session: SessionRef | None = None- ) -> None:+ async def _fuse_and_persist(self, alert: RawAlert, *, source_event_id: str | None = None, session: SessionRef | None = None) -> None:"""Run one RawAlert through fusion, persist it, then publish it.Issue #568: the canonical, replay-stable alert id and source-eventdiff --git a/services/fusion/tests/test_sessions.py b/services/fusion/tests/test_sessions.pyindex eaab8b9d9..5267512bb 100644--- a/services/fusion/tests/test_sessions.py+++ b/services/fusion/tests/test_sessions.py@@ -10,7 +10,6 @@ arguments have to satisfy is asserted against the migration itself.from __future__ import annotationsimport asyncio-import contextlibimport jsonimport reimport uuid@@ -354,8 +353,14 @@ async def test_the_idle_sweep_runs_from_the_worker_rather_than_nowhere():breakworker._running = Falsetask.cancel()- with contextlib.suppress(asyncio.CancelledError):- await task+ # Bound rather than discarded. `return_exceptions=True` hands back+ # *how* the ticker ended instead of raising it, which is the thing+ # worth asserting: clearing `_running` can retire the loop before+ # `cancel()` reaches it, so either ending is correct -- but a sweeper+ # that died of its own exception is not, and a bare `await task`+ # cannot tell the three apart.+ (ended,) = await asyncio.gather(task, return_exceptions=True)+ assert ended is None or isinstance(ended, asyncio.CancelledError), f"the sweep ticker raised {ended!r} rather than stopping cleanly"finally:monkeypatch.undo()