Skip to content

armgit / AiSOC

Public Imported from GitHub
0

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.

fix(ci): close the six breakers blocking both required Python checks on main (#1215)

Beenu Arora4067cbaf4dbc
diff --git a/apps/docs/docs/compliance/evidence-pack.md b/apps/docs/docs/compliance/evidence-pack.md
index b8f26262e..c105d9e43 100644
--- a/apps/docs/docs/compliance/evidence-pack.md
+++ b/apps/docs/docs/compliance/evidence-pack.md
@@ -33,7 +33,7 @@ and says so.
| Prompt-injection resistance | Three adversarial corpora: 32 payloads scanned in isolation and 71 incident pairs whose payloads are placed in attacker-controllable fields, both against a clean twin with a recall floor and a false-positive ceiling, plus 34 held-out pairs authored after the guard was frozen and carrying no floor at all, on which the guard measures 7.1% | `services/agents/tests/adversarial/` |
| Claim-to-gate traceability | Every product claim mapped to the CI job that fails when it stops being true | `docs/audit/CLAIM_TO_GATE_MATRIX.md` |
-The last row is the one worth reading first. It is the honest index: 289 rows
+The last row is the one worth reading first. It is the honest index: 292 rows
`GATED`, 1 `PARTIAL`, and a ratchet that refuses to let a row sit at
`NO GATE`. Re-read the figure from the table rather than from here — a count
copied into prose goes stale in silence, which is why
diff --git a/apps/docs/docs/quickstart.md b/apps/docs/docs/quickstart.md
index d78c486ea..e8fb12450 100644
--- a/apps/docs/docs/quickstart.md
+++ b/apps/docs/docs/quickstart.md
@@ -237,7 +237,7 @@ does not.
| *(default — CORE)* | **postgres** (5432) · **redis** (6379) · **zookeeper** · **kafka** (9092) · **qdrant** (6333) · **litellm** (4000, LLM gateway) · **ollama** (11434, local model) · **ollama-pull** (one-shot model fetch) · **ingest-worker** (8081, Go) · **fusion** (8003) · **api** (8000) · **agents** (8001) · **threatintel** (8005) · **realtime** (8086) · **web** (3000) · **connectors** (8088) · **actions** (8002) |
| `full` | **clickhouse** (8123/9000) · **neo4j** (7474/7687) · **opensearch** (9200) · **ueba** (8007) · **enrichment** (8080, Go) · **kafka-ui** (8090) |
| `extras` | **honeytokens** (8008) · **purple-team** (8006) |
-| `chatops` | **slack-bot** (8009) |
+| `chatops` | **slack-bot** (8009) · **teams-bot** (8010) |
| `monitoring` | **prometheus** (9091) · **grafana** (3001) · **alertmanager** (9094) · **tempo** (3200) · **otel-collector** (4317/4318) |
| `osquery` | **osquery-tls** (8091) |
@@ -248,7 +248,7 @@ federated search defaults on, so the capability was enabled and aimed at a
hostname that does not resolve; the measured cost of moving them is 124.8 MiB
([ADR-0007](https://github.com/beenuar/AiSOC/blob/main/docs/decisions/0007-connectors-and-actions-in-core.md)).
They are now in no profile, which means every profile run includes them, so
-`chatops` still gets `actions` for `slack-bot`. Named profiles compose, so
+`chatops` still gets `actions` for both chat bots. Named profiles compose, so
`docker compose --profile full --profile extras up -d` is valid; it just does
not wait for health the way `make up-full` does.
diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml
index 7bd2dca1d..e540d262e 100644
--- a/docker-compose.prod.yml
+++ b/docker-compose.prod.yml
@@ -449,6 +449,12 @@ services:
condition: service_completed_successfully
ports: !reset []
+ teams-bot:
+ depends_on:
+ preflight-secrets:
+ condition: service_completed_successfully
+ ports: !reset []
+
tempo:
depends_on:
preflight-secrets:
diff --git a/services/teams-bot/app/notify.py b/services/teams-bot/app/notify.py
index 9837ff868..2335e9938 100644
--- a/services/teams-bot/app/notify.py
+++ b/services/teams-bot/app/notify.py
@@ -79,7 +79,9 @@ def _authorized(supplied: str | None) -> bool:
expected = os.environ.get("AISOC_INTERNAL_TOKEN", "").strip()
if not expected:
return False
- return bool(supplied) and hmac.compare_digest(supplied.strip(), expected)
+ if not supplied:
+ return False
+ return hmac.compare_digest(supplied.strip(), expected)
@router.post("/approval-card", status_code=status.HTTP_202_ACCEPTED)
diff --git a/services/teams-bot/tests/test_notify.py b/services/teams-bot/tests/test_notify.py
index 9119b534b..9b863092a 100644
--- a/services/teams-bot/tests/test_notify.py
+++ b/services/teams-bot/tests/test_notify.py
@@ -44,6 +44,26 @@ def test_an_unset_internal_token_refuses_everything(monkeypatch: pytest.MonkeyPa
assert response.status_code == 401
[email protected]("supplied", ["", " ", "wrong", "tok-with-suffix"])
+def test_a_token_that_is_not_the_configured_one_is_refused(client: TestClient, supplied: str) -> None:
+ """Pins each branch of the comparison, including the empty header.
+
+ `_authorized` reached these cases through `bool(supplied) and ...`,
+ which does not narrow `str | None` for a type checker. Rewriting it as
+ an early return does, and these are the inputs that would show a
+ behaviour change if the rewrite had introduced one -- an empty or
+ whitespace header in particular, which the truthiness test rejected
+ before reaching the compare and the early return rejects at the same
+ point.
+ """
+ response = client.post(
+ "/internal/approval-card",
+ json={"action": _ACTION},
+ headers={"X-AiSOC-Internal-Token": supplied},
+ )
+ assert response.status_code == 401, f"{supplied!r} was accepted as the internal token"
+
+
def test_no_configured_webhook_is_reported_not_failed(client: TestClient, monkeypatch: pytest.MonkeyPatch) -> None:
"""202 with ``posted: false``.