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
fix(ci): wire the mcp service into the production overlay, and finish the 2,586 -> 2,614 count sweep
beenuar18315750ea22
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex c615d7667..3f68e2016 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -1085,7 +1085,7 @@ jobs:run: |python3 scripts/sync_vendored_playbook_packs.py --self-testpython3 scripts/sync_vendored_playbook_packs.py --check- # The same defect, one service over. The fusion engine loads 2,586+ # The same defect, one service over. The fusion engine loads 2,614# detection rules from four artefacts and the console's rule-management# surface could see none of them (#1273), because the API image is built# from `services/api` and `services/fusion/app/data/` is outside thatdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex b8f07ca37..b33e8ebf0 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -193,7 +193,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0absent verdict counts as *not* auto-executing, because inferring one fromwhatever else is on the row is how this happened the first time.-- **Rule management showed 0 rules while the detection engine ran 2,586 of+- **Rule management showed 0 rules while the detection engine ran 2,614 ofthem** ([#1273](https://github.com/beenuar/AiSOC/issues/1273)). `/detection`rendered "No detection rules yet", `GET /api/v1/rules` answered `[]`,`GET /api/v1/detection/rules` answered `{"rules":[],"total":0}` and the MCP@@ -238,12 +238,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0change the engine will not run; `confidence`, false-positive rate and hithistory are absent from the artefacts, so they travel with`confidence_measured: false` and the Confidence and Drift panels report- `summary.unscored` instead of averaging a placeholder across 2,586 rules;+ `summary.unscored` instead of averaging a placeholder across 2,614 rules;and an unreadable corpus renders as a failure naming the paths, never as"no detection rules yet".Measured before and after on the same tree: `GET /api/v1/detection/rules`- `total` 0 → 2,586, equal to the union of ids returned by fusion's own+ `total` 0 → 2,614, equal to the union of ids returned by fusion's own`_load_ruleset()`, `load_window_rules()` and `load_sequence_rules()` run ina subprocess.diff --git a/apps/docs/docs/console/rule-library.md b/apps/docs/docs/console/rule-library.mdindex 4d5cffd8d..5e5abc1f0 100644--- a/apps/docs/docs/console/rule-library.md+++ b/apps/docs/docs/console/rule-library.md@@ -1,13 +1,13 @@---sidebar_position: 3title: Detection rule library-description: How /detection lists the 2,586 rules the detection engine runs, where they come from, and what disabling one actually does.+description: How /detection lists the 2,614 rules the detection engine runs, where they come from, and what disabling one actually does.---# Detection rule library`/detection` lists every rule the fusion detection engine loads, together with-any rule this tenant has authored. On a default install that is **2,586+any rule this tenant has authored. On a default install that is **2,614rules**, and the number on the page is derived from the same artefacts theengine reads rather than from a second count.diff --git a/apps/web/src/components/detections/ConfidenceTrends.tsx b/apps/web/src/components/detections/ConfidenceTrends.tsxindex 6fd37e660..bc068bd8e 100644--- a/apps/web/src/components/detections/ConfidenceTrends.tsx+++ b/apps/web/src/components/detections/ConfidenceTrends.tsx@@ -124,7 +124,7 @@ export function ConfidenceTrends() {// `unscored` is the library the engine runs. Those rules exist and fire;// the compiled corpus simply records no confidence for them, so every// average here would be shaped by a placeholder rather than measured.- // "No rules yet" over 2,586 running rules is the wrong sentence.+ // "No rules yet" over 2,614 running rules is the wrong sentence.const unscored = data?.summary.unscored ?? 0;return (<EmptyStatediff --git a/apps/web/src/components/detections/DetectionsView.honesty.test.tsx b/apps/web/src/components/detections/DetectionsView.honesty.test.tsxindex 78d697357..cb711cc11 100644--- a/apps/web/src/components/detections/DetectionsView.honesty.test.tsx+++ b/apps/web/src/components/detections/DetectionsView.honesty.test.tsx@@ -2,7 +2,7 @@* What `/detection` is allowed to say about rules it cannot see.** Issue #1273: the page rendered "No detection rules yet" on a stack loading- * and firing 2,586 of them. The sentence was the damage — an operator reading+ * and firing 2,614 of them. The sentence was the damage — an operator reading* it concludes their coverage is zero and stops looking, which is worse than* an error.*@@ -86,8 +86,8 @@ function page(): DetectionRuleListResult {return {rules: [builtin('a', 'SQL Injection Attempt in HTTP Query')],- total: 2586,- builtinTotal: 2586,+ total: 2614,+ builtinTotal: 2614,customTotal: 0,returned: 1,offset: 0,@@ -112,9 +112,9 @@ describe('the rule library on first paint', () => {expect(screen.getByText('SQL Injection Attempt in HTTP Query'),).toBeInTheDocument();- // One rule is on this page; 2,586 are in the library. Rendering the page+ // One rule is on this page; 2,614 are in the library. Rendering the page// length as the total is how a bounded list starts under-reporting.- expect(screen.getByText(/2,586 in the library/)).toBeInTheDocument();+ expect(screen.getByText(/2,614 in the library/)).toBeInTheDocument();expect(screen.queryByText(/No detection rules yet/i),).not.toBeInTheDocument();@@ -154,8 +154,8 @@ describe('the rule library on first paint', () => {it('names a partially missing corpus rather than publishing the short total', () => {swrState.data = page({- total: 2583,- builtinTotal: 2583,+ total: 2611,+ builtinTotal: 2611,missingArtefacts: ['windowed_builtin_rules.json'],});render(<DetectionsView />);diff --git a/apps/web/src/components/detections/DetectionsView.tsx b/apps/web/src/components/detections/DetectionsView.tsxindex d161595f7..9224f3b2b 100644--- a/apps/web/src/components/detections/DetectionsView.tsx+++ b/apps/web/src/components/detections/DetectionsView.tsx@@ -173,7 +173,7 @@ const TABS: { id: DetectionsTab; label: string; description: string }[] = [// ─── Component ────────────────────────────────────────────────────────────────-//: One page of rules. The library is 2,586 entries on a default install, so+//: One page of rules. The library is 2,614 entries on a default install, so//: the list is paged and every filter runs on the server — rendering the//: whole corpus would trade an empty page for an unusable one.const PAGE_SIZE = 50;@@ -188,14 +188,14 @@ export function DetectionsView() {const [page, setPage] = useState(0);// Typing a character per request would put one round-trip per keystroke- // against a 2,586-rule search.+ // against a 2,614-rule search.const [debouncedSearch, setDebouncedSearch] = useState('');useEffect(() => {const timer = setTimeout(() => setDebouncedSearch(search.trim()), 250);return () => clearTimeout(timer);}, [search]);- // Any filter change invalidates the page offset: page 4 of a 2,586-rule+ // Any filter change invalidates the page offset: page 4 of a 2,614-rule// list is page 0 of a six-rule one.useEffect(() => {setPage(0);@@ -617,7 +617,7 @@ export function DetectionsView() {libraryTotal === 0 ? (// Only reachable when the library really is empty: the compiled// corpus read fine and held nothing, and the tenant has authored- // nothing. A default install ships 2,586 engine rules, so this+ // nothing. A default install ships 2,614 engine rules, so this// now means what it says.<EmptyStatetitle="No detection rules yet"diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.tsindex 628302c48..41217da47 100644--- a/apps/web/src/lib/api.ts+++ b/apps/web/src/lib/api.ts@@ -4942,7 +4942,7 @@ export const detectionApi = {/*** The tenant's effective rule library: the compiled corpus the engine runs* plus whatever this tenant has tuned. Filters and paging are server-side- * because the library is 2,586 rules on a default install and serialising+ * because the library is 2,614 rules on a default install and serialising* all of it is several megabytes.*/list: (params: DetectionRuleListParams = {}) => {diff --git a/docker-compose.prod.yml b/docker-compose.prod.ymlindex 9aa56339c..6de1235f4 100644--- a/docker-compose.prod.yml+++ b/docker-compose.prod.yml@@ -331,6 +331,20 @@ services:preflight-secrets:condition: service_completed_successfully+ # The MCP server (depth 9.1), a `--profile mcp` opt-in that is off by+ # default. It publishes 8096 in the base file for local clients; in+ # production it is unpublished like every other upstream, because the+ # console does not proxy it and an operator who wants an external MCP+ # endpoint exposes it deliberately. It authorizes every call from the+ # credential in the request (no static key — `check_mcp_over_http.py`+ # enforces that), so the credential check still gates its start.+ mcp:+ depends_on:+ preflight-secrets:+ condition: service_completed_successfully+ ports: !reset []+ restart: unless-stopped+# The console. Demo mode is inlined at build time by Next, so this asserts# the runtime side only; pull the `latest` tag rather than a `-demo` one.web:diff --git a/docs/audit/CLAIM_TO_GATE_MATRIX.md b/docs/audit/CLAIM_TO_GATE_MATRIX.mdindex 0f5af74ce..b45e29085 100644--- a/docs/audit/CLAIM_TO_GATE_MATRIX.md+++ b/docs/audit/CLAIM_TO_GATE_MATRIX.md@@ -78,7 +78,7 @@ Statuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL`| Scheduled hunt findings flow into governed detection proposals | README (proactive hunting → detections) | `ci.yml` api job (`test_wave1_loop_edges.py` — a scheduled hunt that returns hits opens a DRAFT `DetectionRuleProposal` (source `hunt-finding`) into the propose→review→eval-gate→promote lifecycle; zero-hit / flag-off paths open nothing) **plus `test_hunt_scheduler_execute.py` + `test_event_warehouse_providers.py`, which gate the executor the lifecycle depends on** | core | GATED | this row was previously proven only by `test_wave1_loop_edges.py`, which injects an `executor` stub (`runner = executor or _execute_hunt`). The real `_execute_hunt` could not return a hit on any deployment, so the gate passed against a path that could not run — see the row below || A scheduled hunt runs against the SIEM the tenant connected in the console | (implied by hunt scheduling + multi-tenant) | `ci.yml` api job (`test_event_warehouse_credentials.py` — credentials resolve from the tenant's vault-encrypted `connectors` row, the query is tenant + enabled + type scoped in compiled SQL, a pinned connector id is still tenant-filtered, and an undecryptable secret is distinguishable from an unconnected one; `test_event_warehouse_registry.py` — a Splunk-only tenant is routed to Splunk rather than to Elasticsearch; `test_event_warehouse_providers.py` — each driver runs against its connector's URL with its connector's auth, and the SSRF allow-list is that connector's own endpoint) | core | GATED | the drivers are exercised against mocked vendor HTTP, not a live Splunk or Elasticsearch; a vendor-sandbox integration job needs credentials nobody has provisioned || Analyst disposition history drives human-approval-gated tuning proposals | README (self-improving detections) | `ci.yml` api job (`test_wave1_loop_edges.py` — the previously-orphaned `suggest_tuning` engine is wired to real per-rule disposition history via `/detection/tuning/auto-suggest`, opening DRAFT proposals; `test_detection_tuner.py` fixture-gates the engine) + `ci.yml :: Python — Lint & Type-check` (`check_raw_sql_columns.py` — every table and column a raw `text()` INSERT/UPDATE names must be one some migration creates) | core | GATED (the gap this row used to name was wrong in the repository's favour: no job ran `services/api/tests/` against a real database at all, and the only assertion on the insert was a substring test that would still have passed on the wrong table name, because the wrong name contains the right one. The structural gate caught what no mock could — `detection_rule_proposals` has never had a `source` column, so all three automated proposal paths raised on their first row on every deployment; migration 073 adds it) | — |-| The rule-management surface lists the rules the detection engine actually runs, and disabling one reaches the engine | `apps/docs/docs/console/rule-library.md`; [#1273](https://github.com/beenuar/AiSOC/issues/1273) | `ci.yml :: python-lint` (`sync_packaged_detection_rulesets.py --self-test` then `--check`: the three compiled artefacts and the three Python-resident windowed rules must exist byte-identical inside the API's Docker build context, checked in both directions so a file only on the packaged side fails too) + `validate-detections.yml` (the same check, on the workflow a corpus change triggers) + `ci.yml :: Python — Tests` (api, `test_builtin_rule_catalogue.py` — the catalogue's rule-id set is asserted **equal** to the union of ids fusion's own `_load_ruleset()`, `load_window_rules()` and `load_sequence_rules()` return, run in a subprocess because both services name their top-level package `app`; the console route is driven through a real ASGI app and must report 2,586; and disabling a built-in is followed by handing the stored row to fusion's real `build_overlay`, loaded by path, which must report it suppressed) + web type-check and `DetectionsView.honesty.test.tsx` | core | GATED | Both API routes and the MCP tool read the Postgres `detection_rules` table and nothing in production writes a built-in row — `tenant_id` is `NOT NULL` in every migration, so the platform-wide row they look for cannot exist. The constraint that shaped the fix is packaging: the API image is built from `services/api`, so `services/fusion/app/data/` was never reachable and a handler change alone would pass in a checkout and fail in every container. Built-ins are not seeded into Postgres; the artefact stays the single source of truth for what runs and a tenant row materialises on first write, keyed on `provenance->>'source_id'`, which is what the overlay already joins on |+| The rule-management surface lists the rules the detection engine actually runs, and disabling one reaches the engine | `apps/docs/docs/console/rule-library.md`; [#1273](https://github.com/beenuar/AiSOC/issues/1273) | `ci.yml :: python-lint` (`sync_packaged_detection_rulesets.py --self-test` then `--check`: the three compiled artefacts and the three Python-resident windowed rules must exist byte-identical inside the API's Docker build context, checked in both directions so a file only on the packaged side fails too) + `validate-detections.yml` (the same check, on the workflow a corpus change triggers) + `ci.yml :: Python — Tests` (api, `test_builtin_rule_catalogue.py` — the catalogue's rule-id set is asserted **equal** to the union of ids fusion's own `_load_ruleset()`, `load_window_rules()` and `load_sequence_rules()` return, run in a subprocess because both services name their top-level package `app`; the console route is driven through a real ASGI app and must report 2,614; and disabling a built-in is followed by handing the stored row to fusion's real `build_overlay`, loaded by path, which must report it suppressed) + web type-check and `DetectionsView.honesty.test.tsx` | core | GATED | Both API routes and the MCP tool read the Postgres `detection_rules` table and nothing in production writes a built-in row — `tenant_id` is `NOT NULL` in every migration, so the platform-wide row they look for cannot exist. The constraint that shaped the fix is packaging: the API image is built from `services/api`, so `services/fusion/app/data/` was never reachable and a handler change alone would pass in a checkout and fail in every container. Built-ins are not seeded into Postgres; the artefact stays the single source of truth for what runs and a tenant row materialises on first write, keyed on `provenance->>'source_id'`, which is what the overlay already joins on || Detections can be backtested over historical lake data before promotion | README (detection engineering) | `ci.yml` api job (`test_backtest.py` — bounded/allow-listed SQL construction with injection-sanitised source filter, lake-row→event mapping with JSON payload expansion, exact would-fire count + hit-rate + samples; `test_backtest_gate.py` — opt-in `AISOC_BACKTEST_MAX_HIT_RATE` /decide gate) + web type-check (rule-editor backtest panel) + `isolation-live.yml` (`tests/isolation/test_backtest_lake_live.py` — the real `fetch_lake_events` against ClickHouse 23.8, table built from `clickhouse/001_init.sql` and rows seeded through the production `lake_writer.event_to_row`) | full | GATED (the gap this row used to name was wrong: nothing ran the live fetch, and the tenant-scoping path existed twice — `detection_rules.py` carried its own near-identical copy, now deleted, with a test asserting exactly one definition survives. The live path exposed a defect no unit could: the writer stores OCSF `raw_data` into a column named `raw_payload` and `rows_to_events` expanded neither, so the payload expansion its docstring promises had never run on a real lake row. `services/api/app/services/backtest.py` was also absent from the workflow's path filter, so a change to the function under test did not trigger the job) | — || Asking the affected person, then their manager, is a workflow a playbook branches on — not a message that is sent and forgotten | `services/agents/app/playbook/verification.py`; `playbooks/packs/v1/suspicious-signin/user-verification-containment.playbook.json`; depth plan 5.4 | `ci.yml :: python-lint` (`check_stateful_verification.py --self-test` then the gate: the answer is HMAC-signed over token, answer **and** stage — so a link minted for the subject stops verifying once the question escalates — compared with `compare_digest`; an unanswered prompt escalates to the manager and then resumes with `timed_out`, a value a playbook can read; the confirmed-true-positive refusal is checked **before** the opt-in, because that rule has no opt-out and the other order would let a tenant opt into messaging a compromised account; and `aisoc_verification_policies` has a writer, since a control that fails closed with no way to switch it on is a feature that reads as broken. Eleven injected violations, one per rule) + `ci.yml` agents job (`test_playbook_verification.py`, 20 cases driving the real engine end to end: ask, pause, signed answer, branch, approval — and the stale-link case, where the subject's own `denied` link is refused after the escalation and a manager-stage one is accepted) + `verification-live.yml` (`test_verification_pause_live.py`, 12 cases against real Postgres with every migration applied, because only a real transaction can show that the conditional UPDATEs claim a row once and that migration 102's CHECK admits all five outcomes the code writes) | core | GATED | — || The retention window a tenant chooses is the one the lake honours, and a legal hold outranks it | `services/api/app/services/retention.py`; `services/api/clickhouse/001_init.sql`; depth plan 4.3 | `ci.yml :: python-lint` (`check_retention_window.py --self-test` then the gate: the table TTL, the tiering DELETE and `MAX_LAKE_DAYS` are held to one number at or above 400 days, a `MODIFY TTL` migration exists so an existing volume converges — `001_init.sql` runs only on a fresh one — and the purge worker reads the holds in force, decides through `may_purge`, and reports what it withheld. Eight injected violations, one per rule) + `ci.yml` api job (`test_retention_legal_hold.py`, 13 cases driving the worker against recording doubles. **Half of them are the positive control**, because a purge stuck closed withholds everything on every deployment and passes every "did the hold work" assertion perfectly: a tenant with no hold is asserted to still lose its aged rows, and a hold on one tenant is asserted not to freeze another. Proven against the pre-fix worker, where five fail) | core | PARTIAL (the lake half is static: ClickHouse enforces a table TTL during merges and no test in CI watches a row survive past day 90 on a real server, so what is gated is that the three numbers agree and that the migration exists, not that ClickHouse honoured it. The purge half is gated against doubles rather than live Postgres and ClickHouse. And a hold currently stops the whole tenant's sweep rather than only its own subjects, because both purges are bulk statements — recorded as follow-up rather than approximated) | a live-store retention test |diff --git a/docs/openapi.yaml b/docs/openapi.yamlindex 9d62adce1..f80d922e9 100644--- a/docs/openapi.yaml+++ b/docs/openapi.yaml@@ -3742,7 +3742,7 @@ paths:nothing in production has ever written a built-in row, a default install- answered with an empty list while the engine ran 2,586 rules.+ answered with an empty list while the engine ran 2,614 rules.``X-Total-Count`` carries the number matching the filters, which is not@@ -4105,7 +4105,7 @@ paths:This used to read ``detection_rules`` alone and therefore answered with an- empty list on every install, while fusion loaded and fired 2,586 rules+ empty list on every install, while fusion loaded and fired 2,614 rules(#1273). The filters and the page bound are not cosmetic: the whole@@ -4239,7 +4239,7 @@ paths:built-in''s detail page opens without a row having to exist for it. The- read never creates one: a GET that materialised would put 2,586 rows per+ read never creates one: a GET that materialised would put 2,614 rows pertenant in a table meant to hold decisions.'operationId: get_rule_compat_api_v1_detection_rules__rule_id__get@@ -4400,7 +4400,7 @@ paths:the ``detection_rules`` table alone and therefore drew an empty heatmap- over a product shipping ATT&CK mappings for 2,586 loaded rules — the+ over a product shipping ATT&CK mappings for 2,614 loaded rules — thestrongest possible version of the "blind to everything" answer, anddiff --git a/scripts/sync_packaged_detection_rulesets.py b/scripts/sync_packaged_detection_rulesets.pyindex ba36bb272..97b6e0e27 100644--- a/scripts/sync_packaged_detection_rulesets.py+++ b/scripts/sync_packaged_detection_rulesets.py@@ -3,11 +3,11 @@Why this exists----------------The fusion detection engine loads four things and runs 2,586 rules from them:+The fusion detection engine loads four things and runs 2,614 rules from them:- services/fusion/app/data/detection_ruleset.json 741 stateless+ services/fusion/app/data/detection_ruleset.json 765 statelessservices/fusion/app/data/detection_ruleset_imported.json 1770 stateless- services/fusion/app/data/windowed_ruleset.json 72 (70 windowed + 2 sequence)+ services/fusion/app/data/windowed_ruleset.json 76 (73 windowed + 3 sequence)services/fusion/app/services/windowed_detection.py 3 windowed, declared in PythonThe console's rule-management surface could see none of them (#1273). Thediff --git a/services/api/app/api/v1/endpoints/detection_compat.py b/services/api/app/api/v1/endpoints/detection_compat.pyindex d296fa22f..a9632ae53 100644--- a/services/api/app/api/v1/endpoints/detection_compat.py+++ b/services/api/app/api/v1/endpoints/detection_compat.py@@ -50,7 +50,7 @@ router = APIRouter(prefix="/detection", tags=["detection_rules"])#: A rule from either store. The analytics helpers below read attributes that#: a stored row and a compiled-catalogue projection both carry, and they have#: to read both: scoping them to ORM rows is what made the MITRE heatmap draw-#: an empty grid over a library of 2,586 mapped rules.+#: an empty grid over a library of 2,614 mapped rules.RuleLike = DetectionRule | RuleView@@ -92,7 +92,7 @@ class FrontendDetectionRule(BaseModel):class ListResponse(BaseModel):rules: list[FrontendDetectionRule]#: Rules matching the request's filters. Not the number returned — the- #: library is 2,586 rules on a default install and the page is bounded.+ #: library is 2,614 rules on a default install and the page is bounded.total: int#: The whole library before filters, split by origin. The header states#: library size; ``total`` states the size of the result.@@ -278,7 +278,7 @@ async def list_rules_compat("""The tenant's effective rule library: the compiled corpus plus its tuning.This used to read ``detection_rules`` alone and therefore answered with an- empty list on every install, while fusion loaded and fired 2,586 rules+ empty list on every install, while fusion loaded and fired 2,614 rules(#1273). The filters and the page bound are not cosmetic: the wholelibrary serialised is several megabytes, so an unbounded list would havetraded an empty page for an unusable one.@@ -350,7 +350,7 @@ async def get_rule_compat(Resolves a stored row first and the compiled catalogue second, so abuilt-in's detail page opens without a row having to exist for it. The- read never creates one: a GET that materialised would put 2,586 rows per+ read never creates one: a GET that materialised would put 2,614 rows pertenant in a table meant to hold decisions."""view = await resolve_rule(db, current_user.tenant_id, rule_id)@@ -611,7 +611,7 @@ class DriftSummary(BaseModel):#: Rules the drift heuristics cannot judge. Every heuristic here reads a#: column that only operator review and the rule IDE write — confidence,#: FP rate, last trigger — and the compiled corpus records none of them.- #: Scoring 2,586 built-ins at a placeholder confidence of 0 would fill the+ #: Scoring 2,614 built-ins at a placeholder confidence of 0 would fill the#: inbox with "low confidence, stale" for every rule in the product.unscored: int = 0@@ -674,8 +674,8 @@ class ConfidenceSummary(BaseModel):lowConfidence: int # rules below ``DRIFT_LOW_CONFIDENCE_THRESHOLD``#: Rules excluded from every figure above because no confidence has ever#: been recorded for them. Published rather than dropped: a mean over 3- #: rules beside a library of 2,586 is a different claim from a mean over- #: 2,589, and the reader cannot tell which they are looking at otherwise.+ #: rules beside a library of 2,614 is a different claim from a mean over+ #: 2,617, and the reader cannot tell which they are looking at otherwise.unscored: int = 0@@ -1080,7 +1080,7 @@ async def get_detection_coverage(Reads the whole effective library, built-ins included. It previously readthe ``detection_rules`` table alone and therefore drew an empty heatmap- over a product shipping ATT&CK mappings for 2,586 loaded rules — the+ over a product shipping ATT&CK mappings for 2,614 loaded rules — thestrongest possible version of the "blind to everything" answer, andwrong."""diff --git a/services/api/app/api/v1/endpoints/detection_rules.py b/services/api/app/api/v1/endpoints/detection_rules.pyindex 9abe8a964..0c4dd4e16 100644--- a/services/api/app/api/v1/endpoints/detection_rules.py+++ b/services/api/app/api/v1/endpoints/detection_rules.py@@ -143,7 +143,7 @@ async def list_rules(tenant's own rules, and rules from MSSP-assigned packs (with excludedoverrides removed). Before #1273 only the last two were read, and sincenothing in production has ever written a built-in row, a default install- answered with an empty list while the engine ran 2,586 rules.+ answered with an empty list while the engine ran 2,614 rules.``X-Total-Count`` carries the number matching the filters, which is notthe number returned: the response stays a bare array so existing callersdiff --git a/services/api/app/services/builtin_rules.py b/services/api/app/services/builtin_rules.pyindex 381b6e5d8..c1ae11c9b 100644--- a/services/api/app/services/builtin_rules.py+++ b/services/api/app/services/builtin_rules.py@@ -1,6 +1,6 @@"""The compiled detection corpus the engine runs, as something the console can read.-Issue #1273: a core install loads 2,586 detection rules into fusion and fires+Issue #1273: a core install loads 2,614 detection rules into fusion and firesthem, while every rule-management surface answered with an empty list. BothAPI routes, and the MCP tool behind them, read the Postgres ``detection_rules``table — and nothing in production has ever written a built-in row there. The@@ -12,7 +12,7 @@ It is a **reader**. The compiled artefacts stay the single source of truth forwhat the engine runs, and ``detection_rules`` stays the single source of truthfor what a tenant has tuned. The two are merged at read time.-Seeding 2,586 rows into Postgres at boot was the other option and is worse:+Seeding 2,614 rows into Postgres at boot was the other option and is worse:the corpus is regenerated by three scripts on a different cadence from anymigration, so the table would immediately describe a different ruleset thanthe engine loads, and a surface that lists rules the engine does not run is@@ -173,7 +173,7 @@ class Catalogue:"""Console id to rule, for one tenant.Memoised per tenant below rather than computed here: the whole map is- 2,586 UUIDv5 digests, which is cheap once and wasteful on every+ 2,614 UUIDv5 digests, which is cheap once and wasteful on everyrequest."""return _index_for(self, str(tenant_id))diff --git a/services/api/app/services/detection_catalogue.py b/services/api/app/services/detection_catalogue.pyindex 8da24de68..dbab9b100 100644--- a/services/api/app/services/detection_catalogue.py+++ b/services/api/app/services/detection_catalogue.py@@ -27,7 +27,7 @@ under the rule's deterministic UUID and carrying ``provenance.source_id``, so:the rules that run could not be viewed, disabled or tuned.A read never materialises. A GET that writes a row for every rule it renders-would put 2,586 rows per tenant in the table on the first page load, and the+would put 2,614 rows per tenant in the table on the first page load, and thetable is supposed to hold decisions, not inventory."""diff --git a/services/api/tests/test_builtin_rule_catalogue.py b/services/api/tests/test_builtin_rule_catalogue.pyindex 320cb3d0e..b35cb1700 100644--- a/services/api/tests/test_builtin_rule_catalogue.py+++ b/services/api/tests/test_builtin_rule_catalogue.py@@ -1,6 +1,6 @@"""The rules the engine runs have to be the rules the console can see and tune.-Issue #1273: a core install loads 2,586 detection rules into fusion and fires+Issue #1273: a core install loads 2,614 detection rules into fusion and firesthem, while `GET /api/v1/rules` and `GET /api/v1/detection/rules` both answerwith an empty list, because both read the Postgres `detection_rules` table and**nothing in production ever writes a built-in row there**. An operator could@@ -336,7 +336,7 @@ class TestTheConsoleReadsTheLoadedCorpus:assert body["missingArtefacts"] == []async def test_the_page_is_bounded_and_the_total_is_not(self, client) -> None:- """2,586 rules serialised is several MB; the header count must still be true."""+ """2,614 rules serialised is several MB; the header count must still be true."""body = (await client.get("/api/v1/detection/rules", params={"limit": 25})).json()assert len(body["rules"]) == 25assert body["returned"] == 25diff --git a/services/mcp/src/tools/detections.ts b/services/mcp/src/tools/detections.tsindex 507e498c5..c3c2140a0 100644--- a/services/mcp/src/tools/detections.ts+++ b/services/mcp/src/tools/detections.ts@@ -5,7 +5,7 @@* whole library and filter in this process, which was safe only because the* route it reads answered with an empty list on every deployment — nothing* wrote a built-in rule into the table it queried (#1273). It now returns- * the 2,586-rule compiled corpus the detection engine actually runs, so the+ * the 2,614-rule compiled corpus the detection engine actually runs, so the* search term, severity and technique go to the API and the page bound is* the tool's own limit.*diff --git a/tests/test_packaged_detection_corpus_gate.py b/tests/test_packaged_detection_corpus_gate.pyindex 9a2129d9b..4c70f812f 100644--- a/tests/test_packaged_detection_corpus_gate.py+++ b/tests/test_packaged_detection_corpus_gate.py@@ -2,7 +2,7 @@`scripts/sync_packaged_detection_rulesets.py --check` is the only thingstanding between the API image and the state issue #1273 reported: a console-that lists no detection rules while the engine loads and fires 2,586. A gate+that lists no detection rules while the engine loads and fires 2,614. A gatewhose clean verdict has never been shown to be falsifiable is worth nothing,and the failure it must catch is a *packaging* one — a file absent from aDocker build context — which no handler test can see.@@ -76,7 +76,7 @@ class TestThePositiveControl:def test_a_synced_tree_is_clean(self, tmp_path: pathlib.Path) -> None:result = _check(_tree(tmp_path))assert result.returncode == 0, result.stderr- assert "2586 rules" in result.stdout+ assert "2614 rules" in result.stdoutclass TestTheGateCatchesItsOwnAbsence: