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(war-rooms): register the in-band credentials the four bot routes and the decision route carry

Beenu Aroraf354a50e0dde
diff --git a/scripts/check_route_auth.py b/scripts/check_route_auth.py
index d9692757e..4fd35df69 100644
--- a/scripts/check_route_auth.py
+++ b/scripts/check_route_auth.py
@@ -171,6 +171,29 @@ IN_BAND_CREDENTIAL_ROUTES: dict[str, tuple[str, str]] = {
"_authorized",
"internal call authenticated by a shared X-AiSOC-Internal-Token compared in constant time, failing closed when unset",
),
+ # Depth 9.4. The four war-room routes carry the same credential as the
+ # notify routes above and for the same reason: the caller is an AiSOC
+ # service, not the chat vendor, so there is no vendor signature to
+ # verify. `_authorized` is the identical constant-time comparison that
+ # fails closed when the token is unset, with no dev-mode exemption —
+ # a route that creates channels in somebody's workspace must not be
+ # open to whatever can reach the pod.
+ "services/slack-bot/app/war_room.py::open_war_room": (
+ "_authorized",
+ "internal call authenticated by a shared X-AiSOC-Internal-Token compared in constant time, failing closed when unset",
+ ),
+ "services/slack-bot/app/war_room.py::post_to_war_room": (
+ "_authorized",
+ "internal call authenticated by a shared X-AiSOC-Internal-Token compared in constant time, failing closed when unset",
+ ),
+ "services/teams-bot/app/war_room.py::open_war_room": (
+ "_authorized",
+ "internal call authenticated by a shared X-AiSOC-Internal-Token compared in constant time, failing closed when unset",
+ ),
+ "services/teams-bot/app/war_room.py::post_to_war_room": (
+ "_authorized",
+ "internal call authenticated by a shared X-AiSOC-Internal-Token compared in constant time, failing closed when unset",
+ ),
"services/teams-bot/app/notify.py::post_approval_card": (
"_authorized",
"internal call authenticated by a shared X-AiSOC-Internal-Token compared in constant time, failing closed when unset — the "
@@ -268,6 +291,15 @@ IN_BAND_CREDENTIAL_ROUTES: dict[str, tuple[str, str]] = {
"X-AiSOC-Service-Token is compared in constant time and fails closed when unset. An analyst reaches the same data through "
"GET /graph/incident-context/{alert_id}, which authenticates by session and traverses from the alert",
),
+ "services/api/app/api/v1/endpoints/war_rooms.py::channel_decision": (
+ "service_token_valid",
+ "the chat bot delivers a decision taken in the channel here and holds no session; the shared X-AiSOC-Service-Token is "
+ "compared in constant time and fails closed when unset. Deliberately no session fallback: the bot has already verified "
+ "the vendor's signature on the interaction and this service cannot re-verify it, holding no workspace secret — so the "
+ "token is the whole trust relationship and CHANNEL_DECISIONS is its blast radius, four verbs none of which closes a case. "
+ "The tenant comes from the war-room row the bot named, never from the request body, so there is no tenant field to get "
+ "wrong",
+ ),
"services/api/app/api/v1/endpoints/knowledge_base.py::retrieve_runbooks_for_triage": (
"service_token_valid",
"the agents service retrieves this tenant's runbooks here on the path of a triage and holds no session; the shared "
diff --git a/services/teams-bot/app/war_room.py b/services/teams-bot/app/war_room.py
index 0ec3e39c7..f43ff1232 100644
--- a/services/teams-bot/app/war_room.py
+++ b/services/teams-bot/app/war_room.py
@@ -270,8 +270,8 @@ async def post_to_war_room(
# suppression sits on the reported line and nowhere else. Any
# *other* URL built from a request in this file still fails the
# query.
- res = await http.post( # codeql[py/partial-ssrf]
- f"{GRAPH}/teams/{team_id}/channels/{quote(channel_id, safe='')}/messages",
+ res = await http.post(
+ f"{GRAPH}/teams/{team_id}/channels/{quote(channel_id, safe='')}/messages", # codeql[py/partial-ssrf]
headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"},
json={"body": {"content": body.text}},
)