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
Merge remote-tracking branch 'origin/main' into depth/9.4-war-rooms
Beenu Arorac0afce6f7829
diff --cc DEPTH_PROGRESS.mdindex d6509392c,5567c305c..ee842c759--- a/DEPTH_PROGRESS.md+++ b/DEPTH_PROGRESS.md@@@ -486,34 -673,35 +673,64 @@@ endpoint produces once triage falls thragainst real Postgres 16, real Qdrant v1.7.0 and a real embedding backend,recorded in the PR. **The measurement is published as it came out, and it isunflattering:** see D11.+ - [x] **9.3** Case depth (parity 5.6 remainder). All four open bullets.+ **Alert merge needed no schema at all**: `is_merged`, `parent_alert_id` and+ `child_alert_ids` have been on `alerts` since migration 001 with the ORM+ model as their only mention anywhere — the repository's recurring defect,+ and worth naming so "new" means something. Merge keeps every row: a+ duplicate is marked and pointed at its parent, the survivor's children are+ **appended** not replaced, re-merging and merging into a merged alert are+ both refused because each would orphan or cycle the chain, and the+ survivor inherits the case a duplicate was already on. Case merge (migration+ `106`) repoints the alerts and keeps both case rows, because deleting loses+ the audit chain, the custody entries and any vendor ticket already naming+ that id. Bulk triage is new in the route **and** the console: a checkbox per+ row, a select-all that selects this page only, and a bar whose Apply+ performs a real write and surfaces the preflight 409 with the real matched+ count instead of silently retrying. `closed` is deliberately unreachable+ there — `bulk-close` snapshots every row first and a weaker second path to+ one destination is how the weaker one wins. Tenant custom fields are two+ tables rather than a JSONB blob so a field can be enumerated, rendered,+ validated at write time and retired cleanly; values are canonicalised on+ write. Workload is counted per request over rows the query selected, a+ merged-away case is not counted as work, and **a mean over nothing is+ `null`, never `0.0`** — with the count it was taken over beside it. Graded+ by `.github/workflows/case-depth-live.yml` against a real Postgres with+ three negative controls, because every statement here is Postgres-only and+ a SQLite stand-in would be a different query. 29 new tests (23 API live, 6+ web). The live suite earned its keep immediately: it caught that+ `aisoc_cases.alert_ids` is `uuid[]` while the two columns beside it are+ JSONB, which a stand-in would have accepted.+ - [ ] **9.4** War rooms+++- [ ] **9.3** Case depth (parity 5.6 remainder)+- [~] **9.4** War rooms. **Slack is complete; Teams is built and+ maintainer-blocked, and the block is stated in the product rather than+ here.** One action (`POST /war-rooms/cases/{id}`, and a console panel on+ the case) creates the channel, invites the assignees, posts the case+ header and records the room; a sweep worker posts the timeline and+ verdicts as they change; a decision taken in the channel comes back onto+ the case through a service-token-only route. Idempotency is the design+ rather than a refinement: every post is keyed by a fingerprint of the+ *event value*, unique per room, so a retry is a no-op, two replicas cannot+ double-post, and a case that goes `open → closed → open` posts three times+ because a re-opened case is news. The sweep derives its events from the+ case row rather than a cursor, so a missed tick cannot lose one. Opening+ fails **loudly** (502 carrying the vendor's own sentence) because an+ analyst pressed a button; syncing fails **soft** and records `last_error`,+ which the console renders — a room that has silently stopped mirroring is+ worse than one that was never opened, and "never synced" renders+ differently from "synced with nothing to say". A chat button reaches four+ verbs and **`close` is not one of them**. 37 new tests (17 slack-bot, 9+ teams-bot, 11 API). **Open and stated, not inferred:** creating a Teams+ channel needs Microsoft Graph with an Entra application registration and+ admin consent, which no maintainer has provisioned, so that route answers+ **501 naming all four missing settings** and deliberately does not fall+ back to the incoming webhook — one shared channel per deployment would put+ the next incident's traffic in the last one's thread. The Graph calls+ themselves have therefore never run against a real tenant. Neither has the+ Slack path against a real workspace: it is covered by 17 tests against a+ fake client, and no Slack token exists here.- [ ] **9.5** Hunt to report- [ ] **9.6** Native responder@@@ -526,7 -714,7 +743,9 @@@| Date | Item | What happened ||---|---|---|+ | 2026-10-11 | 9.3 | Reproduced: the alert merge columns had zero writers outside the ORM model; `grep -rn custom_field services/api` and `grep -rn workload` (excluding workload *identities*) both counted zero; and `grep -rn bulk apps/web/src/components/alerts` found only unrelated comments, so the only bulk verb in the product was `POST /alerts/bulk-close` with no console surface at all. The two-case-table trap named in the brief was already closed by migration 083 and `check_one_case_table.py` reports OK, so `aisoc_cases` is the table this item deepens. Three negative controls recorded in the PR and wired into the live workflow. The live suite found a real defect on its first run: `aisoc_cases.alert_ids` is `uuid[]` while `ioc_ids` and `artifact_ids` beside it are JSONB, and the merge statement had assumed JSONB. |+++| 2026-10-11 | 9.4 | Reproduced: `grep -rn 'conversations.create|channels.create|war_room'` across every service and the console returned four hits, all prose — a playbook template describing a "Notify war-room" step and an eval fixture quoting the phrase. Both bots could only answer: slack-bot had one outbound route (an approval card) and teams-bot posts to a hand-configured webhook. Built the channel creation, the keyed sweep, the decision route and the console panel. Teams is 501 with its four missing settings named, which is the honest state and the one a stock install is in. || 2026-10-11 | 9.2 | Reproduced: `knowledge_base.py` searched with `to_tsvector`/`plainto_tsquery` and nothing else; `grep -rn qdrant services/api/app/` found only the migration runner and the tenant-deletion sweep, no recall path; and no memory row anywhere carried an author, a source, a scope, an expiry or a state. Built the store of record, the Qdrant index over it, the conflict state machine, the case-closure writer and the recall scorer. Two negative controls recorded in the PR: restoring last-write-wins on a contradiction fails three tests, and restoring vector truncation fails one. The measurement is negative and is published as such — see D11, which also records that it caught the truncation defect. || 2026-10-07 | 0.1 | This file created at base commit `1b8bc2d4`. || 2026-10-07 | 0.2 | Every figure re-derived. Two matched exactly (detections, unreachable families); executor arms measured 74 against a captured 73; the cloud/identity/SaaS/code figure measured 395 against a captured 461 on a grouping the plan does not pin, recorded above. Two measurement caveats found: executable and quarantined overlap by 1,724 rules, and the "69% Windows" figure does not reproduce from the index. |diff --cc docs/openapi.yamlindex 8498c7eb1,977d4b391..84d86e45b--- a/docs/openapi.yaml+++ b/docs/openapi.yaml@@@ -2070,55 -2070,237 +2070,145 @@@ pathsapplication/json:schema:$ref: '#/components/schemas/HTTPValidationError'- /api/v1/war-rooms/cases/{case_id}:+ /api/v1/case-depth/alerts/merge:post:tags:+ - case-depth+ summary: Merge Alerts Route+ description: Fold duplicate alerts into one. Every row survives.+ operationId: merge_alerts_route_api_v1_case_depth_alerts_merge_post+ requestBody:+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/MergeRequest'+ required: true+ responses:+ '200':++++ /api/v1/war-rooms/cases/{case_id}:+ - war-rooms+ summary: Open For Case+ description: 'One action: create the channel, invite, post the header, record+ it.+++ Fails loudly. The analyst pressed a button and is entitled to know when++ it did not work — a 202 "we''ll try" here would be the toast-only control++ this console is not allowed to ship.'+ operationId: open_for_case_api_v1_war_rooms_cases__case_id__post+ security:+ - HTTPBearer: []+ parameters:+ - name: case_id+ in: path- required: true- schema:+ type: string+ format: uuid+ title: Case Id- requestBody:- required: true- content:- application/json:- schema:+ $ref: '#/components/schemas/OpenWarRoomRequest'- responses:+ '201':description: Successful Responsecontent:application/json:schema:+ $ref: '#/components/schemas/MergeResponse'+++ $ref: '#/components/schemas/WarRoomModel''422':description: Validation Errorcontent:application/json:schema:$ref: '#/components/schemas/HTTPValidationError'- get:+ security:+ - HTTPBearer: []+ /api/v1/case-depth/cases/merge:+ post:tags:+ - case-depth+ summary: Merge Cases Route+ description: Fold duplicate cases into one. Alerts follow; both rows survive.+ operationId: merge_cases_route_api_v1_case_depth_cases_merge_post+ requestBody:+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/MergeRequest'+ required: true+ responses:+ '200':+ description: Successful Response- content:- application/json:- schema:+ $ref: '#/components/schemas/MergeResponse'+ '422':+ description: Validation Error- content:- application/json:- schema:+ $ref: '#/components/schemas/HTTPValidationError'- security:- - HTTPBearer: []+ /api/v1/case-depth/alerts/bulk-triage:- post:- tags:- - case-depth+ summary: Bulk Triage Route+ description: 'Apply one triage decision to many alerts, with a preflight count.+++ A match larger than ``max_count`` is a **409 carrying the real figure**++ and nothing is written — the same contract ``POST /alerts/bulk-close``++ uses, deliberately, because a second bulk path with weaker guarantees is++ how the weaker one becomes the one everybody reaches for.'+ operationId: bulk_triage_route_api_v1_case_depth_alerts_bulk_triage_post- requestBody:- content:- application/json:- schema:+ $ref: '#/components/schemas/BulkTriageRequest'- required: true- responses:- '200':- description: Successful Response- content:- application/json:- schema:+ $ref: '#/components/schemas/BulkTriageResponse'- '422':- description: Validation Error- content:- application/json:- schema:- $ref: '#/components/schemas/HTTPValidationError'- security:- - HTTPBearer: []+ /api/v1/case-depth/custom-fields:+ get:- tags:- - case-depth+ summary: List Custom Fields+ operationId: list_custom_fields_api_v1_case_depth_custom_fields_get- security:- - HTTPBearer: []+ parameters:+ - name: include_inactive+ in: query+ required: false- schema:+ type: boolean+ default: false+ title: Include Inactive- responses:- '200':- description: Successful Response- content:- application/json:- schema:+ type: array+ items:+ $ref: '#/components/schemas/CustomFieldOut'+ title: Response List Custom Fields Api V1 Case Depth Custom Fields+ Get- '422':- description: Validation Error- content:- application/json:- schema:- $ref: '#/components/schemas/HTTPValidationError'- post:- tags:- - case-depth+ summary: Create Custom Field+ operationId: create_custom_field_api_v1_case_depth_custom_fields_post- security:- - HTTPBearer: []- requestBody:- required: true- content:- application/json:- schema:+ $ref: '#/components/schemas/CustomFieldIn'- responses:+ '201':- description: Successful Response- content:- application/json:- schema:- $ref: '#/components/schemas/CustomFieldOut'- '422':- description: Validation Error- content:- application/json:- schema:- $ref: '#/components/schemas/HTTPValidationError'+ /api/v1/case-depth/custom-fields/{field_id}:+ patch:- tags:- - case-depth+ summary: Update Custom Field+ operationId: update_custom_field_api_v1_case_depth_custom_fields__field_id__patch- security:- - HTTPBearer: []- parameters:+ - name: field_id+ in: path- required: true- schema:+ type: string+ format: uuid+ title: Field Id- requestBody:- required: true- content:- application/json:- schema:+ $ref: '#/components/schemas/CustomFieldPatch'- responses:- '200':- description: Successful Response- content:- application/json:- schema:- $ref: '#/components/schemas/CustomFieldOut'- '422':- description: Validation Error- content:- application/json:- schema:- $ref: '#/components/schemas/HTTPValidationError'+ delete:- tags:- - case-depth+ summary: Retire Custom Field+ description: 'Retire, never delete: values already written stay readable and+ attributable.'+ operationId: retire_custom_field_api_v1_case_depth_custom_fields__field_id__delete- security:- - HTTPBearer: []- parameters:- - name: field_id- in: path- required: true- schema:- type: string- format: uuid- title: Field Id- responses:- '200':- description: Successful Response- content:- application/json:- schema:- $ref: '#/components/schemas/CustomFieldOut'- '422':- description: Validation Error- content:- application/json:- schema:- $ref: '#/components/schemas/HTTPValidationError'+ /api/v1/case-depth/cases/{case_id}/custom-values:- get:- tags:- - case-depth+ summary: Get Custom Values+ description: 'Every active field, with this case''s value or an empty one.+++ Returns the *fields*, not the stored rows, so a field defined after the++ case was created still renders — the alternative is a form that silently++ omits whatever was added last week.'+ operationId: get_custom_values_api_v1_case_depth_cases__case_id__custom_values_get+++ - war-rooms+ summary: List For Case+ operationId: list_for_case_api_v1_war_rooms_cases__case_id__getsecurity:- HTTPBearer: []parameters:@@@ -2137,116 -2319,79 +2227,140 @@@schema:type: arrayitems:+ $ref: '#/components/schemas/CustomValueOut'+ title: Response Get Custom Values Api V1 Case Depth Cases Case Id Custom+ Values Get+++ $ref: '#/components/schemas/WarRoomModel'+ title: Response List For Case Api V1 War Rooms Cases Case Id Get'422':description: Validation Errorcontent:application/json:schema:$ref: '#/components/schemas/HTTPValidationError'+ put:+ tags:+ - case-depth+ summary: Set Custom Values+ operationId: set_custom_values_api_v1_case_depth_cases__case_id__custom_values_put+ security:+ - HTTPBearer: []+ parameters:+ - name: case_id+++ /api/v1/war-rooms/{war_room_id}/sync:+ post:- tags:+ - war-rooms+ summary: Sync+ operationId: sync_api_v1_war_rooms__war_room_id__sync_post- security:- - HTTPBearer: []- parameters:+ - name: war_room_idin: pathrequired: trueschema:type: stringformat: uuid+ title: Case Id+++ title: War Room Id+ responses:+ '200':+ description: Successful Response+ content:+ application/json:+ schema:+ $ref: '#/components/schemas/SyncResult'+ '422':+ description: Validation Error- content:- application/json:- schema:+ $ref: '#/components/schemas/HTTPValidationError'+ /api/v1/war-rooms/{war_room_id}/close:+ post:+ tags:+ - war-rooms+ summary: Close+ description: 'Stop mirroring. The channel itself is left alone, deliberately.+++ Archiving somebody''s channel from a console button is a bigger action++ than it looks: the transcript is often the incident''s own record and the++ people in it did not press anything.'+ operationId: close_api_v1_war_rooms__war_room_id__close_post+ security:+ - HTTPBearer: []+ parameters:+ - name: war_room_id+ in: path+ required: true- schema:+ type: string+ format: uuid- title: War Room Id- responses:- '200':- description: Successful Response- content:- application/json:- schema:+ $ref: '#/components/schemas/WarRoomModel'- '422':- description: Validation Error- content:- application/json:- schema:- $ref: '#/components/schemas/HTTPValidationError'+ /api/v1/war-rooms/{war_room_id}/decision:- post:- tags:- - war-rooms+ summary: Channel Decision+ description: 'A decision taken in the channel, delivered by the bot.+++ Service-token only. See the module header: the bot has verified the++ vendor''s signature and this service cannot, so the token is the whole++ trust relationship and ``CHANNEL_DECISIONS`` is its blast radius.'+ operationId: channel_decision_api_v1_war_rooms__war_room_id__decision_post- parameters:- - name: war_room_id- in: path- required: true- schema:- type: string- format: uuid- title: War Room Id+ - name: X-AiSOC-Service-Token+ in: header+ required: false- schema:+ anyOf:+ - type: string+ - type: 'null'+ title: X-Aisoc-Service-TokenrequestBody:required: truecontent:application/json:schema:+ $ref: '#/components/schemas/CustomValuesIn'+ responses:+ '200':+ description: Successful Response+ content:+ application/json:+ schema:+ type: array+ items:+ $ref: '#/components/schemas/CustomValueOut'+ title: Response Set Custom Values Api V1 Case Depth Cases Case Id Custom+ Values Put+ '422':+ description: Validation Error- content:- application/json:- schema:+ $ref: '#/components/schemas/HTTPValidationError'+ /api/v1/case-depth/workload:+ get:+ tags:+ - case-depth+ summary: Workload+ description: 'Per-analyst open, closed, overdue and mean time to close.+++ Every number is counted by this request over rows it selected. An analyst++ who has closed nothing gets ``mean_hours_to_close: null`` and the console++ renders that as "no data" — never ``0.0``, which reads as "instant".'+ operationId: workload_api_v1_case_depth_workload_get+ security:+ - HTTPBearer: []+ parameters:+ - name: days+ in: query+ required: false- schema:+ type: integer+ maximum: 365+ minimum: 1+ default: 30+ title: Days+++ $ref: '#/components/schemas/ChannelDecisionRequest'responses:'200':description: Successful Response@@@ -2255,8 -2400,7 +2369,10 @@@schema:type: objectadditionalProperties: true+ title: Response Workload Api V1 Case Depth Workload Get+++ title: Response Channel Decision Api V1 War Rooms War Room Id Decision+ Post'422':description: Validation Errorcontent: