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
docs: the kill switch stops dispatch now, so stop saying it does not (#1537)
Beenu Aroradbaf88a4c59a
diff --git a/docs/audit/CLAIM_TO_GATE_MATRIX.md b/docs/audit/CLAIM_TO_GATE_MATRIX.mdindex 1b2a9f86c..c33c4a0a1 100644--- a/docs/audit/CLAIM_TO_GATE_MATRIX.md+++ b/docs/audit/CLAIM_TO_GATE_MATRIX.md@@ -329,7 +329,7 @@ Statuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL`| An adversary-in-the-middle session replay is detected on the session, not on the user | `services/fusion/app/data/windowed_ruleset.json` (`wd-aitm-*`); depth plan 7.3 | `ci.yml :: python-test` (fusion, `test_aitm_session_rules.py` — 20 cases driving the **real** `WindowedDetectionEngine`, the real matcher and the **shipped** ruleset loaded off disk rather than a hand-made rule list: the replay fires all four rules, the negative twin fires none of them, a single event fires nothing, two sessions for one user do not complete each other, an event with no session id is not grouped at all, the sequence does not fire without its MFA stage or in the wrong order, and one tenant's sign-in cannot complete another's replay) + `ci.yml` connectors matrix (`test_aitm_session_fields_reach_detection.py` — 18 cases driving the real `OktaConnector.normalize()` and `AzureEntraConnector.normalize()` over hand-authored vendor payloads, including that `mfa_satisfied` is three-valued and that a Graph `correlationId` does not stand in for a missing `sessionId`) + `ci.yml :: python-lint` (`check_windowed_translation.py` — the ceiling of 0 windowed rules selecting on a computed field, which is what forced the connector hoist rather than a rule naming a field nothing emits; `export_windowed_ruleset.py --check` for drift between the authored list and the artefact the engine loads) | core | GATED | The two halves live in different interpreters because `services/connectors` and `services/fusion` both name their package `app`; the connector test pins the payload the engine test transcribes, so a connector change that drops a field reds the connector test rather than silently passing the engine one || No two database migrations claim the same number, so a chain applies in one order on a fresh install and on an upgrade alike | `services/api/app/scripts/run_migrations.py` (orders by filename, records applied by filename); `scripts/check_migration_numbering.py` | `migration-numbering.yml :: migration-numbering` (no `paths:` filter on either trigger, so it grades every pull request and every push to a protected branch — the collision is a property of a *pair* of files and the second half can arrive from somebody else's merge, so a filter scoped to the migrations directory would miss exactly the case that bites. Discovers all 6 numbered chains structurally rather than from a list, which is what finds `services/osquery-tls/app/db/versions` under its non-conventional `script_location`. Proven against the real defect: a worktree holding both `121_fusion_alert_outbox.sql` and PR 1525's `121_closure_authorization_default_deny.sql` exits 1 naming both, and the same tree with the new-duplicate arm disabled reports a confident OK. The 13 historical collisions already on main are frozen by file set, checked in both directions so a stale exemption and a third file joining an old pair each fail | core | GATED | — || A query credited as tenant-scoped is one whose `tenant_id` constrains the rows read or written, not one that merely mentions the column | `scripts/check_tenant_query_predicates.py` (`_tenant_predicate_in_sql`) | `isolation.yml :: Tenant query predicates` (the credit is decided by the clause the token sits in, so a `RETURNING` list, a `SELECT` projection, an `ORDER BY`, a `GROUP BY`, an UPDATE `SET` and a SQL comment all stop counting, while `WHERE`, join `ON`, `USING`, `HAVING`, an INSERT column list and an `ON CONFLICT` target still do. Both code paths were fixed, not one: `_names` collects string constants, so the statement's own SQL came back round and a second bare-token test re-granted the credit on 14 of the 17 statements the first fix had demoted. 36 self-test cases written per SQL *clause* rather than per instance found, including the padding-free fragment branch and a control that an appended fragment naming the column without comparing it still fails. Proven both ways on the live tree: with its ratchet entry removed the real `UPDATE … RETURNING id, tenant_id` outbox claim is flagged, and reverting the detector to the bare-token match stops it being flagged | core | GATED | — |-| The platform-wide kill switch can actually be engaged, and an engaged one stops automatic closure | `docs/remediation/kill-switch-reachability.md`; `services/api/migrations/123_kill_switch_global_engageable.sql`; parity 2.2 | `kill-switch-live.yml :: The platform-wide stop can be engaged, and stops closure` (real Postgres, every migration applied, driven as the NOSUPERUSER NOBYPASSRLS `aisoc_app` role because the migration owner is a superuser and ignores policies even under FORCE ROW LEVEL SECURITY — the job fails if the DSN resolves to a role that can bypass, and the suite refuses to run against one, because seeding the global row as the owner is the workaround that hid this for 45 migrations. 25 cases across three suites: the global row is writable by an unbound session and by nothing else, a tenant cannot write the global row or another tenant's row or another tenant's audit row, an unbound session cannot write into any tenant, the real routes write the row end to end through the real ASGI app, a tenant_admin and an analyst are both refused 403 while the tenant switch still works for them, and `resolve_closure_policy` refuses a 0.99 verdict against a 0.50 bar with source=kill_switch for a tenant that engaged nothing itself) + `ci.yml :: Python — Tests` (api `test_kill_switch.py`, the global routes resolve their handler, require `platform_kill_switch:write` read off the resolved dependency tree rather than the handler source, and take the unbound session) | core | GATED | Before this the global row had no writer at all: every write in the endpoint module bound the caller's tenant, so no endpoint, console control, CLI or script could set `tenant_id IS NULL`, while two readers consulted it on every alert. **There is still no console control for the kill switch in either scope** — both are API-only. **An engaged switch stops closure and not dispatch**: `services/actions`, playbook dispatch and the MCP write surface contain no reference to it, contrary to the module docstring, which is recorded as a separate defect rather than fixed here |+| The platform-wide kill switch can actually be engaged, and an engaged one stops automatic closure and action dispatch | `docs/remediation/kill-switch-reachability.md`; `services/api/migrations/123_kill_switch_global_engageable.sql`; parity 2.2 | `kill-switch-live.yml :: The platform-wide stop can be engaged, and stops closure` (real Postgres, every migration applied, driven as the NOSUPERUSER NOBYPASSRLS `aisoc_app` role because the migration owner is a superuser and ignores policies even under FORCE ROW LEVEL SECURITY — the job fails if the DSN resolves to a role that can bypass, and the suite refuses to run against one, because seeding the global row as the owner is the workaround that hid this for 45 migrations. 25 cases across three suites: the global row is writable by an unbound session and by nothing else, a tenant cannot write the global row or another tenant's row or another tenant's audit row, an unbound session cannot write into any tenant, the real routes write the row end to end through the real ASGI app, a tenant_admin and an analyst are both refused 403 while the tenant switch still works for them, and `resolve_closure_policy` refuses a 0.99 verdict against a 0.50 bar with source=kill_switch for a tenant that engaged nothing itself) + `ci.yml :: Python — Tests` (api `test_kill_switch.py`, the global routes resolve their handler, require `platform_kill_switch:write` read off the resolved dependency tree rather than the handler source, and take the unbound session) + `action-durability-live.yml :: One approval, one vendor call, or an honest unknown` (real Postgres; the step *An engaged kill switch stops the dispatcher, and a released one does not* asserts both directions, and *The gate fails when dispatch stops consulting the switch* is the negative control, which refuses to run if it cannot find the line it removes) | core | GATED | Before this the global row had no writer at all: every write in the endpoint module bound the caller's tenant, so no endpoint, console control, CLI or script could set `tenant_id IS NULL`, while two readers consulted it on every alert. **There is still no console control for the kill switch in either scope** — both are API-only. **An engaged switch now stops action dispatch as well as closure**: the check sits in `live_actions.dispatch()` before the executor is resolved, which covers the actions dispatcher and playbook dispatch, since playbook steps reach a vendor through that one chain. Dry runs are stopped too, and an unreadable switch refuses rather than dispatching. The fourth point the module docstring claimed — the MCP write tools — was corrected rather than implemented, because no such write surface exists |## Summarydiff --git a/docs/remediation/kill-switch-reachability.md b/docs/remediation/kill-switch-reachability.mdindex 4d764594b..947497cd1 100644--- a/docs/remediation/kill-switch-reachability.md+++ b/docs/remediation/kill-switch-reachability.md@@ -359,8 +359,8 @@ Stated rather than implied.- **No multi-replica test.** The suites drive one application process. Theswitch is a database row read by every replica, so there is no per-replicastate to diverge, but that is an argument rather than a measurement.-- **Only closure honours the switch. Three of the four paths the docstring- names do not consult it at all.** `endpoints/kill_switch.py` opens by+- **~~Only closure honours the switch. Three of the four paths the docstring+ names do not consult it at all.~~ Closed since this note was written.** `endpoints/kill_switch.py` opens bysaying the switch is "checked first and separately by everything thatacts: closure in the triage worker, the actions dispatcher, playbookdispatch and the MCP write tools". Closure is real and is proven above:@@ -371,6 +371,15 @@ Stated rather than implied.`app.closure` in any form, and neither does playbook dispatch or the MCPwrite surface.+ So, *at the time this note was written*, **an engaged kill switch stopped+ automatic closure and did not stop action dispatch.** That is no longer true:+ the follow-up gated `live_actions.dispatch()` before the executor is resolved,+ which covers the actions dispatcher and playbook dispatch, and corrected the+ MCP claim rather than implementing it, because no MCP write surface exists.+ See [`kill-switch-enforcement-reach.md`](kill-switch-enforcement-reach.md).+ What follows is kept as the record of what was true then.++ <!-- superseded -->So **an engaged kill switch stops automatic closure and does not stopaction dispatch.** That is a second, separate defect of the same family asthis one, found while verifying this note rather than reported. It is not