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.

Merge remote-tracking branch 'origin/main' into depth/9.6-native-responder

Beenu Arora2bd60990bea8
diff --cc DEPTH_PROGRESS.md
index 8a17abbf8,5567c305c..1219ecc1a
--- a/DEPTH_PROGRESS.md
+++ b/DEPTH_PROGRESS.md
@@@ -486,50 -673,37 +673,77 @@@ endpoint produces once triage falls thr
against 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 is
unflattering:** see D11.
- - [ ] **9.3** Case depth (parity 5.6 remainder)
+ - [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.5** Hunt to report
-- [ ] **9.6** Native responder
+- [~] **9.6** Native responder. **Two of three bullets closed; the third is
+ maintainer-blocked and the block is in the product, not in this note.**
+ *Device build:* `mobile.yml` gains an Android job that runs
+ `expo prebuild` and Gradle `assembleDebug`, asserts the APK really
+ contains `classes.dex` (a green build that produced nothing is a shape
+ this repository has shipped) and uploads it — an APK that installs and
+ runs on a handset. Not store-signable (a Google Play account) and not a
+ *release* build: `:app:createBundleReleaseJsAndAssets` dies inside
+ Metro's asset hashing on the runner, Node 20 fixes it, and
+ `scripts/check_toolchain_pins.py` correctly refuses a second Node version
+ because 20 left security support in April 2026 and no image ships it.
+ Lowering that gate to make this job pass would have been the wrong trade,
+ so the limit is stated instead. iOS
+ compiles **and links** for the simulator on a macOS runner — the Expo
+ config generates a valid Xcode project, the pods resolve and every native
+ module builds. It deliberately does not run Metro's bundle phase, which
+ dies on that runner inside one of expo-router's PNGs for a Metro/Node
+ reason unrelated to this app; the Android job bundles, so that half is
+ still graded. A device build needs an Apple developer account. *Voice:* `apps/mobile/src/lib/voice.ts` takes a recogniser that
+ returns a **string**, so no audio type appears anywhere in the module and
+ there is nothing for a later edit to upload; a device with no offline
+ model is **refused** rather than silently using the platform's cloud
+ recogniser; the transcript is shown before it is sent, because on-device
+ recognition is worse and a security question misheard is a question
+ answered about the wrong host. Gated by `scripts/check_no_audio_egress.py`
+ (self-test: six checks, including that a *comment* saying the app does not
+ record is not mistaken for the app recording), wired into both `ci.yml`
+ unconditionally and `mobile.yml`. *Push:* `services/realtime` sent every
+ subscription through `web-push`, which signs a VAPID JWT and POSTs to the
+ endpoint **URL** — a bare APNs device token is not a URL, so a
+ subscription saved by the mobile app was accepted, counted and failed on
+ every send, which is the worst of the three states because the count
+ looked healthy. `native-push.ts` speaks APNs and FCM HTTP v1 and
+ distinguishes delivered, device-gone and **not-configured**, the last
+ naming each missing variable and never reporting a delivery. 19 new tests
+ (11 realtime, 8 mobile); mobile suite 34 → 42. **Open and stated:** no
+ APNs `.p8` and no FCM service account exist here, so nothing has been
+ delivered to a real handset, and no microphone has exercised the voice
+ path. The README's claim table was inverted rather than deleted — it now
+ has to keep saying that an iPhone *device* build and a real-handset push
+ have **not** happened, and `mobile.yml` fails if it stops.
## Phase 10: Close the books
@@@ -540,7 -714,7 +754,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.6 | Reproduced: `grep -c 'eas build|gradlew|xcodebuild|expo prebuild' .github/workflows/mobile.yml` returned **0** and the workflow actively *required* the README to say no device build had happened; `grep -rni 'speech|voice' apps/mobile/src apps/mobile/app` returned **0**; and `services/realtime/src/push.ts` sent every record through `webpush.sendNotification`, so a native token was accepted and could never be delivered to. Built the Android APK job, the simulator job, the on-device voice module and the APNs/FCM sender. Negative control: removing the on-device refusal so the cloud recogniser could be used fails two of the eight voice tests. The README guard was inverted rather than deleted — "we added a build so the honesty check is no longer needed" is how an ungated claim comes back. |
| 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. |