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.

docs(depth): close 6.1 with its evidence, claim row and changelog entry

Beenu Arora1aa78cbb5103
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b368ea898..cfc173f50 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -191,6 +191,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
+- **An AI-estate inventory built from observation rather than registration**
+ (depth plan 6.1). `aisoc_ai_assets` (migration `105`, tenant-scoped with
+ forced row-level security) holds every AI app, coding agent, MCP server,
+ IDE extension, model-provider key and OAuth grant AiSOC has seen, with the
+ person and device behind each. The gap it closes is that `aisoc_mcp_servers`
+ records what an operator *declared*, and the row that matters in an AI
+ governance review is the one present in observation and absent from the
+ declaration.
+
+ Measured the way the recurring defect here demands: the writer is in the
+ fusion consumer's raw-events branch, the one path every normalized event
+ already travels on the default profile, because a recorder behind a flag or
+ in a service CORE does not start is a table nothing writes and a page that
+ renders "no AI estate" to a tenant that has one.
+ `scripts/check_ai_asset_inventory.py` makes that a rule rather than a
+ comment — it requires the consumer to call the recorder *and* the service
+ to construct it, since an unconstructed recorder is a `None` every call
+ site skips in silence. `ai-estate-live.yml` writes a fixture estate of
+ three kinds into a real PostgreSQL as the DML-only `aisoc_app` role, and
+ two negative controls re-inject real defects: reverting `NULLS NOT
+ DISTINCT` on the identity constraint turns one provider-key row into
+ three, and a tenant policy of `USING (true)` lets one tenant read
+ another's estate.
+
+ Also: graph schema `v1.2 → v1.3` adds the `AIAsset` label with
+ `(:User)-[:OPERATES]->(:AIAsset)` and `(:Endpoint)-[:HOSTS]->(:AIAsset)`,
+ emitted by `services/ingest` as a post-pass rather than a connector case —
+ AI telemetry arrives on three connector types and as plain process
+ activity, so keying on the connector would have covered one of them and
+ looked complete. A new `ai_estate:read` / `ai_estate:write` permission
+ pair, held by real roles and mintable into an API key, because the
+ inventory names which agent on which laptop holds which provider key and
+ `hunts:read` already demonstrated what a permission no role holds is worth.
+
- `services/api/app/models/detection_rule.py` maps the `author` column, which
has existed since `001_init.sql` and was mapped by nothing — while fusion's
tenant overlay reads it on every reload to say *who* silenced a rule when it
diff --git a/DEPTH_PROGRESS.md b/DEPTH_PROGRESS.md
index 689ca58b1..204dd08c5 100644
--- a/DEPTH_PROGRESS.md
+++ b/DEPTH_PROGRESS.md
@@ -393,7 +393,51 @@ invented fields on the first run of the gate.
## Phase 6: AI agent security
-- [ ] **6.1** AI asset inventory
+- [x] **6.1** AI asset inventory. Reproduced:
+ `scripts/check_ai_asset_inventory.py` on the unmodified tree reported nine
+ problems across five of its eight rules — no migration creates the table,
+ no model maps it, no route reads it, no writer exists, and the graph
+ vocabulary has no label for an AI asset. Implemented `aisoc_ai_assets`
+ (migration `105`, tenant-scoped, `FORCE ROW LEVEL SECURITY`, granted to
+ `aisoc_app`), the ORM model, `GET /ai-assets`, `GET /ai-assets/{id}` and
+ `POST /ai-assets/{id}/sanction` behind a new `ai_estate:read` /
+ `ai_estate:write` pair held by five roles and mintable into an API key,
+ `AiAssetRecorder` in the fusion consumer's raw-events branch, the `AIAsset`
+ graph label with `OPERATES` and `HOSTS` edges emitted at ingest (schema
+ `v1.2 -> v1.3`), and the `/ai-estate` console page. 21 new fusion tests
+ (suite 662 -> 683), 8 new Go tests in `internal/graph`, 5 live-Postgres
+ cases in `tests/isolation/test_ai_estate_live.py`.
+
+ **The writer is the whole item**, and the gate says so rather than the
+ prose: the `WRITER` rule requires the consumer to call the recorder *and*
+ `main.py` to construct it, because an unconstructed recorder is a `None`
+ every call site skips in silence and the page would render "no AI estate"
+ to a tenant that has one — the second half of this repository's recurring
+ defect, the half module reachability cannot see.
+
+ Two negative controls, both re-injecting a real defect rather than an
+ invented one, both run against a real PostgreSQL 16 with every migration
+ applied and the suite connected as the DML-only `aisoc_app` role: reverting
+ the identity constraint from `UNIQUE NULLS NOT DISTINCT` to plain `UNIQUE`
+ turns one provider-key row into **three**, each claiming to be first seen
+ now (measured, not predicted — a provider key has no device, so under the
+ default NULL semantics every sighting inserts); and a tenant policy of
+ `USING (true)` lets tenant A read tenant B's estate. Each fails the suite
+ and each is a step in `ai-estate-live.yml`. The gate's own self-test
+ injects one violation per rule and found two blind spots in the gate while
+ being written — it read its own component's docstring as a fabrication, and
+ a `NodeAIAsset,` substring match would have passed on a commented-out
+ `// NodeAIAsset,`.
+
+ **Two limits, stated rather than left to be found.** Phase 2.5 is open, so
+ `effective_permissions` is a column with a resolver behind it and nothing
+ writing it yet; the risk scorer returns `False` for an absent snapshot
+ rather than treating unknown as privileged, and the console says in words
+ that permissions did not contribute. And the three discovery sources see
+ genuinely different things — runtime telemetry never carries a device, a
+ provider audit log never carries either — so `discovery_source` is stored
+ per row and the page prints what each source can and cannot see, because
+ an unlinked device and an unlinkable one are different facts.
- [ ] **6.2** Endpoint discovery with no new agent
- [ ] **6.3** Provider coverage beyond OpenAI and Anthropic
- [ ] **6.4** Agent identity and baselines (parity 6.7)
@@ -438,4 +482,5 @@ invented fields on the first run of the gate.
| 2026-10-09 | 3.3 | Identity privilege (18 rules) and a per-tenant first-seen store (2) built; 5 rules were never unreachable (gate operator drift, D9); 18 retired with a reason (D10). `MAX_UNREACHABLE` 45 → 2, the two remaining both needing the 3.4 baseline. Two matcher operators three shipped rules already used were implemented. |
| 2026-10-09 | 3.2 | Ordered and unordered sequences in the windowed engine; all four translatable Sigma correlation types compile, seven refusal reasons recorded. No upstream correlation rule exists in this tree to import (D8), so the corpus is first-party and labelled as such. |
| 2026-10-09 | 4.1 | Reproduced: `check_cloud_native_collection.py` on the unmodified tree reported all three collection paths absent. Implemented `aws_cloudtrail_s3` (SQS-notified S3 objects; management events, data events and VPC flow logs; delete-after-emit), `gcp_pubsub` (REST pull on a log-sink subscription; ack-after-read) and `azure_event_hubs` (Capture blobs over the Data Lake Gen2 JSON API, with a focused Avro OCF reader). Negative controls recorded in the PR: deleting the SQS message before the object is read, acknowledging the Pub/Sub batch before it is built, ignoring the Avro union branch index, and ignoring the flow-log header line each fail a named test, and all were restored. Connectors suite 1014 -> 1098 passed. |
+| 2026-10-11 | 6.1 | Reproduced: the new gate reported nine problems across five of eight rules on the unmodified tree. Built `aisoc_ai_assets` (migration 105), its routes behind a new `ai_estate:*` permission pair, the fusion recorder that writes it on the default profile, the `AIAsset` graph label with `OPERATES`/`HOSTS` edges, and the `/ai-estate` page. Two negative controls against a real PostgreSQL: reverting `NULLS NOT DISTINCT` turns one provider-key row into three, and a `USING (true)` policy leaks across tenants. Claim matrix 302 -> 303 rows, 300 GATED. Writing the gate found two blind spots in the gate itself. |
| 2026-10-09 | 3.1 | All 74 decided. 50 translated into `wd-*` rules derived from each original's own clauses and replayed through the real engine (162 assertions); 24 refused with a reason across five kinds. `MAX_UNREACHABLE` 119 → 45, published executable 2,603 → 2,529, windowed 18 → 68. Three findings recorded as D4–D6 below. |
diff --git a/docs/audit/CLAIM_TO_GATE_MATRIX.md b/docs/audit/CLAIM_TO_GATE_MATRIX.md
index bbcc6e6db..b4d396b2b 100644
--- a/docs/audit/CLAIM_TO_GATE_MATRIX.md
+++ b/docs/audit/CLAIM_TO_GATE_MATRIX.md
@@ -14,6 +14,7 @@ Statuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL`
| Connectors: schema-driven config + vault-encrypted secrets | README L168 | `ci.yml` connectors matrix (`test_schemas.py` + `test_conformance.py` — secret-shaped fields must be `type=secret`); vault tests + `test_live_vendor_smoke.py` (Phase D3 — mock-server drives each connector's real HTTP client + normalize) | core | GATED | - |
| Connectors: live Test connection | README L168 | `ci.yml` connectors matrix (`test_conformance.py` — every connector implements the async `test_connection` contract) + `connector_conformance.py --check` published matrix + `test_live_vendor_smoke.py` (Phase D3 — mock-server conformance: `test_connection()` + paginated `fetch_alerts()` HTTP path exercised against realistic vendor payloads) | core | GATED | - |
| Cloud telemetry is collected the way a real estate emits it: a CloudTrail organisation trail on S3 notified over SQS (management events, data events and VPC flow logs), a Pub/Sub subscription on a Cloud Logging sink, and an Event Hub's Capture output | `apps/docs/docs/connectors/{aws-cloudtrail-s3,gcp-pubsub,azure-event-hubs}.md`; depth plan 4.1 | `ci.yml :: python-lint` (`check_cloud_native_collection.py --self-test` then the gate: each of the three is registered in `_CONNECTOR_CLASSES`, declares a resumable cursor, declares a bounded `collection_budget` carrying the sentence that says where the overflow goes, and ships vendor-shaped fixtures, a setup guide and a marketplace manifest. The self-test injects one violation per rule into a copy of the real tree and requires each to be caught, and refuses both an absent and an empty tree) + `ci.yml` connectors matrix (`test_aws_cloudtrail_s3.py`, `test_gcp_pubsub.py`, `test_azure_event_hubs.py`, `test_avro_ocf.py` — 83 cases driving recorded vendor payloads through each connector: the SNS and raw S3 notification envelopes, a CloudTrail object carrying management and data events, an S3 flow-log object with its header line, a Pub/Sub pull response with base64 `LogEntry` payloads, and a binary Avro capture file. Acknowledgement ordering is pinned by failure injection rather than described, because an ack before the batch is in hand loses it permanently) | core | PARTIAL (no vendor account of any kind is reachable from CI, so every payload here is recorded or synthesised rather than live. Two consequences are stated rather than implied: the Azure capture fixture was built from the Avro specification rather than taken from a running Event Hub, so a decoder and a fixture that share an author share a misreading; and the Data Lake Gen2 listing path has never been exercised against a real storage account. Returns to GATED when a recorded capture from a live hub replaces the synthesised one) | a live-vendor fixture for Azure Capture |
+| The AI estate AiSOC reports is one it observed, not one somebody typed in: AI apps, coding agents, MCP servers, IDE extensions, provider keys and OAuth grants, each with the person and device behind it | depth plan 6.1; `apps/web/src/components/ai-estate/AiEstateView.tsx` | `ci.yml :: python-lint` (`check_ai_asset_inventory.py --self-test` then the gate: eight rules, of which WRITER is the load-bearing one — the fusion consumer must call the recorder on the raw-events branch *and* the service must construct it at startup, because an unconstructed recorder is a `None` every call site skips in silence and the page would render "no AI estate" to a tenant that has one. The self-test injects one violation per rule into a copy of the real tree and requires each to be caught, and refuses an empty tree) + `ai-estate-live.yml` (a fixture estate of a coding agent, an MCP server and a provider key written by the real recorder into a real PostgreSQL with every migration applied, read back as the DML-only `aisoc_app` role so the RLS policy actually applies; two negative controls re-inject real defects — reverting `NULLS NOT DISTINCT` turns one provider-key row into three, and a policy of `USING (true)` lets one tenant read another's estate — and each must fail the suite) + `ci.yml :: python-test` (fusion `test_ai_asset_recorder.py`, 21 cases, including the negative control that an ordinary process is not an AI asset and the mirror tests comparing the fusion and API risk scorers on shared cases) + `ci.yml` ingest Go tests (`internal/graph/ai_estate_test.go`) | core | GATED | — |
| Investigation Ledger stores every step | README L61, L169 | `ci.yml :: Python — Lint & Type-check` (`check_ledger_replay_contract.py` — response model ↔ console type, client requests ↔ router decorators, and `seq` ordering/uniqueness, each in both directions) + `ci.yml :: Python — Tests` (`test_investigation_replay.py`, 37 cases over `/replay`, `/events`, `/explain`; removing `ORDER BY seq` fails five of them) | core | GATED | — |
| Public eval harness gates every PR | README L62, L77 | `ci.yml :: p1-eval` | core | GATED (but suites are self-consistency; see reality report) | Phase 4 |
| Alert-reduction is a real measurement | README / benchmark page | `ci.yml :: python-test` (fusion) runs `test_alert_reduction_real.py`, which groups a 1 000-alert stream with `RawAlert.correlation_key()` — the method `Correlator` actually calls — and bounds the ratio on both sides, because a floor alone is satisfied by a key that collapses everything into one incident | core | GATED | the legacy suite's 75.3% stays published for continuity and is labelled as not describing this product; the measurement is still a synthetic workload, as the benchmark page states |
@@ -313,8 +314,8 @@ Statuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL`
## Summary
-- Total: 302
-- GATED: 299
+- Total: 303
+- GATED: 300
- PARTIAL: 3
- NO GATE: 0