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(trackers): reconcile counts, dedupe rows, renumber colliding deviations

beenuar4d432d4bf806
diff --git a/DEPTH_PROGRESS.md b/DEPTH_PROGRESS.md
index 2cba1f366..bd797fbb0 100644
--- a/DEPTH_PROGRESS.md
+++ b/DEPTH_PROGRESS.md
@@ -488,7 +488,7 @@ Instead, every selector field, `group-by` and `distinct_by` is checked
against the emitted-field namespace with **no ceiling**, which caught three
invented fields on the first run of the gate.
-### D11 -- A durable `wait` suspended the run and then carried on
+### D15 -- A durable `wait` suspended the run and then carried on
Found while building 5.4 on 5.3's pause, and fixed here because 5.4 inherits
it. `_control_wait` writes a pause row and returns `StepStatus.PENDING` with
@@ -510,7 +510,7 @@ Negative control: reverting that break fails
`test_a_durable_pause_stops_the_run` plus two others, recorded in the pull
request.
-### D12 -- The manager comes from SCIM only, and the lookup is three sources deep
+### D16 -- The manager comes from SCIM only, and the lookup is three sources deep
The plan says "from SCIM or IdP data". Implemented as the step's own
`manager` parameter, then the run context (where identity enrichment puts one
@@ -529,7 +529,7 @@ that outcome rather than hanging.
fourth source. Not used: the agents service has an asyncpg pool and no Neo4j
driver, and adding one for an escalation is a dependency the item does not
justify.
-### D11 -- The plan says `valid_to`; this schema says `valid_until`
+### D17 -- The plan says `valid_to`; this schema says `valid_until`
Item 2.5 asks for versioned snapshots with `valid_from` / `valid_to`. The one
existing table in this database that bounds a fact in time is `identity_edges`
@@ -540,7 +540,7 @@ they were in before they could write a `WHERE`. The existing spelling wins;
`posture_snapshots` uses `valid_from` / `valid_until`, and the deviation is
recorded here rather than made silently.
-### D12 -- Eleven API tests are already failing on `main`, and nothing grades them
+### D18 -- Eleven API tests are already failing on `main`, and nothing grades them
The full `services/api` suite run for 2.5 reported 4,774 passed and 11 failed.
All eleven are in `test_alert_list_priority_sort.py` and
@@ -609,7 +609,7 @@ the number would have looked right in a diff. It would also have fired the
rule on most of the internet. Five such age-of-a-thing fields are named in a
test that forbids the first-seen store from ever growing them.
-### D11 -- Identity privilege reads a table a tenant must populate
+### D19 -- Identity privilege reads a table a tenant must populate
The `*_priv` booleans resolve from `identity_nodes.privilege_tier >= 2`, the
column migration 018 created for the question. The table's only writer is
@@ -626,7 +626,7 @@ are among the 18 above. Each has no subject field any source emits, and
guessing a subject would produce a boolean that is confidently wrong rather
than absent.
-### D12 -- The "behavioural baseline" family named the wrong piece of work
+### D20 -- The "behavioural baseline" family named the wrong piece of work
`check_detection_fields.py` classified an unreachable field into a family so
the headline number would be actionable. Its behavioural pattern was
@@ -657,7 +657,7 @@ And D9's lesson repeated one level up: a gate that keeps its own description
of another component drifts from it, and here the drift was in the
classifier rather than in the operator list.
-### D13 -- D9, D10 and D11 were written, merged, and lost on `main`
+### D21 -- D9, D10 and D19 were written, merged, and lost on `main`
PR #1226 (depth 3.3) added three deviation sections. None of them is on
`main`. The item log still cites "(gate operator drift, D9)" and "18 retired
@@ -673,10 +673,10 @@ documented remedy — keep both sides' paragraphs, never take one side whole —
is the one that would have prevented it.
All three are restored here verbatim from the merge commit rather than
-rewritten from memory, which is why D11 keeps its original number and this
-phase's own new deviations take D12 and D13.
+rewritten from memory. At restoration the trio kept its numbers; the 2026-10-12
+merge train renumbered them D19/D20/D22 because parallel lanes had taken D11-D14 on `main` first.
-### D14 -- A rule of this lane's own was a bare anomaly, and its own gate caught it
+### D22 -- A rule of this lane's own was a bare anomaly, and its own gate caught it
Depth plan 3.5 is explicit that an anomaly is *"a typed signal, not an alert
on its own"*. `ta-saas-oauth-app-volume-spike` was written with
@@ -865,7 +865,7 @@ endpoint produces once triage falls through to its deterministic scorer.
reachability gate's "behavioural baseline" family was **narrowed**: it
matched `^active_`, which swept in a systemd unit state and an ITSM
lookup and reported both as blocked on a baseline that would never have
- helped either (D12). `MAX_UNREACHABLE` stays at 2, now with accurate
+ helped either (D20). `MAX_UNREACHABLE` stays at 2, now with accurate
reasons.
- [x] **3.5** Threat-and-anomaly condition rules — 24 in a new
`threat-anomaly` category (`scripts/detection_specs_part4_threat_anomaly.py`),
@@ -885,7 +885,7 @@ endpoint produces once triage falls through to its deterministic scorer.
positive silences the rule, and one rule fires **end to end in CORE on a
baseline earned from replayed traffic** with no `full` service running —
the phase's second "Done when", as an assertion. The decorative-clause
- control caught a rule of this lane's own that was a bare anomaly (D14).
+ control caught a rule of this lane's own that was a bare anomaly (D22).
- [ ] **3.6** 395 → at least 800 cloud, identity, SaaS and code conditions
- [ ] **3.7** Detection engineering agent (gap-closure Phase 9 / parity 6.2)
@@ -1222,7 +1222,7 @@ endpoint produces once triage falls through to its deterministic scorer.
(self-test: eleven injected violations, one per rule) wired into
`ci.yml :: python-lint`, plus `verification-live.yml` driving the real SQL
against real Postgres. 20 new offline tests, 12 live, 5 SCIM; shipped
- playbook `user-verification-containment.playbook.json`. Deviation D11
+ playbook `user-verification-containment.playbook.json`. Deviation D15
records the `wait` defect this item found and fixed.
- [ ] **5.5** Executor arms 74 → at least 150
- [ ] **5.6** Plain-language playbooks
@@ -1560,7 +1560,7 @@ endpoint produces once triage falls through to its deterministic scorer.
| 2026-10-11 | 4.3 | Third bullet closed. Reproduced: `check_retention_window.py` with the new rules reported no cold-query estimator, no job surface and no job table on the pre-fix tree. Built `lake_cold_query.py` (EXPLAIN ESTIMATE + system.parts + system.processes, no invented throughput or price), `lake_query_runner.py` and migration `111`. Negative control: removing the `status = 'queued'` predicate makes both interleaved transactions claim one job and the live suite goes red. The first version of that test — five gathered claims — passed under the broken implementation and was replaced. 26 pure + 12 live tests; matrix 306 rows, 303 GATED. |
| 2026-10-11 | 4.2 | Reproduced: `check_standard_inputs.py` against the pre-fix tree reported no OTLP package, no Kafka input and no TAXII server — the only TAXII-shaped route being a demo-gated sample list. Built all three, after moving the consumer-health classifier out of `graph_ws` into `streamhealth` so the new Kafka consumer shares the table rather than copying it. Negative controls recorded in the PR: a timestamp-only TAXII cursor loses an indicator in the single-row pagination walk (measured — 3 of 4), and nineteen gate injections each go red. Writing it found four defects, including an OTLP template nobody could mint a token for and a gate rule that read an error message instead of the behaviour. Ingest Go suite green; api projection suite 37; live TAXII suite 15. |
| 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 | 5.4 | Reproduced: `check_stateful_verification.py` against `origin/main` reported eight problems — no `verification.py` at all, `verify_user` absent from the control-flow table, no resume path, no escalation, no `timed_out`, no sweep, no migration and no writer for the opt-in table. Built the stage machine on the existing pause row rather than a second table. Three negative controls recorded in the PR: reverting the run-loop break fails three tests including the `wait` regression (D11), removing `manager_ref=_extract_manager(body)` fails three SCIM tests, and removing `ENABLE ROW LEVEL SECURITY` from migration 102 fails the live tenancy test with "tenant B read tenant A's verification policy". Two pre-existing tests pinned the old shape and were widened rather than relaxed: the control-flow table's membership (still an equality, now of four) and the sweeper's return dict. Writing the gate found a hole in the gate: its first block extractor matched `\n\n\n`, which finds nothing for the *last* function in a module, so the ordering rule was skipped entirely over an injected violation. |
+| 2026-10-11 | 5.4 | Reproduced: `check_stateful_verification.py` against `origin/main` reported eight problems — no `verification.py` at all, `verify_user` absent from the control-flow table, no resume path, no escalation, no `timed_out`, no sweep, no migration and no writer for the opt-in table. Built the stage machine on the existing pause row rather than a second table. Three negative controls recorded in the PR: reverting the run-loop break fails three tests including the `wait` regression (D15), removing `manager_ref=_extract_manager(body)` fails three SCIM tests, and removing `ENABLE ROW LEVEL SECURITY` from migration 102 fails the live tenancy test with "tenant B read tenant A's verification policy". Two pre-existing tests pinned the old shape and were widened rather than relaxed: the control-flow table's membership (still an equality, now of four) and the sweeper's return dict. Writing the gate found a hole in the gate: its first block extractor matched `\n\n\n`, which finds nothing for the *last* function in a module, so the ordering rule was skipped entirely over an injected violation. |
| 2026-10-11 | 6.2 | Reproduced: 13 of 16 new cases failed, driving the shapes the four endpoint connectors actually emit. Root cause was 6.1's endpoint branch reading `process.name` off OCSF, which the canonical profile never populates — it found `None` on every real source while its own tests passed. Fixed by reconstructing the connector namespace. Shipped the osquery pack (5 queries, packs 5 -> 6), the source-capability table, the operator doc and a 6-rule gate. Fusion suite 683 -> 700. Claim row is PARTIAL: no osquery agent runs in CI, and the EDR connectors return vendor detections rather than process telemetry, so the plan's "CrowdStrike, Defender, SentinelOne" wording is not satisfiable with these connectors. |
| 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 110), 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. |
@@ -1596,7 +1596,7 @@ The claim row returns to GATED when a live tenant is available. Nothing was
weakened to accommodate this: the row says PARTIAL, the operations page says
"treat the first run against your own tenant as the first run", and the
CHANGELOG entry says it too.
-| 2026-10-11 | 2.5 | Reproduced: `test_posture_snapshot_coverage.py` on the unmodified tree asserted the *gap* — every resolver in `effective_permissions/` was pure and the only production snapshot source returned `{}`, so every live call 412'd and the subsystem had never answered a question about a real estate. Five collectors now exist under `services/connectors/app/connectors/posture/`, reached by a `__posture_snapshot__` sentinel through each connector's `get_resource_config`, and the coverage test is inverted: it now fails when a registered resolver has no declared collector. Building it found three things worth recording. (a) `BaseConnector.get_resource_config` declares `at_ts: str | None = None` while AWS, Okta and GitHub each required a positional `ts`, so a caller written against the base class raised `TypeError` on three of the connectors — standardised, with `test_every_implementation_matches_the_base_signature` holding it. (b) Google Workspace's directory read needs scopes the audit-log credential is not consented for, so the JWT is now built per scope: asking for both in one assertion would have broken alert polling on every tenant that had not pre-consented the new ones. (c) A snapshot is only an answer if you know *when* it was true — an alert is triaged minutes to days after the event, and a single mutable "current posture" row answers "what can this identity do now" while appearing to answer "what could it do when it acted", which is the worse failure because the number looks right. Migration 103 therefore versions snapshots on `valid_from`/`valid_until` (`valid_to` in the plan; `valid_from`/`valid_until` is the existing spelling in migration 018 and two spellings of one concept in one schema is worse than a recorded deviation — D11). Negative controls, both run against live Postgres and both restored: dropping `posture_snapshots_live_idx` leaves `test_a_second_live_row_is_refused_by_the_database` reporting `DID NOT RAISE IntegrityError`, and defeating the content-hash comparison in `save_snapshot` fails `test_unchanged_recollection_does_not_open_a_version` with two distinct row ids — without that comparison an unchanged estate re-collected hourly writes a version an hour and "when did this posture last change" becomes unanswerable because every row is a change. Evidence: 12 posture-store tests against live Postgres with the migration chain applied, 65 across the posture and effective-permission suites, 1,145 connector tests, 4,774 API tests. Eleven API failures are pre-existing on `main` and unrelated — recorded as D12. |
+| 2026-10-11 | 2.5 | Reproduced: `test_posture_snapshot_coverage.py` on the unmodified tree asserted the *gap* — every resolver in `effective_permissions/` was pure and the only production snapshot source returned `{}`, so every live call 412'd and the subsystem had never answered a question about a real estate. Five collectors now exist under `services/connectors/app/connectors/posture/`, reached by a `__posture_snapshot__` sentinel through each connector's `get_resource_config`, and the coverage test is inverted: it now fails when a registered resolver has no declared collector. Building it found three things worth recording. (a) `BaseConnector.get_resource_config` declares `at_ts: str | None = None` while AWS, Okta and GitHub each required a positional `ts`, so a caller written against the base class raised `TypeError` on three of the connectors — standardised, with `test_every_implementation_matches_the_base_signature` holding it. (b) Google Workspace's directory read needs scopes the audit-log credential is not consented for, so the JWT is now built per scope: asking for both in one assertion would have broken alert polling on every tenant that had not pre-consented the new ones. (c) A snapshot is only an answer if you know *when* it was true — an alert is triaged minutes to days after the event, and a single mutable "current posture" row answers "what can this identity do now" while appearing to answer "what could it do when it acted", which is the worse failure because the number looks right. Migration 103 therefore versions snapshots on `valid_from`/`valid_until` (`valid_to` in the plan; `valid_from`/`valid_until` is the existing spelling in migration 018 and two spellings of one concept in one schema is worse than a recorded deviation — D17). Negative controls, both run against live Postgres and both restored: dropping `posture_snapshots_live_idx` leaves `test_a_second_live_row_is_refused_by_the_database` reporting `DID NOT RAISE IntegrityError`, and defeating the content-hash comparison in `save_snapshot` fails `test_unchanged_recollection_does_not_open_a_version` with two distinct row ids — without that comparison an unchanged estate re-collected hourly writes a version an hour and "when did this posture last change" becomes unanswerable because every row is a change. Evidence: 12 posture-store tests against live Postgres with the migration chain applied, 65 across the posture and effective-permission suites, 1,145 connector tests, 4,774 API tests. Eleven API failures are pre-existing on `main` and unrelated — recorded as D18. |
| 2026-10-11 | 7.3 | Reproduced: `OktaConnector.normalize()` returned `None` for `session_id`, `src_asn`, `user_agent`, `client_browser` and `mfa_satisfied` on a System Log row carrying all five, so the family had nothing to group by and could not have been written. Same shape as the `outcome` hoist in #1279 -- the engine flattens `raw_event` one level and `authenticationContext` arrives as a dict. Hoisted the session, network and client fields on Okta and Entra, then wrote four rules grouping by **session** rather than by user: three distinct-value rules at threshold 2 and one ordered sequence at critical. Fixtures hand-authored from an Okta System Log row and a Graph `signIn` resource; the negative twin inverts only the clause each rule is about. Windowed 72 -> 76; executable detections unchanged at 2,511, because a windowed rule is not in that corpus. Negative controls: removing the `session_id` hoist reds 4 connector tests; switching one rule's `group_by` to `actor_email` reds 2 engine tests. Two findings recorded as D-7.3a (the threshold engine windows by arrival and only sequences window by event time) and D-7.3b (the reported-message link is deferred with a reason). |
### D-7.3a -- The threshold engine windows by arrival, not by event time
diff --git a/ROADMAP.md b/ROADMAP.md
index 9f5e02464..9ab9d8542 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -45,7 +45,7 @@ A proof-first, security-first program to make every README claim gate-backed, cl
- **Phase D (breadth):** D1 eight connectors (QRadar/Exabeam/Securonix/Devo/Netskope/Windows-Sysmon/Zeek-Suricata/syslog-CEF) · D2 AI/LLM-usage audit connector + `llm-*` detections + hot/cold lake tiering · D3 live-vendor mock-server smoke.
- **Phase E (prove it):** E1 CI-gated benchmark scoreboard tied to a deterministic live-agent MITRE-accuracy run.
-The claim-to-gate matrix stands at **270 rows — 268 GATED / 2 PARTIAL / 0 NO GATE**. Two rows are PARTIAL. "The retention window a tenant chooses is the one the lake honours" stays PARTIAL until a live ClickHouse test watches a row survive past the old 90-day boundary. "Cloud-native collection" stays PARTIAL until a capture recorded from a live Event Hub replaces the fixture synthesised from the Avro specification. "SSO completes a sign-in" was the third, and depth 8.1 closed it by building the gate it named rather than by relabelling: `sso-live.yml` now stands up a containerised Keycloak and both legs have been observed to pass — `keycloak-oidc` takes a real `id_token` through `_verify_id_token` against the provider's published JWKS, and `keycloak-saml` walks the whole SP-initiated flow to the real ACS. Every other product claim is backed by a failing test, none is a named deferral either, and the ratchet (`MAX_NO_GATE=0`) forbids any regression. Every PARTIAL row was closed by building the gate it named, never by relabelling. The last two rested on the live-agent eval workflow, which this file said had simply never run: the real reason was that its live path imported a class that exists nowhere in `services/agents`, so its first dispatch failed in 92 seconds and every later one would have. With that fixed the workflow measures, and the groundedness floor is **0.40 over a deterministic 10-incident slice**, derived from ten runs across two environments rather than chosen — seven local runs returning 0.5561 to four decimal places, three GitHub-runner runs returning 0.5821, 0.5329 and 0.5933. Every one is a locally-served `qwen2.5:0.5b`; no hosted provider has been exercised and the floor describes none. Count the table rows with `python3 scripts/check_claim_gate_matrix.py` rather than trusting a figure quoted in prose — this line has gone stale before. The six lettered deferrals are scoped in [`docs/audit/DEFERRED_SUBPHASES.md`](docs/audit/DEFERRED_SUBPHASES.md).
+The claim-to-gate matrix stands at **319 rows — 315 GATED / 4 PARTIAL / 0 NO GATE**. Four rows are PARTIAL, each naming what closes it: "Cloud-native collection" until a capture recorded from a live Event Hub replaces the fixture synthesised from the Avro specification; "the retention window a tenant chooses is the one the lake honours" until a live ClickHouse test watches a row survive past the old 90-day boundary; "the AI estate is discovered on the endpoint" until a containerised osquery runs the shipped pack end to end; and "a reported phishing message can be purged across its recipients" until a maintainer-supplied Microsoft 365 or Google Workspace tenant lets the documented request shapes be exercised for real. "SSO completes a sign-in" closed the way the programme requires — by building the gate it named: `sso-live.yml` stands up a containerised Keycloak and both legs have been observed to pass. Every other product claim is backed by a failing test, none is a named deferral either, and the ratchet (`MAX_NO_GATE=0`) forbids any regression. Every PARTIAL row was closed by building the gate it named, never by relabelling. Count the table rows with `python3 scripts/check_claim_gate_matrix.py` rather than trusting a figure quoted in prose — this line has gone stale before. The six lettered deferrals are scoped in [`docs/audit/DEFERRED_SUBPHASES.md`](docs/audit/DEFERRED_SUBPHASES.md).
## v4.0 — Shipped
diff --git a/apps/docs/docs/compliance/evidence-pack.md b/apps/docs/docs/compliance/evidence-pack.md
index f76c0958e..f5b737310 100644
--- a/apps/docs/docs/compliance/evidence-pack.md
+++ b/apps/docs/docs/compliance/evidence-pack.md
@@ -33,10 +33,8 @@ 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: 268 rows
-`GATED`, 2 `PARTIAL`, and a ratchet that refuses to let a row sit at
-
-`GATED`, 3 `PARTIAL`, and a ratchet that refuses to let a row sit at
+The last row is the one worth reading first. It is the honest index: 315 rows
+`GATED`, 4 `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
`scripts/readme_gates.py` cross-checks this sentence against the matrix.
diff --git a/docs/audit/CLAIM_TO_GATE_MATRIX.md b/docs/audit/CLAIM_TO_GATE_MATRIX.md
index 134c56d48..84ae5a8fe 100644
--- a/docs/audit/CLAIM_TO_GATE_MATRIX.md
+++ b/docs/audit/CLAIM_TO_GATE_MATRIX.md
@@ -291,12 +291,7 @@ Statuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL`
| Injection flip rate and unsafe-action rate are measured per family | `apps/docs/docs/benchmark.md` | `ci.yml :: Python — Tests` (`tests/adversarial/test_behavioural_injection.py`) | core | GATED | **27 pairs across the 9 families the plan names**, each payload written to fit the field it arrives in: overall flip 25.9%, unsafe action 3.7%, with a per-family ceiling so a regression in one cannot hide behind an improvement in another. It immediately found a real blind spot: **`fake_tool_output` flips every verdict and the guard catches none of it**, because a payload shaped like a tool's own answer reads as evidence rather than as an instruction. Recorded at 1.0 rather than patched, and the guard is deliberately not tuned against this corpus in the same change, because hardening against a tuned corpus has already been measured here moving 66.7% to 98.1% while held-out payloads moved 3.6% to 7.1%. **Measures the pipeline, not a model**: the stub is deliberately obedient, so the rates are an upper bound on harm and the artefact carries `llm_resistance_measured: false` |
| Closure accuracy is measured on the tenant's own data, not only on a synthetic corpus | `apps/docs/docs/operations/shadow-mode.md` | `ci.yml :: Python — Tests` (agents, `test_closure_qa_sampling.py`) | core | GATED | Nothing measured this. The eval harness grades a synthetic corpus and the funnel counts how many alerts were closed, neither of which answers "of the ones the agent closed on your data, how many should it have". A tenant-configurable sample (5% default) of auto-closures goes to an analyst, scored on the five-part rubric. The sample is a **deterministic hash of the alert id, not `random()`**: a rolled sample fires at the configured rate *per replica*, so three replicas at 5% sample 15%, and a redelivered Kafka message gets a second roll and weights one closure twice. Bucketing also makes a higher rate a superset of a lower one, so a tenant's figure stays comparable across a rate change. Zero reviews reports **not measured** rather than 0.0, and every mean travels with the count it was taken over |
| SSO completes a sign-in, into the right tenant with the mapped role | `apps/docs/docs/operations/security.md` | `ci.yml :: Python — Tests` (`services/api/tests/test_sso_provisioning.py`, `test_saml_connection_metadata.py`) + `sso-live.yml :: sso-live` (`tests/isolation/test_sso_live.py` against real Postgres and the real application) + `sso-live.yml :: keycloak-oidc` (a real Keycloak `id_token` through `_verify_id_token` against its published JWKS) + `sso-live.yml :: keycloak-saml` (`scripts/ci/keycloak_saml_probe.py`: the whole SP-initiated flow against a containerised Keycloak — the app's AuthnRequest from the connection's own trust material, Keycloak's own login page, a signed Response, and the real ACS against real Postgres as the DML-only `aisoc_app` role) | core | GATED | Both handlers used to end a successful sign-in by putting a JWT in an `aisoc_token` cookie carrying `sub`, `email`, `name` and `picture`. That token authenticated nothing three times over: signed with `JWT_SECRET` rather than the key the API verifies with, carrying no `tenant_id` or `role`, and in a cookie when the API reads `Authorization: Bearer`. A user could complete the whole dance and find every request unauthenticated. **The security property the tests exist for is that the tenant does not come from the assertion**: an IdP that can name its own tenant can name somebody else's, so it comes from the connection row an administrator configured, and `complete_sso_login` is asserted to take no tenant argument at all. A group cannot map to `admin` or `platform_admin`. The token travels in the URL fragment, which is not sent to the server and does not reach an access log or a `Referer`. **Fix pass 4.1** found the half none of that could see: `_saml_settings()` read its IdP trust anchor from `SAML_IDP_*` while the connection's own `metadata_url` and `metadata_xml` were written by `POST /sso-connections` and read by nothing, so on a stock install — which sets no SAML environment at all — every assertion was refused while the console showed a configured connection. The SAML callback also redirected straight to its RelayState destination, whose auth guard rebuilds its bounce target from `pathname + search` and drops the fragment the token travels in. Both are fixed and driven end to end. **This row was PARTIAL because the identity providers in that suite are a keypair and a metadata document this repository authors, so they cannot exhibit a vendor's own quirks, and the containerised leg had never been observed to pass.** Both halves are now closed. `keycloak-oidc` passed on `main` in run 38118951217 (2026-10-11), and depth 8.1 added `keycloak-saml`, which walks the entire SP-initiated flow against a real Keycloak and passed on the pull request that added it. **It immediately found two shipped defects neither the self-authored provider nor any unit test could see**: `resolve_saml_connection` bound `:i` with no type, so `:i IS NULL` — the branch `/auth/saml/login` takes when the console links to it without an issuer, which is every console — raised on asyncpg and was swallowed into "no enabled SAML connection is configured"; and Keycloak's default role-list mapper emits one `<Attribute Name="Role">` per role, which python3-saml refuses, so the ACS answered an unhandled 500 to a stock Keycloak. Both fixed, both with negative controls in the PR. One limit stated rather than implied: there is no browser in either job, so the SAML hop is driven over HTTP with the login form parsed out of Keycloak's own HTML — everything a browser does except JavaScript, which Keycloak's login form does not require |
-
-| SSO completes a sign-in, into the right tenant with the mapped role | `apps/docs/docs/operations/security.md` | `ci.yml :: Python — Tests` (`services/api/tests/test_sso_provisioning.py`, `test_saml_connection_metadata.py`) + `sso-live.yml :: sso-live` (`tests/isolation/test_sso_live.py` against real Postgres and the real application: a SAML Response signed by the connection's own IdP key, and an RS256 `id_token` from a provider serving real discovery and a real JWKS, each taken through to a token `GET /auth/me` accepts) | core | PARTIAL | Both handlers used to end a successful sign-in by putting a JWT in an `aisoc_token` cookie carrying `sub`, `email`, `name` and `picture`. That token authenticated nothing three times over: signed with `JWT_SECRET` rather than the key the API verifies with, carrying no `tenant_id` or `role`, and in a cookie when the API reads `Authorization: Bearer`. A user could complete the whole dance and find every request unauthenticated. **The security property the tests exist for is that the tenant does not come from the assertion**: an IdP that can name its own tenant can name somebody else's, so it comes from the connection row an administrator configured, and `complete_sso_login` is asserted to take no tenant argument at all. A group cannot map to `admin` or `platform_admin`. The token travels in the URL fragment, which is not sent to the server and does not reach an access log or a `Referer`. **Fix pass 4.1** found the half none of that could see: `_saml_settings()` read its IdP trust anchor from `SAML_IDP_*` while the connection's own `metadata_url` and `metadata_xml` were written by `POST /sso-connections` and read by nothing, so on a stock install — which sets no SAML environment at all — every assertion was refused while the console showed a configured connection. The SAML callback also redirected straight to its RelayState destination, whose auth guard rebuilds its bounce target from `pathname + search` and drops the fragment the token travels in. Both are fixed and driven end to end. **Why this is PARTIAL and not GATED**: the identity providers in that suite are a keypair and a metadata document this repository authors, so they cannot exhibit a vendor's own quirks. `sso-live.yml :: keycloak-oidc` is the containerised leg and **has never been observed to pass** — it was written where no container runtime would start. The row returns to GATED on the first green run of that job, not before |
| A per-tenant limit an operator configured can refuse work, and only if they opted in | `services/api/app/services/entitlements.py`; parity plan 4.5 | `entitlements-live.yml :: entitlements-live` (`tests/isolation/test_entitlement_enforcement_live.py`, 9 cases against real Postgres as the DML-only `aisoc_app` role. The job additionally asserts a **fresh database enforces nothing**, and carries two negative controls: a guard that never refuses fails 1 of 9, and a guard stuck closed fails 4 of 9 — every one of those a positive control) | core | GATED | `entitlements.py` said in its own docstring that enforcement was not its job, which was the right first move and left an operator who configured a ceiling with a number the product reported and never applied. Enforcement is **opt-in per tenant per key**, because `tenants.limits` has been a reporting input since it existed and the numbers in it were never chosen as hard caps — arriving switched on would turn every one into a refusal on upgrade. A measurement failure **allows** the request, logged at `error`: a quota that cannot count must not stop a SOC, and the fail-closed instinct here is the one that shipped a control withholding every grant on every deployment. The refusal is **402** with the key, the usage and the ceiling in the body — 403 says the caller may not do this (false) and 429 invites a retry that will fail identically. Wired rather than available: `POST /connectors` checks before the vault call and `POST /tenants/me/users` after the role grant is authorized, both through one helper. **Six console pages parity 4.5 also names — branding, SCIM tokens, retention, organisation members and grants, rule packs, delegations — are not built; this row covers the enforcement bullet only** |
-| Accessibility is checked on the views an analyst uses, not only on the landing page | `ROADMAP.md` | `ci.yml :: Web — Tests` (`apps/web/src/test/a11y.test.tsx`) | core | GATED | 1.1 narrowed the "WCAG AA full accessibility pass" claim because axe covered the landing and chrome components only. 4.7 adds **three of the five** operator views the plan names: the alerts queue and list, the investigation rail, and settings. Each asserts it rendered real markup **before** axe runs, because axe passes on an empty div and a view that rendered a spinner would report coverage the suite does not have. That guard immediately caught one: the rail keys SWR on a tuple, the fixture read only the string form, and it was rendering its error state. **Limits stated**: the case workspace is not covered, and axe checks a subset of WCAG rather than all of it |
-
-| SSO completes a sign-in, into the right tenant with the mapped role | `apps/docs/docs/operations/security.md` | `ci.yml :: Python — Tests` (`services/api/tests/test_sso_provisioning.py`, `test_saml_connection_metadata.py`) + `sso-live.yml :: sso-live` (`tests/isolation/test_sso_live.py` against real Postgres and the real application: a SAML Response signed by the connection's own IdP key, and an RS256 `id_token` from a provider serving real discovery and a real JWKS, each taken through to a token `GET /auth/me` accepts) | core | PARTIAL | Both handlers used to end a successful sign-in by putting a JWT in an `aisoc_token` cookie carrying `sub`, `email`, `name` and `picture`. That token authenticated nothing three times over: signed with `JWT_SECRET` rather than the key the API verifies with, carrying no `tenant_id` or `role`, and in a cookie when the API reads `Authorization: Bearer`. A user could complete the whole dance and find every request unauthenticated. **The security property the tests exist for is that the tenant does not come from the assertion**: an IdP that can name its own tenant can name somebody else's, so it comes from the connection row an administrator configured, and `complete_sso_login` is asserted to take no tenant argument at all. A group cannot map to `admin` or `platform_admin`. The token travels in the URL fragment, which is not sent to the server and does not reach an access log or a `Referer`. **Fix pass 4.1** found the half none of that could see: `_saml_settings()` read its IdP trust anchor from `SAML_IDP_*` while the connection's own `metadata_url` and `metadata_xml` were written by `POST /sso-connections` and read by nothing, so on a stock install — which sets no SAML environment at all — every assertion was refused while the console showed a configured connection. The SAML callback also redirected straight to its RelayState destination, whose auth guard rebuilds its bounce target from `pathname + search` and drops the fragment the token travels in. Both are fixed and driven end to end. **Why this is PARTIAL and not GATED**: the identity providers in that suite are a keypair and a metadata document this repository authors, so they cannot exhibit a vendor's own quirks. `sso-live.yml :: keycloak-oidc` is the containerised leg and **has never been observed to pass** — it was written where no container runtime would start. The row returns to GATED on the first green run of that job, not before |
| Accessibility is checked on the views an analyst uses, not only on the landing page | `ROADMAP.md` | `ci.yml :: Web — Tests` (`apps/web/src/test/a11y.test.tsx`) | core | GATED | 1.1 narrowed the "WCAG AA full accessibility pass" claim because axe covered the landing and chrome components only. 4.7 covers **all five** operator views the plan names: the alerts queue and list, the investigation rail, settings, and -- added by depth 8.1 -- the case list and the case workspace. Extending it to the last two found four real defects rather than confirming a clean sheet: two `<select>` filters with no accessible name (one of them the control that *writes* a case's status, so an unlabelled one is a state change somebody cannot see they are making), two `<aside>` landmarks indistinguishable from each other in the landmark list a screen-reader user navigates from, and panel headings at `h3` directly under the page's `h1`, which reads as a missing section. Each asserts it rendered real markup **before** axe runs, because axe passes on an empty div and a view that rendered a spinner would report coverage the suite does not have. That guard immediately caught one: the rail keys SWR on a tuple, the fixture read only the string form, and it was rendering its error state. **Limits stated**: axe checks a subset of WCAG rather than all of it, and jsdom computes no styles for CSS variables so the `color-contrast` rule is disabled and reviewed by hand |
| A playbook can start from an alert, and previews before it acts | `apps/docs/docs/console/playbooks.md` | `ci.yml :: Python — Tests` (agents, `test_alert_triggered_playbooks.py`) | core | GATED | `find_matching()` had **no production caller**, so no playbook ever ran from an alert. Three switches must agree before one acts (deployment, tenant, playbook) and the default of every one is off; anything short of all three runs in **preview**, with its plan and simulated steps attached to the alert. Preview is the default state rather than a mode somebody has to remember, so a deployment that enables the feature and forgets the per-playbook list gets previews rather than containment. The live list is read per call, so turning one off takes effect on the next alert rather than the next restart. It runs **after** triage, because a playbook's conditions read the verdict |
| An approval step is a durable pause that survives a restart | `apps/docs/docs/console/playbooks.md` | `ci.yml :: Python — Tests` (agents, `test_playbook_pause_resume.py`) | core | GATED | The engine is a single-threaded index walk with no pause and no resume, so `approval` failed closed and **12 shipped playbooks aborted on it**. Failing closed was right (it previously returned `{"skipped": true}` while reporting SUCCESS, letting a run continue into the action a human was meant to authorise) but it is not an approval mechanism. Migration `081` stores the position **and the context**, because the resumed half would otherwise see an empty context and every templated parameter would resolve to nothing. The stored index is the approval step itself and resume advances past it, so a replayed decision continues rather than pausing again. The pause is resolved **before** the run continues, so a double-tap in the responder app resumes once. Expiry is mandatory with a recorded outcome: `expired` is a decision, not the absence of one |
@@ -335,9 +330,9 @@ Statuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL`
## Summary
-- Total: 270
-- GATED: 268
-- PARTIAL: 2
+- Total: 319
+- GATED: 315
+- PARTIAL: 4
- NO GATE: 0
Counts come from `scripts/check_claim_gate_matrix.py`, which is also the gate. Recompute