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(detections): align GitHub rules with what the connector actually emits (#1545) (#1547)
Beenu Arorab751b4754325
diff --git a/.github/workflows/validate-detections.yml b/.github/workflows/validate-detections.ymlindex b7e759a77..36b0bb648 100644--- a/.github/workflows/validate-detections.yml+++ b/.github/workflows/validate-detections.yml@@ -157,6 +157,19 @@ jobs:- name: Prove the fireability gate is not vacuousrun: python3 scripts/compile_sigma_ruleset.py --prove-gate+ # Issue #1545: ten of twelve GitHub rules could not fire on what the+ # GitHub connector actually emits — unprefixed event_type values, audit+ # actions that do not exist in GitHub's vocabulary, fields no GitHub+ # telemetry carries. Fixture replay cannot catch the class (fixtures+ # are synthesized from the rule), so this replays real-shaped audit+ # entries through the real connector and the real engine, the same way+ # the Sigma fireability proof does.+ - name: Verify GitHub rules fire on real connector output+ run: python3 scripts/check_github_rule_alignment.py --check++ - name: Prove the GitHub-alignment gate is not vacuous+ run: python3 scripts/check_github_rule_alignment.py --self-test+- name: Count rules by severityif: always()run: |diff --git a/README.md b/README.mdindex fd095469c..ac69f3944 100644--- a/README.md+++ b/README.md@@ -17,7 +17,7 @@## What AiSOC does-Telemetry arrives from your security tools. AiSOC normalizes it, runs the 2535 executable rules of+Telemetry arrives from your security tools. AiSOC normalizes it, runs the 2530 executable rules ofits 7015-rule library, groups what fires into incidents, investigates each one with an AI agent whoseevery prompt and tool call is recorded, and proposes an action. New threat intelligence re-sweeps thehistory you already collected, and a human approves before anything reaches a vendor.@@ -110,7 +110,7 @@ rule is harder to find than a missing one: of the 2,005 Splunk rules bundled her## How it worksIngest normalizes to a common shape and stamps an **activity projection** on every event — actor, action, resource, location, outcome, with `actor.kind` read from each vendor's own documented field rather than inferred — then Kafka carries it.-Then fusion runs 2535 executable detection rules, of 7015 on disk, plus 76 sliding-window rules (73 count across events; 3 match an ordered sequence), applies **your tenant's own tuning** on top — the disables, floors and suppressions the console writes, so a rule you turned off actually stops firing — and decides what becomes an alert.+Then fusion runs 2530 executable detection rules, of 7015 on disk, plus 76 sliding-window rules (73 count across events; 3 match an ordered sequence), applies **your tenant's own tuning** on top — the disables, floors and suppressions the console writes, so a rule you turned off actually stops firing — and decides what becomes an alert.Correlation groups related alerts, an agent investigates and writes its reasoning to the Investigation Ledger, and a playbook may start from the result. Separately, new threat intelligence sweeps the lake for sightings you already collected, and a hypothesis becomes a hunt without anyone writing a query — the model fills a closed schema and every value is bound as a parameter, so it cannot express a query at all.**A playbook triggered by an alert previews before it acts.** Three switches must agree — the@@ -189,7 +189,7 @@ Agents triage alerts and investigate incidents. What they can and cannot do:| Capability | Status | Tested | Production ready ||---|---|---|---|| Ingest → detect → correlate → alert | Stable | E2E + unit | Yes |-| Detection engine (2535 executable rules) of 7015 | Stable | Replay proof | Yes |+| Detection engine (2530 executable rules) of 7015 | Stable | Replay proof | Yes || Alert correlation into incidents | Stable | Unit | Yes || REST API + web console | Stable | Unit + integration | Yes || AI triage + Investigation Ledger | Stable | Live Postgres ledger + a PR-gated local-model agent run. No hosted provider has been exercised | Yes, copilot mode |diff --git a/ROADMAP.md b/ROADMAP.mdindex 2ff329bcc..9b43582e2 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -38,8 +38,8 @@ A proof-first, security-first program to make every README claim gate-backed, cl**Program status:** all 13 hardening phases (0–12) are landed. Building on them, the **Fully-Operational AI-SOC roadmap** (Phases A1–E1) is now complete — it wired the three end-to-end paths the reality audit found unwired and pushed the platform to competitive parity + beyond:-- **Phase A (SIEM foundation):** A1 ClickHouse lake writer · A2 live detection-evaluation worker (2535 executable rules on the stream) · A3 default-on one-command deploy (connectors + graph on) · A4 UEBA behavioral-model fusion.-- **Phase A (SIEM foundation):** A1 ClickHouse lake writer · A2 live detection-evaluation worker (2535 executable rules on the stream) · A3 default-on one-command deploy (connectors + graph on) · A4 UEBA behavioral-model fusion.+- **Phase A (SIEM foundation):** A1 ClickHouse lake writer · A2 live detection-evaluation worker (2530 executable rules on the stream) · A3 default-on one-command deploy (connectors + graph on) · A4 UEBA behavioral-model fusion.+- **Phase A (SIEM foundation):** A1 ClickHouse lake writer · A2 live detection-evaluation worker (2530 executable rules on the stream) · A3 default-on one-command deploy (connectors + graph on) · A4 UEBA behavioral-model fusion.- **Phase B (SOAR foundation):** B1 auto-triage worker (copilot default) · B2 credential resolver + `decide()`-governed live dispatch + 10 vendor adapters · B3 real rollback + post-action verification + durable approval-SLA timers · B4 Business Context Rules in the hot path.- **Phase C (parity differentiators):** C1 Advanced Data Explorer · C2 Effective-Permissions live posture loader · C3 autopilot/copilot posture scorecard · C4 fuse-time attack-chain auto-grouping.- **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.diff --git a/apps/docs/docs/detections/coverage.md b/apps/docs/docs/detections/coverage.mdindex 89ad501c5..5dba128f2 100644--- a/apps/docs/docs/detections/coverage.md+++ b/apps/docs/docs/detections/coverage.md@@ -10,7 +10,7 @@ sidebar_position: 2# Detection Coverage-Generated: `2026-10-09T04:33:12Z`+Generated: `2026-10-28T19:42:22Z`This page is a **curated selection**, not the size of the corpus.It picks the highest-scoring rules per threat family from the set@@ -27,9 +27,9 @@ Sigma compiler began translating rules where they sat: rules under## Headline numbers-- **Curated detections**: `489` (target: ≥ 300)-- **Executable rules considered**: `2511` (quality floor: 0.55)-- **Unique MITRE techniques covered**: `137`+- **Curated detections**: `485` (target: ≥ 300)+- **Executable rules considered**: `2506` (quality floor: 0.55)+- **Unique MITRE techniques covered**: `138`## Coverage by buyer family@@ -38,10 +38,10 @@ Sigma compiler began translating rules where they sat: rules under| **Ransomware** | 64 | ≥ 25 | ✅ || **Credential Access** | 100 | ≥ 25 | ✅ || **Lateral Movement** | 67 | ≥ 25 | ✅ |-| **Data Exfiltration** | 44 | ≥ 25 | ✅ |+| **Data Exfiltration** | 43 | ≥ 25 | ✅ || **Cloud** | 100 | ≥ 25 | ✅ || **Identity** | 100 | ≥ 25 | ✅ |-| **Supply Chain** | 40 | ≥ 25 | ✅ |+| **Supply Chain** | 35 | ≥ 25 | ✅ || **Kubernetes / Containers** | 69 | ≥ 25 | ✅ |## Distribution@@ -49,22 +49,22 @@ Sigma compiler began translating rules where they sat: rules under### By tier- `imported`: 163-- `native`: 326+- `native`: 322### By severity- `critical`: 99-- `high`: 264+- `high`: 260- `low`: 16- `medium`: 110### By category-- `application`: 29+- `application`: 27- `cloud`: 152-- `data-exfil`: 13+- `data-exfil`: 12- `endpoint`: 219-- `identity`: 67+- `identity`: 66- `network`: 9## How to auditdiff --git a/apps/docs/static/llms-full.txt b/apps/docs/static/llms-full.txtindex 7dfa83754..ac0af9194 100644--- a/apps/docs/static/llms-full.txt+++ b/apps/docs/static/llms-full.txt@@ -220,7 +220,7 @@ Read more: https://beenuar.github.io/AiSOC/docs/connectors## Detection content-- **Executable rules: 2535.** These are the rules the detection engine+- **Executable rules: 2530.** These are the rules the detection engineloads from its compiled ruleset. Only these can fire.- **Rule files on disk: 7015.** The remainder is imported andprovenance-only content — community and vendor corpora kept for coveragediff --git a/apps/docs/static/llms.txt b/apps/docs/static/llms.txtindex c897160d3..640119aaa 100644--- a/apps/docs/static/llms.txt+++ b/apps/docs/static/llms.txt@@ -23,10 +23,10 @@ Key facts a summary should get right:so a first run shows real data and AI triage without signing up for anything.`make up-full` is 22 long-running services and adds the event lake,entity graph, full-text search and enrichment.-- **Detection corpus:** 2535 rules are executable — the detection engine+- **Detection corpus:** 2530 rules are executable — the detection engineloads them from a compiled ruleset. 7015 rule files exist on disk in total;the difference is imported and provenance-only content that never fires. Cite- 2535, not 7015. "Executable" means each rule was replayed through+ 2530, not 7015. "Executable" means each rule was replayed througha real connector and the real engine and watched to fire; it does not mean therule detects an attack. A further 76 rules run in a separate windowedengine that counts across events or matches a sequence; report that figurediff --git a/apps/web/public/marketplace/curated.json b/apps/web/public/marketplace/curated.jsonindex fc74a534a..1baae19ff 100644--- a/apps/web/public/marketplace/curated.json+++ b/apps/web/public/marketplace/curated.json@@ -1,31 +1,31 @@{"$schema": "https://aisoc.example.com/schemas/curated/v1.json","version": "1.0.0",- "generated": "2026-10-09T04:33:12Z",+ "generated": "2026-10-28T19:42:22Z","stats": {- "considered": 2511,- "eligible": 2500,- "selected": 489,+ "considered": 2506,+ "eligible": 2495,+ "selected": 485,"min_per_family": 25,"min_total": 300,"quality_floor": 0.55,- "unique_techniques": 137,+ "unique_techniques": 138,"selected_by_tier": {"imported": 163,- "native": 326+ "native": 322},"selected_by_severity": {"critical": 99,- "high": 264,+ "high": 260,"low": 16,"medium": 110},"selected_by_category": {- "application": 29,+ "application": 27,"cloud": 152,- "data-exfil": 13,+ "data-exfil": 12,"endpoint": 219,- "identity": 67,+ "identity": 66,"network": 9}},@@ -287,7 +287,7 @@},"exfil": {"label": "Data Exfiltration",- "count": 44,+ "count": 43,"rule_ids": ["det-application-081","det-cloud-058",@@ -300,7 +300,6 @@"det-data-exfil-005","det-data-exfil-007","det-data-exfil-009",- "det-data-exfil-010","det-data-exfil-011","det-data-exfil-012","det-data-exfil-014",@@ -528,7 +527,7 @@"det-identity-021","det-identity-022","det-identity-023",- "det-identity-024",+ "det-identity-025","det-identity-027","det-identity-031","det-identity-034",@@ -555,14 +554,12 @@},"supply-chain": {"label": "Supply Chain",- "count": 40,+ "count": 35,"rule_ids": ["det-application-006","det-application-014",- "det-application-016","det-application-017","det-application-023",- "det-application-046","det-application-047","det-application-048","det-application-049",@@ -576,15 +573,12 @@"det-cloud-049","det-cloud-071","det-cloud-143",- "det-data-exfil-010","det-endpoint-024","det-endpoint-190","det-endpoint-280",- "det-identity-024","det-identity-040","det-identity-114","det-identity-153",- "det-identity-154","sigmahq-sigma-0ee4d8a5-4e67-4faf-acfa-62a78457d1f2","sigmahq-sigma-1f0489be-b496-4ddf-b3a9-5900f2044e9c","sigmahq-sigma-401e5d00-b944-11ea-8f9a-00163ecd60ae",@@ -724,7 +718,7 @@"T1090": 2,"T1090.002": 1,"T1098": 17,- "T1098.001": 12,+ "T1098.001": 10,"T1098.003": 5,"T1098.004": 4,"T1098.007": 1,@@ -745,8 +739,8 @@"T1190": 11,"T1195": 1,"T1195.001": 1,- "T1195.002": 6,- "T1199": 11,+ "T1195.002": 5,+ "T1199": 10,"T1201": 1,"T1203": 1,"T1204.002": 1,@@ -778,8 +772,9 @@"T1550": 5,"T1550.001": 1,"T1550.003": 2,+ "T1550.004": 1,"T1552": 3,- "T1552.001": 7,+ "T1552.001": 6,"T1552.004": 1,"T1552.007": 1,"T1553.002": 1,@@ -920,31 +915,6 @@"log_source_product": "build","has_executable_body": true},- {- "id": "det-application-016",- "name": "Push to Protected Branch by Non-Admin",- "path": "detections/application/github-protected-branch-bypass.yaml",- "tier": "native",- "source": "core",- "category": "application",- "severity": "high",- "mitre_techniques": [- "T1195.002"- ],- "mitre_tactics": [],- "families": [- "supply-chain"- ],- "quality_score": 0.977,- "quality_notes": [- "tier:native(+0.5)",- "mitre_techniques:1(+0.2)",- "severity:high(+0.128)",- "executable(+0.15)"- ],- "log_source_product": "github",- "has_executable_body": true- },{"id": "det-application-017","name": "Internal Repository Made Public",@@ -1022,31 +992,6 @@"log_source_product": "gitlab","has_executable_body": true},- {- "id": "det-application-046",- "name": "CI Workflow Modified By Account Without CODEOWNER Approval",- "path": "detections/application/app-ci-workflow-modified-by-non-owner.yaml",- "tier": "native",- "source": "core",- "category": "application",- "severity": "high",- "mitre_techniques": [- "T1199"- ],- "mitre_tactics": [],- "families": [- "supply-chain"- ],- "quality_score": 0.977,- "quality_notes": [- "tier:native(+0.5)",- "mitre_techniques:1(+0.2)",- "severity:high(+0.128)",- "executable(+0.15)"- ],- "log_source_product": "github",- "has_executable_body": true- },{"id": "det-application-047","name": "Self-Hosted Runner Registered From External IP",@@ -5180,32 +5125,6 @@"log_source_product": "proxy","has_executable_body": true},- {- "id": "det-data-exfil-010",- "name": "Git Push Containing PII or Secret Pattern",- "path": "detections/data-exfil/github-pii-pattern-push.yaml",- "tier": "native",- "source": "core",- "category": "data-exfil",- "severity": "high",- "mitre_techniques": [- "T1552.001"- ],- "mitre_tactics": [],- "families": [- "exfil",- "supply-chain"- ],- "quality_score": 0.977,- "quality_notes": [- "tier:native(+0.5)",- "mitre_techniques:1(+0.2)",- "severity:high(+0.128)",- "executable(+0.15)"- ],- "log_source_product": "github",- "has_executable_body": true- },{"id": "det-data-exfil-011","name": "Outbound Paste to Public Pastebin / Gist",@@ -7613,21 +7532,20 @@"has_executable_body": true},{- "id": "det-identity-024",- "name": "GitHub App Installed with Repo Admin Permission",- "path": "detections/identity/app-token-broad-default.yaml",+ "id": "det-identity-025",+ "name": "Persistent Session Token Reused from New Device Fingerprint",+ "path": "detections/identity/token-reuse-new-device.yaml","tier": "native","source": "core","category": "identity","severity": "high","mitre_techniques": [- "T1098.001"+ "T1550.004"],"mitre_tactics": [],"families": ["cloud",- "identity",- "supply-chain"+ "identity"],"quality_score": 0.977,"quality_notes": [@@ -7636,7 +7554,7 @@"severity:high(+0.128)","executable(+0.15)"],- "log_source_product": "github",+ "log_source_product": "okta","has_executable_body": true},{@@ -8855,33 +8773,6 @@"log_source_product": "github","has_executable_body": true},- {- "id": "det-identity-154",- "name": "GitHub Classic PAT Created With repo+workflow+admin:org",- "path": "detections/identity/ident-github-pat-classic-created-with-broad-scopes.yaml",- "tier": "native",- "source": "core",- "category": "identity",- "severity": "high",- "mitre_techniques": [- "T1098.001"- ],- "mitre_tactics": [],- "families": [- "cloud",- "identity",- "supply-chain"- ],- "quality_score": 0.977,- "quality_notes": [- "tier:native(+0.5)",- "mitre_techniques:1(+0.2)",- "severity:high(+0.128)",- "executable(+0.15)"- ],- "log_source_product": "github",- "has_executable_body": true- },{"id": "det-identity-157","name": "Zoom Account Policy Disables Meeting Passcode",diff --git a/apps/web/public/marketplace/index.json b/apps/web/public/marketplace/index.jsonindex 0af060131..1ac50e9a9 100644--- a/apps/web/public/marketplace/index.json+++ b/apps/web/public/marketplace/index.json@@ -1,7 +1,7 @@{"$schema": "https://example.com/schemas/marketplace/v1.json","version": "1.0.0",- "generated": "2026-10-12T04:44:25Z",+ "generated": "2026-10-28T19:50:45Z","categories": [{"id": "playbooks",@@ -38,10 +38,10 @@"imported": 6113,"stable": 901},- "executable": 2703,- "quarantined": 4480,- "executable_detections": 2535,- "reference_only_detections": 4480,+ "executable": 2698,+ "quarantined": 4485,+ "executable_detections": 2530,+ "reference_only_detections": 4485,"not_a_detection": 168},"mitre_coverage": {@@ -159,7 +159,7 @@"T1091": 1,"T1095": 4,"T1098": 48,- "T1098.001": 21,+ "T1098.001": 19,"T1098.003": 8,"T1098.004": 6,"T1098.005": 1,@@ -211,9 +211,9 @@"T1190": 39,"T1195": 3,"T1195.001": 2,- "T1195.002": 7,+ "T1195.002": 6,"T1197": 13,- "T1199": 12,+ "T1199": 11,"T1200": 3,"T1201": 3,"T1202": 26,@@ -319,7 +319,7 @@"T1550.003": 3,"T1550.004": 1,"T1552": 3,- "T1552.001": 17,+ "T1552.001": 16,"T1552.002": 3,"T1552.004": 7,"T1552.005": 1,@@ -439,7 +439,7 @@"T1686.003": 10,"T1689": 1},- "total_with_mitre": 2405,+ "total_with_mitre": 2400,"unique_techniques_all_rules": 494,"techniques_all_rules": {"T1001.003": 2,@@ -31020,10 +31020,11 @@"verified": true,"source": "core","tier": "stable",- "enabled": true,- "executable": true,+ "enabled": false,+ "executable": false,"path": "detections/application/github-protected-branch-bypass.yaml",- "sha256": "408d302476035003e40f95c04c61d77e4ed4136848a38f6e6e5bf4407a28ec06"+ "quarantine_reason": "not executable (needs-connector-field): wants `ref_in_protected_branches` and `actor_role` on a git.push, and the audit entry carries neither a ref nor the actor's org role. The observable form of a protection bypass in this telemetry is `protected_branch.policy_override`, which app-protected-branch-disabled already matches.",+ "sha256": "e01150cf5d5fc13af7fe4092f7956d7589061b7b89721797946e1af10753cabd"},{"id": "det-application-017",@@ -31048,7 +31049,7 @@"enabled": true,"executable": true,"path": "detections/application/github-public-repo-flip.yaml",- "sha256": "a84b1745a96ff19c92c44021c914e4f6fcdf51dd0e26ed43235fb65a5a227566"+ "sha256": "301ff06edbbf04aeb7ece2e2dccdd2596b2d8d3a89bf294eff3e9891787acf33"},{"id": "det-application-018",@@ -31774,10 +31775,11 @@"verified": true,"source": "core","tier": "stable",- "enabled": true,- "executable": true,+ "enabled": false,+ "executable": false,"path": "detections/application/app-ci-workflow-modified-by-non-owner.yaml",- "sha256": "cbdd8b151fb99ccdede43f2f4e91b16bfd8f7d5a9a458a787dfe1d0b2d427489"+ "quarantine_reason": "not executable (needs-connector-field): matches pushes that modify .github/workflows/ without CODEOWNER approval, but the audit log's git.push entries carry no file paths and no review role \u2014 `path` and `approver_role` exist in no GitHub telemetry this connector pulls. The push webhook's per-commit file list could carry the paths; surfacing it is connector work.",+ "sha256": "24368520c3844f542e60e7af76035978ea893a4c415b04d1a3871bdbb62694a0"},{"id": "det-application-047",@@ -31802,7 +31804,7 @@"enabled": true,"executable": true,"path": "detections/application/app-self-hosted-runner-external.yaml",- "sha256": "826b9b5d236411e0dc567ac2341bc6c58aa6ce74b4fd5ebbddb574ca919d6f14"+ "sha256": "34f18e7c0f5c90ba516ae13137ddf9e1ef6fc0ed00e539d9ed96863a11093432"},{"id": "det-application-048",@@ -31927,7 +31929,7 @@"enabled": true,"executable": true,"path": "detections/application/app-deploy-key-added-github.yaml",- "sha256": "9ee43d16d2cc1f4b7b35f13e49e1f726097dc7fcdd0167441416fa70f9d2bc50"+ "sha256": "1b8442952eee7ef1b38bea033db18ac15c2fd960cf7a39075b07e7844bb2338a"},{"id": "det-application-053",@@ -32054,7 +32056,7 @@"enabled": true,"executable": true,"path": "detections/application/app-protected-branch-disabled.yaml",- "sha256": "f74a64858a2962bcbac0134f1a5c3b1aa38913f7639dc0fcc63595e70083e303"+ "sha256": "b63813e952ba0970198ae425d078deda160beccffedfa765f1a6d9707f602f8a"},{"id": "det-application-058",@@ -38774,10 +38776,11 @@"verified": true,"source": "core","tier": "stable",- "enabled": true,- "executable": true,+ "enabled": false,+ "executable": false,"path": "detections/data-exfil/github-pii-pattern-push.yaml",- "sha256": "99d74ffff6ec73dcbcff94ea9363abc2877d92ce0f27e211e265a94d79b5a266"+ "quarantine_reason": "not executable (needs-external-source): greps `diff_text` for secret patterns, and no GitHub telemetry carries diff contents \u2014 the audit log's git.push has no payload and webhooks name files, not hunks. Content inspection is GitHub secret scanning's job; surfacing its alerts is connector work, not a rewrite of this rule.",+ "sha256": "9ec45286627557b194b6a1ad1f82877cf959b727fd185997258993c21aa53909"},{"id": "det-data-exfil-011",@@ -47276,10 +47279,11 @@"verified": true,"source": "core","tier": "stable",- "enabled": true,- "executable": true,+ "enabled": false,+ "executable": false,"path": "detections/identity/app-token-broad-default.yaml",- "sha256": "e3839bca699a59da546ccafd93cbaaf1cdc7b360331ba986e87f449179c13209"+ "quarantine_reason": "not executable (needs-connector-field): integration_installation.create entries carry the app's name but not its permission set, so `permission_administration` is never present. The installed app's permissions are exposed by GET /orgs/{org}/installations; surfacing that is connector work.",+ "sha256": "8bf57a9cc950b80d33dce074e9acb9daaa7c9a1b46a0781211c5cdaa9980bb20"},{"id": "det-identity-025",@@ -50550,10 +50554,11 @@"verified": true,"source": "core","tier": "stable",- "enabled": true,- "executable": true,+ "enabled": false,+ "executable": false,"path": "detections/identity/ident-github-pat-classic-created-with-broad-scopes.yaml",- "sha256": "f2799fdd6d0cba81929a38a331dbf194124f9c5bf772414a286d759e4d3fb6cd"+ "quarantine_reason": "not executable (needs-external-source): classic-PAT creation never reaches the org audit log \u2014 the documented personal_access_token.* lifecycle covers fine-grained tokens \u2014 and no audit entry carries a created token's scopes: the common `token_scopes` field describes the token that authenticated the API call, not the token being created.",+ "sha256": "3857957fad4cd0871d68735956badce1c5d0d27abdf05c16dcee134dd2f3def1"},{"id": "det-identity-155",@@ -50605,7 +50610,7 @@"executable": false,"path": "detections/identity/ident-github-deploy-key-added-org-wide.yaml","quarantine_reason": "superseded by the windowed rule wd-ident-github-deploy-key-added-org-wide; this stateless form named a counter no source emits",- "sha256": "77f95373794530900f68dcf340bbf424c147c44bfc9baea79fb08f8c066bc851"+ "sha256": "c35989d8944dcda686869c3e3d88af85ffa2e294ee188fb01a0fd4b176e9c338"},{"id": "det-identity-157",diff --git a/apps/web/src/data/corpus-stats.json b/apps/web/src/data/corpus-stats.jsonindex 2b184c67f..71274e176 100644--- a/apps/web/src/data/corpus-stats.json+++ b/apps/web/src/data/corpus-stats.json@@ -1,18 +1,18 @@{- "executable": 2535,+ "executable": 2530,"windowed": 76,"onDisk": 7015,- "quarantined": 4480,+ "quarantined": 4485,"plugins": 80,"playbookPacks": 63,"playbooks": 88,"marketplaceItems": 7183,"categories": {- "application": 76,+ "application": 74,"cloud": 235,- "data-exfil": 13,+ "data-exfil": 12,"endpoint": 1978,- "identity": 146,+ "identity": 144,"network": 63,"threat-anomaly": 24},diff --git a/detections/application/app-ci-workflow-modified-by-non-owner.yaml b/detections/application/app-ci-workflow-modified-by-non-owner.yamlindex 45f6fa2bd..6718b023a 100644--- a/detections/application/app-ci-workflow-modified-by-non-owner.yaml+++ b/detections/application/app-ci-workflow-modified-by-non-owner.yaml@@ -19,7 +19,11 @@ detection:false_positives:- Bootstrap of new repositoryplaybook: tpl-supply-chain-enabled: true+enabled: false+quarantine_reason: 'not executable (needs-connector-field): matches pushes that modify .github/workflows/+ without CODEOWNER approval, but the audit log''s git.push entries carry no file paths and no review+ role — `path` and `approver_role` exist in no GitHub telemetry this connector pulls. The push webhook''s+ per-commit file list could carry the paths; surfacing it is connector work.'author: AiSOCcreated: '2026-05-03'modified: '2026-05-03'diff --git a/detections/application/app-deploy-key-added-github.yaml b/detections/application/app-deploy-key-added-github.yamlindex 1689c099d..b590230ce 100644--- a/detections/application/app-deploy-key-added-github.yaml+++ b/detections/application/app-deploy-key-added-github.yaml@@ -13,7 +13,8 @@ log_source:service: repodetection:condition: |- event_type == "deploy_key.create"+ action == "public_key.create"+ AND repo CONTAINS "/"false_positives:- Sanctioned automation onboardingplaybook: tpl-persistencediff --git a/detections/application/app-protected-branch-disabled.yaml b/detections/application/app-protected-branch-disabled.yamlindex 9fbdae6c7..cd4c6bc49 100644--- a/detections/application/app-protected-branch-disabled.yaml+++ b/detections/application/app-protected-branch-disabled.yaml@@ -13,7 +13,7 @@ log_source:service: repodetection:condition: |- event_type IN ["protected_branch.policy_override", "protected_branch.destroy"]+ action IN ["protected_branch.policy_override", "protected_branch.destroy"]false_positives:- Confirmed test/tuning activityplaybook: tpl-supply-chaindiff --git a/detections/application/app-self-hosted-runner-external.yaml b/detections/application/app-self-hosted-runner-external.yamlindex e50699dbd..9cb6cae53 100644--- a/detections/application/app-self-hosted-runner-external.yaml+++ b/detections/application/app-self-hosted-runner-external.yaml@@ -13,7 +13,7 @@ log_source:service: actionsdetection:condition: |- event_type == "runner_register"+ action IN ["org.register_self_hosted_runner", "repo.register_self_hosted_runner"]AND ip_is_internal == falsefalse_positives:- Approved partner-hosted runnerdiff --git a/detections/application/github-protected-branch-bypass.yaml b/detections/application/github-protected-branch-bypass.yamlindex 16384bea3..d7fb5f69e 100644--- a/detections/application/github-protected-branch-bypass.yaml+++ b/detections/application/github-protected-branch-bypass.yaml@@ -19,7 +19,11 @@ detection:false_positives:- Emergency hotfix workflow (must reference change ticket)playbook: tpl-supply-chain-enabled: true+enabled: false+quarantine_reason: 'not executable (needs-connector-field): wants `ref_in_protected_branches` and `actor_role`+ on a git.push, and the audit entry carries neither a ref nor the actor''s org role. The observable form+ of a protection bypass in this telemetry is `protected_branch.policy_override`, which app-protected-branch-disabled+ already matches.'author: AiSOCcreated: '2026-05-03'modified: '2026-05-03'diff --git a/detections/application/github-public-repo-flip.yaml b/detections/application/github-public-repo-flip.yamlindex 237de9e38..bc7f74284 100644--- a/detections/application/github-public-repo-flip.yaml+++ b/detections/application/github-public-repo-flip.yaml@@ -13,8 +13,8 @@ log_source:service: auditdetection:condition: |- action == "repo.visibility_change"- AND visibility == "public"+ action == "repo.access"+ AND public_repo == truefalse_positives:- OSS publication (must reference release ticket)playbook: tpl-data-exposurediff --git a/detections/data-exfil/github-pii-pattern-push.yaml b/detections/data-exfil/github-pii-pattern-push.yamlindex e7e06da94..e40cf54f1 100644--- a/detections/data-exfil/github-pii-pattern-push.yaml+++ b/detections/data-exfil/github-pii-pattern-push.yaml@@ -18,7 +18,11 @@ detection:false_positives:- Test fixtures (must be tagged)playbook: tpl-secret-leak-enabled: true+enabled: false+quarantine_reason: 'not executable (needs-external-source): greps `diff_text` for secret patterns, and+ no GitHub telemetry carries diff contents — the audit log''s git.push has no payload and webhooks name+ files, not hunks. Content inspection is GitHub secret scanning''s job; surfacing its alerts is connector+ work, not a rewrite of this rule.'author: AiSOCcreated: '2026-05-03'modified: '2026-05-03'diff --git a/detections/fixtures/negative/app-deploy-key-added-github.json b/detections/fixtures/negative/app-deploy-key-added-github.jsonindex 817f47cf6..ad39cd23c 100644--- a/detections/fixtures/negative/app-deploy-key-added-github.json+++ b/detections/fixtures/negative/app-deploy-key-added-github.json@@ -1,3 +1,4 @@{- "event_type": "http_request"+ "action": "public_key.create",+ "actor": "[email protected]"}diff --git a/detections/fixtures/negative/app-protected-branch-disabled.json b/detections/fixtures/negative/app-protected-branch-disabled.jsonindex d6a6f7d17..d6f8379c1 100644--- a/detections/fixtures/negative/app-protected-branch-disabled.json+++ b/detections/fixtures/negative/app-protected-branch-disabled.json@@ -1,3 +1,3 @@{- "event_type": "__benign__"+ "action": "__benign__"}diff --git a/detections/fixtures/negative/app-self-hosted-runner-external.json b/detections/fixtures/negative/app-self-hosted-runner-external.jsonindex ac6811bfa..8cb95670a 100644--- a/detections/fixtures/negative/app-self-hosted-runner-external.json+++ b/detections/fixtures/negative/app-self-hosted-runner-external.json@@ -1,4 +1,5 @@{- "event_type": "http_request",- "ip_is_internal": false+ "action": "org.register_self_hosted_runner",+ "actor": "proof-actor",+ "src_ip": "10.20.30.40"}diff --git a/detections/fixtures/negative/cloud-cloudflare-access-policy-bypass.json b/detections/fixtures/negative/cloud-cloudflare-access-policy-bypass.jsonindex c40fc76f6..fedf1b2a5 100644--- a/detections/fixtures/negative/cloud-cloudflare-access-policy-bypass.json+++ b/detections/fixtures/negative/cloud-cloudflare-access-policy-bypass.json@@ -1,4 +1,4 @@{- "action": "disabled",+ "action": "protected_branch.policy_override","decision": "bypass"}diff --git a/detections/fixtures/negative/cloud-cloudflare-zone-transfer.json b/detections/fixtures/negative/cloud-cloudflare-zone-transfer.jsonindex 20f103b76..c42ec0d73 100644--- a/detections/fixtures/negative/cloud-cloudflare-zone-transfer.json+++ b/detections/fixtures/negative/cloud-cloudflare-zone-transfer.json@@ -1,3 +1,3 @@{- "action": "disabled"+ "action": "protected_branch.policy_override"}diff --git a/detections/fixtures/negative/cloud-do-droplet-snapshot-shared.json b/detections/fixtures/negative/cloud-do-droplet-snapshot-shared.jsonindex 439867d91..c36105ca6 100644--- a/detections/fixtures/negative/cloud-do-droplet-snapshot-shared.json+++ b/detections/fixtures/negative/cloud-do-droplet-snapshot-shared.json@@ -1,4 +1,4 @@{- "action": "disabled",+ "action": "protected_branch.policy_override","destination_account_external": true}diff --git a/detections/fixtures/negative/cloud-iac-drift-bypassed.json b/detections/fixtures/negative/cloud-iac-drift-bypassed.jsonindex 67aecb353..9b5dcb5ef 100644--- a/detections/fixtures/negative/cloud-iac-drift-bypassed.json+++ b/detections/fixtures/negative/cloud-iac-drift-bypassed.json@@ -1,5 +1,5 @@{- "action": "disabled",+ "action": "protected_branch.policy_override","approver": "self","out_of_hours": true}diff --git a/detections/fixtures/negative/cloud-terraform-state-modified-direct.json b/detections/fixtures/negative/cloud-terraform-state-modified-direct.jsonindex 5bd2acfe1..56577265c 100644--- a/detections/fixtures/negative/cloud-terraform-state-modified-direct.json+++ b/detections/fixtures/negative/cloud-terraform-state-modified-direct.json@@ -1,4 +1,4 @@{- "action": "disabled",+ "action": "protected_branch.policy_override","actor_in_pipeline": false}diff --git a/detections/fixtures/negative/github-public-repo-flip.json b/detections/fixtures/negative/github-public-repo-flip.jsonindex 9d57d0321..238ea5f47 100644--- a/detections/fixtures/negative/github-public-repo-flip.json+++ b/detections/fixtures/negative/github-public-repo-flip.json@@ -1,6 +1,7 @@{- "action": "repo.visibility_change",+ "action": "repo.access","actor": "[email protected]",- "repo": "internal-tooling",- "visibility": "private"+ "previous_visibility": "public",+ "public_repo": false,+ "repo": "example-org/internal-tooling"}diff --git a/detections/fixtures/negative/ident-atlassian-api-token-created.json b/detections/fixtures/negative/ident-atlassian-api-token-created.jsonindex 20f103b76..c42ec0d73 100644--- a/detections/fixtures/negative/ident-atlassian-api-token-created.json+++ b/detections/fixtures/negative/ident-atlassian-api-token-created.json@@ -1,3 +1,3 @@{- "action": "disabled"+ "action": "protected_branch.policy_override"}diff --git a/detections/fixtures/negative/ident-github-deploy-key-added-org-wide.json b/detections/fixtures/negative/ident-github-deploy-key-added-org-wide.jsonindex 367546d8e..913ea6d02 100644--- a/detections/fixtures/negative/ident-github-deploy-key-added-org-wide.json+++ b/detections/fixtures/negative/ident-github-deploy-key-added-org-wide.json@@ -1,4 +1,4 @@{- "action": "disabled",+ "action": "protected_branch.policy_override","distinct_repos_per_actor_per_hour": 110.0}diff --git a/detections/fixtures/negative/ident-github-org-2fa-disabled.json b/detections/fixtures/negative/ident-github-org-2fa-disabled.jsonindex 20f103b76..c42ec0d73 100644--- a/detections/fixtures/negative/ident-github-org-2fa-disabled.json+++ b/detections/fixtures/negative/ident-github-org-2fa-disabled.json@@ -1,3 +1,3 @@{- "action": "disabled"+ "action": "protected_branch.policy_override"}diff --git a/detections/fixtures/negative/ident-github-org-collaborator-removed-bulk.json b/detections/fixtures/negative/ident-github-org-collaborator-removed-bulk.jsonindex 04027664f..7f5df074a 100644--- a/detections/fixtures/negative/ident-github-org-collaborator-removed-bulk.json+++ b/detections/fixtures/negative/ident-github-org-collaborator-removed-bulk.json@@ -1,4 +1,4 @@{- "action": "disabled",+ "action": "protected_branch.policy_override","events_per_minute": 120.0}diff --git a/detections/fixtures/negative/ident-github-pat-classic-created-with-broad-scopes.json b/detections/fixtures/negative/ident-github-pat-classic-created-with-broad-scopes.jsonindex ac1608f47..df16a67ce 100644--- a/detections/fixtures/negative/ident-github-pat-classic-created-with-broad-scopes.json+++ b/detections/fixtures/negative/ident-github-pat-classic-created-with-broad-scopes.json@@ -1,4 +1,4 @@{- "action": "disabled",+ "action": "protected_branch.policy_override","scopes": "repo workflow admin:org"}diff --git a/detections/fixtures/negative/ident-jamf-mdm-policy-mfa-removed.json b/detections/fixtures/negative/ident-jamf-mdm-policy-mfa-removed.jsonindex 20f103b76..c42ec0d73 100644--- a/detections/fixtures/negative/ident-jamf-mdm-policy-mfa-removed.json+++ b/detections/fixtures/negative/ident-jamf-mdm-policy-mfa-removed.json@@ -1,3 +1,3 @@{- "action": "disabled"+ "action": "protected_branch.policy_override"}diff --git a/detections/fixtures/negative/ident-slack-app-installed-bot-token.json b/detections/fixtures/negative/ident-slack-app-installed-bot-token.jsonindex c9ab7d42d..41fcd2c15 100644--- a/detections/fixtures/negative/ident-slack-app-installed-bot-token.json+++ b/detections/fixtures/negative/ident-slack-app-installed-bot-token.json@@ -1,4 +1,4 @@{- "action": "disabled",+ "action": "protected_branch.policy_override","scopes": "prefix-chat:write.public-suffix"}diff --git a/detections/fixtures/positive/app-deploy-key-added-github.json b/detections/fixtures/positive/app-deploy-key-added-github.jsonindex dfb54411c..aaa31c15a 100644--- a/detections/fixtures/positive/app-deploy-key-added-github.json+++ b/detections/fixtures/positive/app-deploy-key-added-github.json@@ -1,3 +1,5 @@{- "event_type": "deploy_key.create"+ "action": "public_key.create",+ "actor": "[email protected]",+ "repo": "example-org/payments-core"}diff --git a/detections/fixtures/positive/app-protected-branch-disabled.json b/detections/fixtures/positive/app-protected-branch-disabled.jsonindex bbbc50bef..c42ec0d73 100644--- a/detections/fixtures/positive/app-protected-branch-disabled.json+++ b/detections/fixtures/positive/app-protected-branch-disabled.json@@ -1,3 +1,3 @@{- "event_type": "protected_branch.policy_override"+ "action": "protected_branch.policy_override"}diff --git a/detections/fixtures/positive/app-self-hosted-runner-external.json b/detections/fixtures/positive/app-self-hosted-runner-external.jsonindex 150c0631e..f8d2eb330 100644--- a/detections/fixtures/positive/app-self-hosted-runner-external.json+++ b/detections/fixtures/positive/app-self-hosted-runner-external.json@@ -1,4 +1,5 @@{- "event_type": "runner_register",- "ip_is_internal": false+ "action": "org.register_self_hosted_runner",+ "actor": "proof-actor",+ "src_ip": "203.0.113.9"}diff --git a/detections/fixtures/positive/github-public-repo-flip.json b/detections/fixtures/positive/github-public-repo-flip.jsonindex 801d2929d..0b87e414f 100644--- a/detections/fixtures/positive/github-public-repo-flip.json+++ b/detections/fixtures/positive/github-public-repo-flip.json@@ -1,6 +1,7 @@{- "action": "repo.visibility_change",+ "action": "repo.access","actor": "[email protected]",- "repo": "internal-tooling",- "visibility": "public"+ "previous_visibility": "private",+ "public_repo": true,+ "repo": "example-org/internal-tooling"}diff --git a/detections/fixtures/positive/ident-github-deploy-key-added-org-wide.json b/detections/fixtures/positive/ident-github-deploy-key-added-org-wide.jsonindex d97e51332..93a9eff78 100644--- a/detections/fixtures/positive/ident-github-deploy-key-added-org-wide.json+++ b/detections/fixtures/positive/ident-github-deploy-key-added-org-wide.json@@ -1,4 +1,4 @@{- "action": "deploy_key.add",+ "action": "public_key.create","distinct_repos_per_actor_per_hour": 110.0}diff --git a/detections/identity/app-token-broad-default.yaml b/detections/identity/app-token-broad-default.yamlindex 92319db6c..6ad2d7bc4 100644--- a/detections/identity/app-token-broad-default.yaml+++ b/detections/identity/app-token-broad-default.yaml@@ -18,7 +18,10 @@ detection:false_positives:- GitHub Apps from approved-publisher listplaybook: tpl-supply-chain-enabled: true+enabled: false+quarantine_reason: 'not executable (needs-connector-field): integration_installation.create entries carry+ the app''s name but not its permission set, so `permission_administration` is never present. The installed+ app''s permissions are exposed by GET /orgs/{org}/installations; surfacing that is connector work.'author: AiSOCcreated: '2026-05-03'modified: '2026-05-03'diff --git a/detections/identity/ident-github-deploy-key-added-org-wide.yaml b/detections/identity/ident-github-deploy-key-added-org-wide.yamlindex fefd77528..58ec8e5a7 100644--- a/detections/identity/ident-github-deploy-key-added-org-wide.yaml+++ b/detections/identity/ident-github-deploy-key-added-org-wide.yaml@@ -13,7 +13,7 @@ log_source:service: auditdetection:condition: |- action == "deploy_key.add"+ action == "public_key.create"AND distinct_repos_per_actor_per_hour > 10false_positives:- Sanctioned automation/IaC pipelinediff --git a/detections/identity/ident-github-pat-classic-created-with-broad-scopes.yaml b/detections/identity/ident-github-pat-classic-created-with-broad-scopes.yamlindex 8a98ffa0d..ff7bc1e2c 100644--- a/detections/identity/ident-github-pat-classic-created-with-broad-scopes.yaml+++ b/detections/identity/ident-github-pat-classic-created-with-broad-scopes.yaml@@ -18,7 +18,11 @@ detection:false_positives:- CI bootstrap (must be ticketed)playbook: tpl-persistence-enabled: true+enabled: false+quarantine_reason: 'not executable (needs-external-source): classic-PAT creation never reaches the org+ audit log — the documented personal_access_token.* lifecycle covers fine-grained tokens — and no audit+ entry carries a created token''s scopes: the common `token_scopes` field describes the token that authenticated+ the API call, not the token being created.'author: AiSOCcreated: '2026-05-03'modified: '2026-05-03'diff --git a/docs/audit/CLAIM_TO_GATE_MATRIX.md b/docs/audit/CLAIM_TO_GATE_MATRIX.mdindex f12f190b4..786aa1e57 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,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 |+| 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,609; 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/detections/truth-table.md b/docs/detections/truth-table.mdindex e129a1e45..2605c036f 100644--- a/docs/detections/truth-table.md+++ b/docs/detections/truth-table.md@@ -20,8 +20,8 @@ lever that reaches the engine is adding a spec and re-running| metric | count ||--------|------:|| rules on disk (total) | 7015 |-| **executable (loaded by the engine)** | **2535** |-| non-executable (provenance/coverage only) | 4480 |+| **executable (loaded by the engine)** | **2530** |+| non-executable (provenance/coverage only) | 4485 || — of which: enabled, but no compiled spec | 0 || windowed rules in `windowed_ruleset.json` | 76 |@@ -55,7 +55,7 @@ were hand-authored in the upstream format to give it one.| car (imported) | 99 | 0 | 0 || chronicle (imported) | 877 | 0 | 0 || community | 1 | 0 | 0 |-| native | 877 | 741 | 0 |+| native | 877 | 736 | 0 || sigma (imported) | 3132 | 1770 | 0 || splunk (imported) | 2005 | 0 | 0 || threat-anomaly | 24 | 24 | 0 |@@ -64,14 +64,14 @@ were hand-authored in the upstream format to give it one.| reason | count ||--------|------:|-| `enabled: false` | 267 |+| `enabled: false` | 272 || under `_quarantine/` (untranslated on import) | 4213 |## How to read the README claimThe imported corpus is large (7015 rules on disk) and valuable as aprovenance-tracked ATT&CK-mapped library, but the number that matters-operationally is **2535 executable rules** — the ones the engine+operationally is **2530 executable rules** — the ones the engineloads and fires against live telemetry. The README and marketplace must citethe executable figure when describing detection *coverage*, and may cite theon-disk figure only when explicitly describing the imported *library*.diff --git a/docs/openapi.yaml b/docs/openapi.yamlindex 382b89a42..4c4a0cc17 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,614 rules.+ answered with an empty list while the engine ran 2,609 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,614 rules+ empty list on every install, while fusion loaded and fired 2,609 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,614 rows per+ read never creates one: a GET that materialised would put 2,609 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,614 loaded rules — the+ over a product shipping ATT&CK mappings for 2,609 loaded rules — thestrongest possible version of the "blind to everything" answer, anddiff --git a/marketplace/curated.json b/marketplace/curated.jsonindex fc74a534a..1baae19ff 100644--- a/marketplace/curated.json+++ b/marketplace/curated.json@@ -1,31 +1,31 @@{"$schema": "https://aisoc.example.com/schemas/curated/v1.json","version": "1.0.0",- "generated": "2026-10-09T04:33:12Z",+ "generated": "2026-10-28T19:42:22Z","stats": {- "considered": 2511,- "eligible": 2500,- "selected": 489,+ "considered": 2506,+ "eligible": 2495,+ "selected": 485,"min_per_family": 25,"min_total": 300,"quality_floor": 0.55,- "unique_techniques": 137,+ "unique_techniques": 138,"selected_by_tier": {"imported": 163,- "native": 326+ "native": 322},"selected_by_severity": {"critical": 99,- "high": 264,+ "high": 260,"low": 16,"medium": 110},"selected_by_category": {- "application": 29,+ "application": 27,"cloud": 152,- "data-exfil": 13,+ "data-exfil": 12,"endpoint": 219,- "identity": 67,+ "identity": 66,"network": 9}},@@ -287,7 +287,7 @@},"exfil": {"label": "Data Exfiltration",- "count": 44,+ "count": 43,"rule_ids": ["det-application-081","det-cloud-058",@@ -300,7 +300,6 @@"det-data-exfil-005","det-data-exfil-007","det-data-exfil-009",- "det-data-exfil-010","det-data-exfil-011","det-data-exfil-012","det-data-exfil-014",@@ -528,7 +527,7 @@"det-identity-021","det-identity-022","det-identity-023",- "det-identity-024",+ "det-identity-025","det-identity-027","det-identity-031","det-identity-034",@@ -555,14 +554,12 @@},"supply-chain": {"label": "Supply Chain",- "count": 40,+ "count": 35,"rule_ids": ["det-application-006","det-application-014",- "det-application-016","det-application-017","det-application-023",- "det-application-046","det-application-047","det-application-048","det-application-049",@@ -576,15 +573,12 @@"det-cloud-049","det-cloud-071","det-cloud-143",- "det-data-exfil-010","det-endpoint-024","det-endpoint-190","det-endpoint-280",- "det-identity-024","det-identity-040","det-identity-114","det-identity-153",- "det-identity-154","sigmahq-sigma-0ee4d8a5-4e67-4faf-acfa-62a78457d1f2","sigmahq-sigma-1f0489be-b496-4ddf-b3a9-5900f2044e9c","sigmahq-sigma-401e5d00-b944-11ea-8f9a-00163ecd60ae",@@ -724,7 +718,7 @@"T1090": 2,"T1090.002": 1,"T1098": 17,- "T1098.001": 12,+ "T1098.001": 10,"T1098.003": 5,"T1098.004": 4,"T1098.007": 1,@@ -745,8 +739,8 @@"T1190": 11,"T1195": 1,"T1195.001": 1,- "T1195.002": 6,- "T1199": 11,+ "T1195.002": 5,+ "T1199": 10,"T1201": 1,"T1203": 1,"T1204.002": 1,@@ -778,8 +772,9 @@"T1550": 5,"T1550.001": 1,"T1550.003": 2,+ "T1550.004": 1,"T1552": 3,- "T1552.001": 7,+ "T1552.001": 6,"T1552.004": 1,"T1552.007": 1,"T1553.002": 1,@@ -920,31 +915,6 @@"log_source_product": "build","has_executable_body": true},- {- "id": "det-application-016",- "name": "Push to Protected Branch by Non-Admin",- "path": "detections/application/github-protected-branch-bypass.yaml",- "tier": "native",- "source": "core",- "category": "application",- "severity": "high",- "mitre_techniques": [- "T1195.002"- ],- "mitre_tactics": [],- "families": [- "supply-chain"- ],- "quality_score": 0.977,- "quality_notes": [- "tier:native(+0.5)",- "mitre_techniques:1(+0.2)",- "severity:high(+0.128)",- "executable(+0.15)"- ],- "log_source_product": "github",- "has_executable_body": true- },{"id": "det-application-017","name": "Internal Repository Made Public",@@ -1022,31 +992,6 @@"log_source_product": "gitlab","has_executable_body": true},- {- "id": "det-application-046",- "name": "CI Workflow Modified By Account Without CODEOWNER Approval",- "path": "detections/application/app-ci-workflow-modified-by-non-owner.yaml",- "tier": "native",- "source": "core",- "category": "application",- "severity": "high",- "mitre_techniques": [- "T1199"- ],- "mitre_tactics": [],- "families": [- "supply-chain"- ],- "quality_score": 0.977,- "quality_notes": [- "tier:native(+0.5)",- "mitre_techniques:1(+0.2)",- "severity:high(+0.128)",- "executable(+0.15)"- ],- "log_source_product": "github",- "has_executable_body": true- },{"id": "det-application-047","name": "Self-Hosted Runner Registered From External IP",@@ -5180,32 +5125,6 @@"log_source_product": "proxy","has_executable_body": true},- {- "id": "det-data-exfil-010",- "name": "Git Push Containing PII or Secret Pattern",- "path": "detections/data-exfil/github-pii-pattern-push.yaml",- "tier": "native",- "source": "core",- "category": "data-exfil",- "severity": "high",- "mitre_techniques": [- "T1552.001"- ],- "mitre_tactics": [],- "families": [- "exfil",- "supply-chain"- ],- "quality_score": 0.977,- "quality_notes": [- "tier:native(+0.5)",- "mitre_techniques:1(+0.2)",- "severity:high(+0.128)",- "executable(+0.15)"- ],- "log_source_product": "github",- "has_executable_body": true- },{"id": "det-data-exfil-011","name": "Outbound Paste to Public Pastebin / Gist",@@ -7613,21 +7532,20 @@"has_executable_body": true},{- "id": "det-identity-024",- "name": "GitHub App Installed with Repo Admin Permission",- "path": "detections/identity/app-token-broad-default.yaml",+ "id": "det-identity-025",+ "name": "Persistent Session Token Reused from New Device Fingerprint",+ "path": "detections/identity/token-reuse-new-device.yaml","tier": "native","source": "core","category": "identity","severity": "high","mitre_techniques": [- "T1098.001"+ "T1550.004"],"mitre_tactics": [],"families": ["cloud",- "identity",- "supply-chain"+ "identity"],"quality_score": 0.977,"quality_notes": [@@ -7636,7 +7554,7 @@"severity:high(+0.128)","executable(+0.15)"],- "log_source_product": "github",+ "log_source_product": "okta","has_executable_body": true},{@@ -8855,33 +8773,6 @@"log_source_product": "github","has_executable_body": true},- {- "id": "det-identity-154",- "name": "GitHub Classic PAT Created With repo+workflow+admin:org",- "path": "detections/identity/ident-github-pat-classic-created-with-broad-scopes.yaml",- "tier": "native",- "source": "core",- "category": "identity",- "severity": "high",- "mitre_techniques": [- "T1098.001"- ],- "mitre_tactics": [],- "families": [- "cloud",- "identity",- "supply-chain"- ],- "quality_score": 0.977,- "quality_notes": [- "tier:native(+0.5)",- "mitre_techniques:1(+0.2)",- "severity:high(+0.128)",- "executable(+0.15)"- ],- "log_source_product": "github",- "has_executable_body": true- },{"id": "det-identity-157","name": "Zoom Account Policy Disables Meeting Passcode",diff --git a/marketplace/index.json b/marketplace/index.jsonindex 0af060131..1ac50e9a9 100644--- a/marketplace/index.json+++ b/marketplace/index.json@@ -1,7 +1,7 @@{"$schema": "https://example.com/schemas/marketplace/v1.json","version": "1.0.0",- "generated": "2026-10-12T04:44:25Z",+ "generated": "2026-10-28T19:50:45Z","categories": [{"id": "playbooks",@@ -38,10 +38,10 @@"imported": 6113,"stable": 901},- "executable": 2703,- "quarantined": 4480,- "executable_detections": 2535,- "reference_only_detections": 4480,+ "executable": 2698,+ "quarantined": 4485,+ "executable_detections": 2530,+ "reference_only_detections": 4485,"not_a_detection": 168},"mitre_coverage": {@@ -159,7 +159,7 @@"T1091": 1,"T1095": 4,"T1098": 48,- "T1098.001": 21,+ "T1098.001": 19,"T1098.003": 8,"T1098.004": 6,"T1098.005": 1,@@ -211,9 +211,9 @@"T1190": 39,"T1195": 3,"T1195.001": 2,- "T1195.002": 7,+ "T1195.002": 6,"T1197": 13,- "T1199": 12,+ "T1199": 11,"T1200": 3,"T1201": 3,"T1202": 26,@@ -319,7 +319,7 @@"T1550.003": 3,"T1550.004": 1,"T1552": 3,- "T1552.001": 17,+ "T1552.001": 16,"T1552.002": 3,"T1552.004": 7,"T1552.005": 1,@@ -439,7 +439,7 @@"T1686.003": 10,"T1689": 1},- "total_with_mitre": 2405,+ "total_with_mitre": 2400,"unique_techniques_all_rules": 494,"techniques_all_rules": {"T1001.003": 2,@@ -31020,10 +31020,11 @@"verified": true,"source": "core","tier": "stable",- "enabled": true,- "executable": true,+ "enabled": false,+ "executable": false,"path": "detections/application/github-protected-branch-bypass.yaml",- "sha256": "408d302476035003e40f95c04c61d77e4ed4136848a38f6e6e5bf4407a28ec06"+ "quarantine_reason": "not executable (needs-connector-field): wants `ref_in_protected_branches` and `actor_role` on a git.push, and the audit entry carries neither a ref nor the actor's org role. The observable form of a protection bypass in this telemetry is `protected_branch.policy_override`, which app-protected-branch-disabled already matches.",+ "sha256": "e01150cf5d5fc13af7fe4092f7956d7589061b7b89721797946e1af10753cabd"},{"id": "det-application-017",@@ -31048,7 +31049,7 @@"enabled": true,"executable": true,"path": "detections/application/github-public-repo-flip.yaml",- "sha256": "a84b1745a96ff19c92c44021c914e4f6fcdf51dd0e26ed43235fb65a5a227566"+ "sha256": "301ff06edbbf04aeb7ece2e2dccdd2596b2d8d3a89bf294eff3e9891787acf33"},{"id": "det-application-018",@@ -31774,10 +31775,11 @@"verified": true,"source": "core","tier": "stable",- "enabled": true,- "executable": true,+ "enabled": false,+ "executable": false,"path": "detections/application/app-ci-workflow-modified-by-non-owner.yaml",- "sha256": "cbdd8b151fb99ccdede43f2f4e91b16bfd8f7d5a9a458a787dfe1d0b2d427489"+ "quarantine_reason": "not executable (needs-connector-field): matches pushes that modify .github/workflows/ without CODEOWNER approval, but the audit log's git.push entries carry no file paths and no review role \u2014 `path` and `approver_role` exist in no GitHub telemetry this connector pulls. The push webhook's per-commit file list could carry the paths; surfacing it is connector work.",+ "sha256": "24368520c3844f542e60e7af76035978ea893a4c415b04d1a3871bdbb62694a0"},{"id": "det-application-047",@@ -31802,7 +31804,7 @@"enabled": true,"executable": true,"path": "detections/application/app-self-hosted-runner-external.yaml",- "sha256": "826b9b5d236411e0dc567ac2341bc6c58aa6ce74b4fd5ebbddb574ca919d6f14"+ "sha256": "34f18e7c0f5c90ba516ae13137ddf9e1ef6fc0ed00e539d9ed96863a11093432"},{"id": "det-application-048",@@ -31927,7 +31929,7 @@"enabled": true,"executable": true,"path": "detections/application/app-deploy-key-added-github.yaml",- "sha256": "9ee43d16d2cc1f4b7b35f13e49e1f726097dc7fcdd0167441416fa70f9d2bc50"+ "sha256": "1b8442952eee7ef1b38bea033db18ac15c2fd960cf7a39075b07e7844bb2338a"},{"id": "det-application-053",@@ -32054,7 +32056,7 @@"enabled": true,"executable": true,"path": "detections/application/app-protected-branch-disabled.yaml",- "sha256": "f74a64858a2962bcbac0134f1a5c3b1aa38913f7639dc0fcc63595e70083e303"+ "sha256": "b63813e952ba0970198ae425d078deda160beccffedfa765f1a6d9707f602f8a"},{"id": "det-application-058",@@ -38774,10 +38776,11 @@"verified": true,"source": "core","tier": "stable",- "enabled": true,- "executable": true,+ "enabled": false,+ "executable": false,"path": "detections/data-exfil/github-pii-pattern-push.yaml",- "sha256": "99d74ffff6ec73dcbcff94ea9363abc2877d92ce0f27e211e265a94d79b5a266"+ "quarantine_reason": "not executable (needs-external-source): greps `diff_text` for secret patterns, and no GitHub telemetry carries diff contents \u2014 the audit log's git.push has no payload and webhooks name files, not hunks. Content inspection is GitHub secret scanning's job; surfacing its alerts is connector work, not a rewrite of this rule.",+ "sha256": "9ec45286627557b194b6a1ad1f82877cf959b727fd185997258993c21aa53909"},{"id": "det-data-exfil-011",@@ -47276,10 +47279,11 @@"verified": true,"source": "core","tier": "stable",- "enabled": true,- "executable": true,+ "enabled": false,+ "executable": false,"path": "detections/identity/app-token-broad-default.yaml",- "sha256": "e3839bca699a59da546ccafd93cbaaf1cdc7b360331ba986e87f449179c13209"+ "quarantine_reason": "not executable (needs-connector-field): integration_installation.create entries carry the app's name but not its permission set, so `permission_administration` is never present. The installed app's permissions are exposed by GET /orgs/{org}/installations; surfacing that is connector work.",+ "sha256": "8bf57a9cc950b80d33dce074e9acb9daaa7c9a1b46a0781211c5cdaa9980bb20"},{"id": "det-identity-025",@@ -50550,10 +50554,11 @@"verified": true,"source": "core","tier": "stable",- "enabled": true,- "executable": true,+ "enabled": false,+ "executable": false,"path": "detections/identity/ident-github-pat-classic-created-with-broad-scopes.yaml",- "sha256": "f2799fdd6d0cba81929a38a331dbf194124f9c5bf772414a286d759e4d3fb6cd"+ "quarantine_reason": "not executable (needs-external-source): classic-PAT creation never reaches the org audit log \u2014 the documented personal_access_token.* lifecycle covers fine-grained tokens \u2014 and no audit entry carries a created token's scopes: the common `token_scopes` field describes the token that authenticated the API call, not the token being created.",+ "sha256": "3857957fad4cd0871d68735956badce1c5d0d27abdf05c16dcee134dd2f3def1"},{"id": "det-identity-155",@@ -50605,7 +50610,7 @@"executable": false,"path": "detections/identity/ident-github-deploy-key-added-org-wide.yaml","quarantine_reason": "superseded by the windowed rule wd-ident-github-deploy-key-added-org-wide; this stateless form named a counter no source emits",- "sha256": "77f95373794530900f68dcf340bbf424c147c44bfc9baea79fb08f8c066bc851"+ "sha256": "c35989d8944dcda686869c3e3d88af85ffa2e294ee188fb01a0fd4b176e9c338"},{"id": "det-identity-157",diff --git a/scripts/check_detection_fields.py b/scripts/check_detection_fields.pyindex 016aab483..476c4e589 100644--- a/scripts/check_detection_fields.py+++ b/scripts/check_detection_fields.py@@ -233,6 +233,12 @@ def _rule_fields(match_when: dict) -> set[str]:#: breaks._DERIVED_TIME_FIELDS = frozenset({"is_business_hours", "is_after_hours", "is_weekend"})+#: The source-IP privacy boolean `derived_fields.ip_privacy_fields` computes+#: from `src_ip` (issue #1545). Named exactly rather than pattern-matched for+#: the same reason as the tenant set below: `ip_is_internal` is computed and+#: a hypothetical `registry_is_internal` would not be.+_DERIVED_IP_FIELDS = frozenset({"ip_is_internal"})+#: Booleans the **tenant overlay** computes, from that tenant's own directory#: import (`identity_nodes.privilege_tier`). Depth plan 3.3.#:@@ -308,6 +314,7 @@ def _is_derivable(field: str, namespace: set[str]) -> bool:"""True when the engine can compute this field from what it already has."""if (field in _DERIVED_TIME_FIELDS+ or field in _DERIVED_IP_FIELDSor field in _TENANT_DERIVED_FIELDSor field in _FIRST_SEEN_DERIVED_FIELDSor field in _BASELINE_DERIVED_FIELDSdiff --git a/scripts/check_github_rule_alignment.py b/scripts/check_github_rule_alignment.pynew file mode 100644index 000000000..8a7c68f63--- /dev/null+++ b/scripts/check_github_rule_alignment.py@@ -0,0 +1,353 @@+#!/usr/bin/env python3+"""CI gate: GitHub detection rules fire on what the GitHub connector emits.++Issue #1545 measured ten of the twelve GitHub-product rules unable to fire on+real connector output, for three distinct reasons the field-reachability gate+cannot see:++* the connector emits ``event_type=github.{action}`` while rules matched the+ unprefixed value — a *value* mismatch over a field that exists;+* rules named audit actions that are not in GitHub's vocabulary at all+ (``deploy_key.create``, ``repo.visibility_change``, ``runner_register`` —+ GitHub logs a deploy-key add as ``public_key.create`` and a visibility+ change as ``repo.access``);+* rules read fields no GitHub telemetry carries (``diff_text``,+ ``approver_role``, a created token's ``scopes``).++Fixture replay cannot catch any of this because fixtures are synthesized from+the rule they test. This gate replays a **real-shaped org audit-log entry**+(field names per GitHub's audit-log event reference) through the real+``GitHubConnector.normalize()`` — out of process, because ``services/fusion``+and ``services/connectors`` both name their package ``app`` — and the real+``DetectionEngine``, and fails unless the rule fires.++Every enabled GitHub-product rule must carry a proof entry in+``PROOF_EVENTS``; a new GitHub rule without one fails here with instructions,+which is the regression protection the issue asked for. Rules whose only+stateful clause is a behavioural-baseline score are proven on their+deterministic clauses (the baseline is Redis-backed and not replayable here)+plus a pin that the baseline enrichment actually publishes those fields.+Windowed-translated rules are proven against the real windowed engine's own+namespace builder: the selector must match and the group-by / distinct-by+fields must be present, because a distinct-by naming a field the entry does+not carry never counts anything.++Usage:+ python3 scripts/check_github_rule_alignment.py --check+ python3 scripts/check_github_rule_alignment.py --self-test+"""++from __future__ import annotations++import argparse+import json+import subprocess+import sys+from pathlib import Path+from typing import Any++sys.path.insert(0, str(Path(__file__).resolve().parent))++from gate_toolkit import repo_root, self_test_main++ROOT = repo_root()+WORKER = ROOT / "scripts" / "connector_normalize_worker.py"+RULESET = ROOT / "services" / "fusion" / "app" / "data" / "detection_ruleset.json"+WINDOWED_RULESET = ROOT / "services" / "fusion" / "app" / "data" / "windowed_ruleset.json"+BASELINES_MODULE = ROOT / "services" / "fusion" / "app" / "services" / "baselines.py"++#: Fields the behavioural-baseline enrichment (`app/services/baselines.py`,+#: depth plan 3.4) merges into the namespace at evaluate_async time. Pinned by+#: name and re-checked against the module's own source below, so a renamed+#: baseline output fails here rather than leaving a rule proven against a+#: field nothing publishes any more.+BASELINE_FIELDS = frozenset({"baseline_action_rarity", "baseline_principal_volume_z"})++_PROOF_TS = 1761670000000 # ms epoch, matches the audit log's integer form+++def _entry(action: str, **extra: Any) -> dict[str, Any]:+ """A real-shaped org audit-log entry for ``action``.++ Field names follow GitHub's audit-log event reference: every entry+ carries ``action`` / ``actor`` / ``org`` / ``created_at`` (ms epoch) /+ ``@timestamp`` / ``_document_id``; repo-scoped events carry ``repo`` as+ the full ``org/name`` slug; ``actor_ip`` appears when the org discloses+ IPs. Addresses are RFC 5737 documentation ranges.+ """+ base: dict[str, Any] = {+ "_aisoc_stream": "audit_log",+ "_document_id": f"proof-{action}",+ "@timestamp": _PROOF_TS,+ "created_at": _PROOF_TS,+ "action": action,+ "actor": "proof-actor",+ "actor_ip": "203.0.113.5",+ "org": "example-org",+ "user": "proof-actor",+ }+ base.update(extra)+ return base+++#: One real-shaped audit entry per GitHub rule slug. The entry is what GitHub+#: documents for that action, NOT what the rule happens to match — the whole+#: point is that the two must agree through the real connector and engine.+PROOF_EVENTS: dict[str, dict[str, Any]] = {+ # A deploy-key add is logged as public_key.create with the repo slug+ # ("An SSH key was added to a user account or a deploy key was added to+ # a repository" — the repo field is what marks the deploy-key case).+ "app-deploy-key-added-github": _entry("public_key.create", repo="example-org/payments-core"),+ "app-protected-branch-disabled": _entry("protected_branch.policy_override", repo="example-org/payments-core", branch="main"),+ # 203.0.113.5 is outside every RFC 1918 / loopback / link-local range,+ # so the derived ip_is_internal is False — the external-IP case.+ "app-self-hosted-runner-external": _entry("org.register_self_hosted_runner"),+ "github-public-repo-flip": _entry("repo.access", repo="example-org/internal-tooling", public_repo=True, previous_visibility="private"),+ "ident-github-org-2fa-disabled": _entry("org.disable_two_factor_requirement"),+ "ta-github-rare-action-on-org-settings": _entry("org.update_default_repository_permission"),+ "ta-github-clone-volume-spike": _entry("git.clone", repo="example-org/payments-core", transport_protocol_name="ssh"),+ # Windowed-translated rules: the selector and the group-by/distinct-by+ # fields are proven against the same entries.+ "ident-github-org-collaborator-removed-bulk": _entry("org.remove_member", user="departed-user"),+ "ident-github-deploy-key-added-org-wide": _entry("public_key.create", repo="example-org/payments-core"),+}+++def _github_specs() -> list[tuple[str, dict[str, Any]]]:+ from detection_specs_index import all_specs # noqa: PLC0415 — scripts/ sibling, path set above++ return [(category, spec) for category, spec in all_specs() if (spec.get("log_source") or {}).get("product") == "github"]+++def _normalize_batch(raws: list[dict[str, Any]]) -> list[dict[str, Any] | None]:+ """Each raw entry through the real GitHubConnector.normalize(), one process.++ Out of process for the reason `connector_normalize_worker.py` documents:+ both services name their package ``app``, so the connector and the engine+ cannot be imported side by side.+ """+ lines = "\n".join(json.dumps({"emitter": "github", "raw": raw}) for raw in raws)+ done = subprocess.run( # noqa: S603+ [sys.executable, str(WORKER)],+ input=lines,+ capture_output=True,+ text=True,+ check=True,+ )+ out: list[dict[str, Any] | None] = []+ for line in done.stdout.strip().splitlines():+ if not line.strip():+ continue+ res = json.loads(line)+ out.append(res["normalized"] if res.get("ok") else None)+ if len(out) != len(raws):+ raise SystemExit(f"connector worker returned {len(out)} results for {len(raws)} inputs")+ return out+++def _message(normalized: dict[str, Any]) -> dict[str, Any]:+ return {"ocsf_event": {"raw_data": json.dumps(normalized, default=str)}}+++def _split_stateful(match_when: dict[str, Any]) -> tuple[dict[str, Any], dict[str, Any]]:+ """(deterministic clauses, baseline clauses) of one ``match_when``."""+ from detection_specs_part3_helpers import split_op # noqa: PLC0415 — scripts/ sibling++ deterministic: dict[str, Any] = {}+ stateful: dict[str, Any] = {}+ for key, value in match_when.items():+ field, _ = split_op(key)+ (stateful if field in BASELINE_FIELDS else deterministic)[key] = value+ return deterministic, stateful+++def check(+ specs: list[tuple[str, dict[str, Any]]],+ proof_events: dict[str, dict[str, Any]],+ engine_rules: dict[str, dict[str, Any]],+ windowed_rules: dict[str, dict[str, Any]],+ retired: dict[str, str],+) -> list[str]:+ """Every problem that stops a GitHub rule being proven against the connector."""+ sys.path.insert(0, str(ROOT / "services" / "fusion"))+ from app.services.detection_engine import DetectionEngine # noqa: PLC0415 — package collision, see module docstring+ from app.services.detection_matcher import matches # noqa: PLC0415+ from app.services.windowed_detection import WindowedDetectionEngine # noqa: PLC0415++ problems: list[str] = []++ baselines_source = BASELINES_MODULE.read_text(encoding="utf-8") if BASELINES_MODULE.exists() else ""+ for field in sorted(BASELINE_FIELDS):+ if field not in baselines_source:+ problems.append(f"baseline field {field!r} is not published by app/services/baselines.py — the pin above is stale")++ # Normalize every proof entry once, through the real connector.+ slugs = sorted(proof_events)+ normalized_by_slug: dict[str, dict[str, Any] | None] = dict(zip(slugs, _normalize_batch([proof_events[s] for s in slugs]), strict=True))+ for slug, normalized in normalized_by_slug.items():+ if normalized is None:+ problems.append(f"{slug}: the connector rejected its proof entry")++ for category, spec in specs:+ slug = str(spec["slug"])+ key = f"{category}/{slug}"+ reason = retired.get(key, "")+ windowed = windowed_rules.get(f"wd-{slug}")++ if reason and windowed is None:+ # Retired with a reason and genuinely gone from both corpora:+ # nothing to prove, but it must actually be gone.+ if slug in engine_rules:+ problems.append(f"{slug}: retired ({reason[:80]}…) but still loaded by the stateless engine")+ continue++ proof = proof_events.get(slug)+ if proof is None:+ problems.append(+ f"{slug}: enabled GitHub rule with no proof entry — add a real-shaped audit entry for it to "+ f"PROOF_EVENTS in {Path(__file__).name} (field names per GitHub's audit-log event reference)"+ )+ continue+ normalized = normalized_by_slug.get(slug)+ if normalized is None:+ continue # already reported above++ if windowed is not None:+ # Proven against the real windowed engine's own namespace builder.+ fields = WindowedDetectionEngine._fields(_message(normalized))+ if not matches(windowed.get("match_when") or {}, fields):+ selector = json.dumps(windowed.get("match_when"))+ problems.append(f"wd-{slug}: selector {selector} does not match the connector's output for its proof entry")+ for role in ("group_by", "distinct_by"):+ name = windowed.get(role)+ if name and fields.get(name) in (None, ""):+ problems.append(+ f"wd-{slug}: {role}={name!r} is not present in the connector's output — "+ "a window keyed on a missing field never counts"+ )+ continue++ rule = engine_rules.get(slug)+ if rule is None:+ problems.append(f"{slug}: GitHub spec is neither loaded by the engine nor retired with a reason")+ continue++ deterministic, stateful = _split_stateful(rule.get("match_when") or {})+ if stateful:+ # The baseline score is Redis-backed state this gate cannot+ # replay; the deterministic clauses are what alignment with the+ # connector means for these rules.+ fields = DetectionEngine._raw_fields({"raw_data": json.dumps(normalized, default=str)})+ if not matches(deterministic, fields):+ problems.append(+ f"{slug}: deterministic clauses {json.dumps(deterministic)} do not match the connector's output for its proof entry"+ )+ continue++ engine = DetectionEngine(rules=[rule])+ if not any(hit.rule_id == rule["id"] for hit in engine.evaluate(_message(normalized))):+ fields = DetectionEngine._raw_fields({"raw_data": json.dumps(normalized, default=str)})+ visible = {k: fields.get(k) for k in sorted(set((rule.get("match_when") or {}).keys()))}+ problems.append(+ f"{slug}: did not fire on the connector's output for its proof entry "+ f"(match_when={json.dumps(rule.get('match_when'))}; the clause keys read {json.dumps(visible, default=str)})"+ )++ return problems+++def _load_inputs() -> tuple[list[tuple[str, dict[str, Any]]], dict[str, dict[str, Any]], dict[str, dict[str, Any]], dict[str, str]]:+ from rule_retirement import retired # noqa: PLC0415 — scripts/ sibling++ for path in (RULESET, WINDOWED_RULESET, WORKER):+ if not path.exists():+ raise SystemExit(f"{Path(sys.argv[0]).name}: missing {path.relative_to(ROOT)} — nothing to verify against")+ ruleset = json.loads(RULESET.read_text(encoding="utf-8"))+ engine_rules = {str(r.get("slug")): r for r in ruleset.get("rules", [])}+ windowed = json.loads(WINDOWED_RULESET.read_text(encoding="utf-8"))+ windowed_rules = {str(r.get("id")): r for r in windowed.get("rules", [])}+ specs = _github_specs()+ if not specs:+ raise SystemExit(f"{Path(sys.argv[0]).name}: found no GitHub-product specs — the spec tables moved; refusing to pass on nothing")+ return specs, engine_rules, windowed_rules, retired()+++def _self_test() -> int:+ # The self-test proves the *checker* can fail, over a synthetic corpus it+ # controls; the real tree's inputs are exercised by `--check`, which CI+ # runs immediately before this.++ # A rule matching the unprefixed event_type — the exact defect shape of+ # issue #1545 — must be reported, through the real connector and engine.+ slug = "selftest-unprefixed-event-type"+ broken_rule: dict[str, Any] = {+ "id": "det-selftest-000",+ "slug": slug,+ "name": "self-test: unprefixed event_type",+ "severity": "low",+ "category": "application",+ "mitre": [],+ "match_when": {"event_type": "public_key.create"},+ }+ broken_specs: list[tuple[str, dict[str, Any]]] = [("application", {"slug": slug, "log_source": {"product": "github"}})]+ broken_proof = {slug: _entry("public_key.create", repo="example-org/payments-core")}+ caught = check(broken_specs, broken_proof, {slug: broken_rule}, {}, {})+ results = [+ (+ "reports a rule matching the unprefixed event_type (the issue #1545 defect shape)",+ any("did not fire" in p for p in caught),+ )+ ]++ # The aligned form of the same rule must pass, so the detection above is+ # the gate seeing the defect rather than the gate failing everything.+ aligned_rule = dict(broken_rule, match_when={"action": "public_key.create", "repo_contains": "/"})+ clean = check(broken_specs, broken_proof, {slug: aligned_rule}, {}, {})+ results.append(("accepts the same rule claused on the connector's real output", not clean))++ # A windowed rule whose distinct_by names a field the entry does not+ # carry must be reported — that window never counts anything.+ wd: dict[str, Any] = {+ "id": f"wd-{slug}",+ "match_when": {"action": "public_key.create"},+ "group_by": "actor",+ "distinct_by": "repository_full_slug_that_nothing_emits",+ }+ wd_caught = check(broken_specs, broken_proof, {}, {f"wd-{slug}": wd}, {})+ results.append(+ ("reports a windowed distinct_by naming a field the connector does not emit", any("never counts" in p for p in wd_caught))+ )++ results.append(+ (+ "an enabled GitHub rule without a proof entry is reported",+ any("no proof entry" in p for p in check(broken_specs, {}, {slug: aligned_rule}, {}, {})),+ )+ )++ return self_test_main(Path(__file__).name, ["--check"], extra=results)+++def main() -> int:+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument("--check", action="store_true", help="verify and exit nonzero on any problem")+ parser.add_argument("--self-test", action="store_true", help="prove the gate can fail")+ args = parser.parse_args()++ if args.self_test:+ return _self_test()++ specs, engine_rules, windowed_rules, retired = _load_inputs()+ problems = check(specs, PROOF_EVENTS, engine_rules, windowed_rules, retired)+ checked = len(specs)+ if problems:+ print(f"github rule alignment: {len(problems)} problem(s) across {checked} GitHub-product specs", file=sys.stderr)+ for problem in problems:+ print(f" - {problem}", file=sys.stderr)+ return 1+ print(f"github rule alignment: OK — {checked} GitHub-product specs proven against the real connector and engine")+ return 0+++if __name__ == "__main__":+ raise SystemExit(main())diff --git a/scripts/detection_specs_part2.py b/scripts/detection_specs_part2.pyindex a3ed3a6ab..0e111cad4 100644--- a/scripts/detection_specs_part2.py+++ b/scripts/detection_specs_part2.py@@ -1169,12 +1169,28 @@ APPLICATION: list[dict] = ["severity": "critical","mitre": ["t1530"],"log_source": {"product": "github", "service": "audit"},- "fields": {"action", "visibility"},- "match_when": {"action": "repo.visibility_change", "visibility": "public"},+ # `repo.visibility_change` is not in GitHub's audit vocabulary: a+ # visibility change is logged as `repo.access`, and the entry carries+ # `public_repo` (the new state) plus `previous_visibility` — not a+ # `visibility` string (issue #1545).+ "fields": {"action", "public_repo"},+ "match_when": {"action": "repo.access", "public_repo": True},"fp": ["OSS publication (must reference release ticket)"],"playbook": "tpl-data-exposure",- "positive": {"action": "repo.visibility_change", "visibility": "public", "repo": "internal-tooling", "actor": "[email protected]"},- "negative": {"action": "repo.visibility_change", "visibility": "private", "repo": "internal-tooling", "actor": "[email protected]"},+ "positive": {+ "action": "repo.access",+ "public_repo": True,+ "previous_visibility": "private",+ "repo": "example-org/internal-tooling",+ "actor": "[email protected]",+ },+ "negative": {+ "action": "repo.access",+ "public_repo": False,+ "previous_visibility": "public",+ "repo": "example-org/internal-tooling",+ "actor": "[email protected]",+ },},{"slug": "container-image-pulled-untrusted-registry",diff --git a/scripts/detection_specs_part3_application.py b/scripts/detection_specs_part3_application.pyindex 25fa5aa6e..82aaaca78 100644--- a/scripts/detection_specs_part3_application.py+++ b/scripts/detection_specs_part3_application.py@@ -214,9 +214,22 @@ DEVOPS_RULES: list[dict] = [mitre=["t1199"],product="github",service="actions",- when={"event_type": "runner_register", "ip_is_internal": False},+ # `runner_register` is not in GitHub's vocabulary; registrations are+ # `org.register_self_hosted_runner` / `repo.register_self_hosted_runner`.+ # `ip_is_internal` is derived by the engine from `src_ip` (which the+ # connector maps from the audit entry's `actor_ip`); when the org+ # does not disclose IPs the field is absent and the rule stays+ # silent — unknown is not external (issue #1545).+ when={+ "action_in": ["org.register_self_hosted_runner", "repo.register_self_hosted_runner"],+ "ip_is_internal": False,+ },fp=["Approved partner-hosted runner"],playbook="tpl-supply-chain",+ # Explicit fixtures carry the source IP rather than the derived+ # boolean, so fixture replay exercises the derivation itself.+ positive={"action": "org.register_self_hosted_runner", "src_ip": "203.0.113.9", "actor": "proof-actor"},+ negative={"action": "org.register_self_hosted_runner", "src_ip": "10.20.30.40", "actor": "proof-actor"},),S(slug="app-build-signing-key-rotated",@@ -269,9 +282,23 @@ DEVOPS_RULES: list[dict] = [mitre=["t1098.004"],product="github",service="repo",- when={"event_type": "deploy_key.create"},+ # GitHub's audit log has no deploy_key.* category: a deploy-key add+ # is logged as `public_key.create` ("An SSH key was added to a user+ # account or a deploy key was added to a repository"). The repo slug+ # is what marks the deploy-key case — a user SSH-key add carries no+ # repo, and the matcher treats a missing field as no match. `action`+ # rather than `event_type` because the connector prefixes the latter+ # (`github.{action}`); the raw audit entry's own key is the stable+ # one (issue #1545).+ when={"action": "public_key.create", "repo_contains": "/"},fp=["Sanctioned automation onboarding"],playbook="tpl-persistence",+ positive={"action": "public_key.create", "repo": "example-org/payments-core", "actor": "[email protected]"},+ # The negative is the other thing public_key.create genuinely logs:+ # a user SSH-key add, which carries no repo at all. Explicit because+ # the auto-negative flips the repo *value* and the vocabulary's+ # alternatives are repo slugs, every one of which still contains "/".+ negative={"action": "public_key.create", "actor": "[email protected]"},),S(slug="app-npm-package-publish-new-account",@@ -324,7 +351,11 @@ DEVOPS_RULES: list[dict] = [mitre=["t1098.004"],product="github",service="repo",- when={"event_type_in": ["protected_branch.policy_override", "protected_branch.destroy"]},+ # Both are documented audit actions, but the connector emits+ # `event_type=github.{action}`, so clausing the unprefixed values on+ # `event_type` could never match. The raw entry's `action` key is+ # visible to the engine and carries them unprefixed (issue #1545).+ when={"action_in": ["protected_branch.policy_override", "protected_branch.destroy"]},fp=[FP_TUNING],playbook="tpl-supply-chain",),diff --git a/scripts/detection_specs_part3_identity.py b/scripts/detection_specs_part3_identity.pyindex 2ccc6c628..a44f4c33a 100644--- a/scripts/detection_specs_part3_identity.py+++ b/scripts/detection_specs_part3_identity.py@@ -1334,7 +1334,12 @@ SAAS_RULES: list[dict] = [mitre=["t1098.001"],product="github",service="audit",- when={"action": "deploy_key.add", "distinct_repos_per_actor_per_hour_gt": 10},+ # GitHub has no deploy_key.* audit category; a deploy-key add is+ # `public_key.create` with the repo slug. The windowed translation+ # counts distinct `repo` values per actor, and an entry with no repo+ # (a user SSH-key add) is skipped by the distinct counter rather+ # than counted (issue #1545).+ when={"action": "public_key.create", "distinct_repos_per_actor_per_hour_gt": 10},fp=[FP_AUTOMATION],playbook="tpl-persistence",),diff --git a/scripts/enrichment_decisions.py b/scripts/enrichment_decisions.pyindex c687d6b30..2ebe8252f 100644--- a/scripts/enrichment_decisions.py+++ b/scripts/enrichment_decisions.py@@ -166,4 +166,49 @@ DECISIONS: dict[str, Refusal] = {"`LogonType` (2, 10 and 11 are interactive) and no source lifts that field, ""so the boolean has nothing to derive from.",),+ # ── GitHub rules whose evidence the audit log does not carry (#1545) ─+ #+ # Issue #1545 measured ten of twelve GitHub rules unable to fire on real+ # connector output. Five were re-claused onto what GitHub actually emits;+ # these five want evidence the org audit log does not contain, and a+ # plausible substitute would be a different detection wearing the same+ # name. Each reason names where the evidence actually lives.+ "application/app-ci-workflow-modified-by-non-owner": Refusal(+ NEEDS_CONNECTOR_FIELD,+ "matches pushes that modify .github/workflows/ without CODEOWNER approval, "+ "but the audit log's git.push entries carry no file paths and no review "+ "role — `path` and `approver_role` exist in no GitHub telemetry this "+ "connector pulls. The push webhook's per-commit file list could carry the "+ "paths; surfacing it is connector work.",+ ),+ "application/github-protected-branch-bypass": Refusal(+ NEEDS_CONNECTOR_FIELD,+ "wants `ref_in_protected_branches` and `actor_role` on a git.push, and the "+ "audit entry carries neither a ref nor the actor's org role. The observable "+ "form of a protection bypass in this telemetry is "+ "`protected_branch.policy_override`, which app-protected-branch-disabled "+ "already matches.",+ ),+ "data-exfil/github-pii-pattern-push": Refusal(+ NEEDS_EXTERNAL_SOURCE,+ "greps `diff_text` for secret patterns, and no GitHub telemetry carries "+ "diff contents — the audit log's git.push has no payload and webhooks name "+ "files, not hunks. Content inspection is GitHub secret scanning's job; "+ "surfacing its alerts is connector work, not a rewrite of this rule.",+ ),+ "identity/ident-github-pat-classic-created-with-broad-scopes": Refusal(+ NEEDS_EXTERNAL_SOURCE,+ "classic-PAT creation never reaches the org audit log — the documented "+ "personal_access_token.* lifecycle covers fine-grained tokens — and no "+ "audit entry carries a created token's scopes: the common `token_scopes` "+ "field describes the token that authenticated the API call, not the token "+ "being created.",+ ),+ "identity/app-token-broad-default": Refusal(+ NEEDS_CONNECTOR_FIELD,+ "integration_installation.create entries carry the app's name but not its "+ "permission set, so `permission_administration` is never present. The "+ "installed app's permissions are exposed by GET /orgs/{org}/installations; "+ "surfacing that is connector work.",+ ),}diff --git a/scripts/generate_corpus_stats.py b/scripts/generate_corpus_stats.pyindex e15a9657d..2686dd7a6 100644--- a/scripts/generate_corpus_stats.py+++ b/scripts/generate_corpus_stats.py@@ -96,6 +96,10 @@ COUNT_BEARING_FILES: tuple[tuple[Path, str, tuple[re.Pattern[str], ...]], ...] =REPO_ROOT / "README.md","executable",(+ # The "What AiSOC does" opening paragraph. Unregistered until+ # issue #1545, which is exactly how it sat one correction behind+ # the two registered sites below in the same file.+ re.compile(r"(?P<pre>runs the )(?P<n>\d+)(?P<post> executable rules of)"),re.compile(r"(?P<pre>fusion runs )(?P<n>\d+)(?P<post> executable detection rules)"),re.compile(r"(?P<pre>\| Detection engine \()(?P<n>\d+)(?P<post> executable rules\))"),),diff --git a/scripts/generate_detections.py b/scripts/generate_detections.pyindex 010ae4dfc..3e9fea38e 100644--- a/scripts/generate_detections.py+++ b/scripts/generate_detections.py@@ -37,6 +37,7 @@ Design notesfrom __future__ import annotationsimport argparse+import ipaddressimport jsonimport reimport sys@@ -652,6 +653,43 @@ def time_of_day_fields(}+#: Internal address space, by explicit list rather than `ipaddress.is_private`+#: / `is_global`: those predicates have moved between Python minors, and a+#: security predicate must not answer differently under two interpreter+#: builds of the same commit. Mirrors the vendored copy exactly.+_INTERNAL_NETWORKS = tuple(+ ipaddress.ip_network(net)+ for net in (+ "10.0.0.0/8",+ "172.16.0.0/12",+ "192.168.0.0/16",+ "127.0.0.0/8",+ "169.254.0.0/16",+ "fc00::/7",+ "fe80::/10",+ "::1/128",+ )+)+++def ip_privacy_fields(event: dict[str, Any], requested: set[str] | None = None) -> dict[str, bool]:+ """`ip_is_internal` from `src_ip`, when some rule asks for it.++ Absent, not false, when the event carries no parseable source address:+ an unknown origin is not an external one.+ """+ if not requested or "ip_is_internal" not in requested:+ return {}+ raw = event.get("src_ip")+ if not isinstance(raw, str) or not raw.strip():+ return {}+ try:+ addr = ipaddress.ip_address(raw.strip())+ except ValueError:+ return {}+ return {"ip_is_internal": any(addr in net for net in _INTERNAL_NETWORKS)}++def enrich(event: dict[str, Any],requested: set[str] | None = None,@@ -667,6 +705,7 @@ def enrich(derived: dict[str, Any] = {}derived.update(time_of_day_fields(event, business_start=business_start, business_end=business_end))derived.update(comparison_fields(event, requested))+ derived.update(ip_privacy_fields(event, requested))return event if not derived else {**derived, **event}@@ -685,7 +724,7 @@ def requested_derived_fields(rules: list[dict[str, Any]]) -> set[str]:walk(value)continuefield, _ = _split_op(key)- if _COMPARISON_RE.match(field) or field.startswith("is_"):+ if _COMPARISON_RE.match(field) or field.startswith("is_") or field == "ip_is_internal":names.add(field)elif isinstance(clause, list):for item in clause:diff --git a/scripts/windowed_translation.py b/scripts/windowed_translation.pyindex 722511172..8e7b33f9d 100644--- a/scripts/windowed_translation.py+++ b/scripts/windowed_translation.py@@ -333,7 +333,11 @@ DECISIONS: dict[str, Translation | Refusal | Covered] = {"identity/ident-ping-admin-role-burst": Translation(group_by="actor"),"identity/ident-oidc-many-clients-from-single-actor": Translation(group_by="actor"),"identity/ident-github-org-collaborator-removed-bulk": Translation(group_by="actor"),- "identity/ident-github-deploy-key-added-org-wide": Translation(group_by="actor", distinct_by="repository"),+ # `repo` is the key the audit-log entry actually carries (the connector's+ # own tests and GitHub's REST reference use it); `repository` was a+ # guessed name, and a distinct-by over a missing field never counts+ # (issue #1545).+ "identity/ident-github-deploy-key-added-org-wide": Translation(group_by="actor", distinct_by="repo"),# -------------------------------------------------------------------- network"network/c2-beacon-high-frequency": Refusal(AGGREGATE,diff --git a/services/api/app/api/v1/endpoints/detection_compat.py b/services/api/app/api/v1/endpoints/detection_compat.pyindex a9632ae53..572b53650 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,614 mapped rules.+#: an empty grid over a library of 2,609 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,614 rules on a default install and the page is bounded.+ #: library is 2,609 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,614 rules+ empty list on every install, while fusion loaded and fired 2,609 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,614 rows per+ read never creates one: a GET that materialised would put 2,609 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,614 built-ins at a placeholder confidence of 0 would fill the+ #: Scoring 2,609 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,7 +674,7 @@ 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,614 is a different claim from a mean over+ #: rules beside a library of 2,609 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,614 loaded rules — the+ over a product shipping ATT&CK mappings for 2,609 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 0c4dd4e16..08d015f78 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,614 rules.+ answered with an empty list while the engine ran 2,609 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/data/detections/detection_ruleset.json b/services/api/app/data/detections/detection_ruleset.jsonindex c9159bad4..08223bb91 100644--- a/services/api/app/data/detections/detection_ruleset.json+++ b/services/api/app/data/detections/detection_ruleset.json@@ -1,5 +1,5 @@{- "count": 765,+ "count": 760,"rules": [{"category": "application",@@ -288,32 +288,12 @@"severity": "high","slug": "ci-secret-printed-to-log"},- {- "category": "application",- "id": "det-application-016",- "match_when": {- "action": "git.push",- "actor_role_not_in": [- "admin",- "release"- ],- "ref_in_protected_branches": true- },- "mitre": [- "T1195.002"- ],- "name": "Push to Protected Branch by Non-Admin",- "product": "github",- "service": "audit",- "severity": "high",- "slug": "github-protected-branch-bypass"- },{"category": "application","id": "det-application-017","match_when": {- "action": "repo.visibility_change",- "visibility": "public"+ "action": "repo.access",+ "public_repo": true},"mitre": ["T1530"@@ -771,28 +751,14 @@"severity": "medium","slug": "app-csp-disabled"},- {- "category": "application",- "id": "det-application-046",- "match_when": {- "approver_role_neq": "codeowner",- "event_type": "push",- "path_contains": ".github/workflows/"- },- "mitre": [- "T1199"- ],- "name": "CI Workflow Modified By Account Without CODEOWNER Approval",- "product": "github",- "service": "repo",- "severity": "high",- "slug": "app-ci-workflow-modified-by-non-owner"- },{"category": "application","id": "det-application-047","match_when": {- "event_type": "runner_register",+ "action_in": [+ "org.register_self_hosted_runner",+ "repo.register_self_hosted_runner"+ ],"ip_is_internal": false},"mitre": [@@ -876,7 +842,8 @@"category": "application","id": "det-application-052","match_when": {- "event_type": "deploy_key.create"+ "action": "public_key.create",+ "repo_contains": "/"},"mitre": ["T1098.004"@@ -924,7 +891,7 @@"category": "application","id": "det-application-057","match_when": {- "event_type_in": [+ "action_in": ["protected_branch.policy_override","protected_branch.destroy"]@@ -4341,26 +4308,6 @@"severity": "medium","slug": "off-hours-bulk-download"},- {- "category": "data-exfil",- "id": "det-data-exfil-010",- "match_when": {- "action": "git.push",- "diff_text_pattern_match_any": [- "AKIA[0-9A-Z]{16}",- "ghp_[A-Za-z0-9]{36}",- "[A-Z0-9._%+-]+@[A-Z0-9.-]+ pii=true"- ]- },- "mitre": [- "T1552.001"- ],- "name": "Git Push Containing PII or Secret Pattern",- "product": "github",- "service": "audit",- "severity": "high",- "slug": "github-pii-pattern-push"- },{"category": "data-exfil","id": "det-data-exfil-011",@@ -10288,22 +10235,6 @@"severity": "high","slug": "oauth-broad-scope-grant"},- {- "category": "identity",- "id": "det-identity-024",- "match_when": {- "action": "integration_installation.create",- "permission_administration": "write"- },- "mitre": [- "T1098.001"- ],- "name": "GitHub App Installed with Repo Admin Permission",- "product": "github",- "service": "audit",- "severity": "high",- "slug": "app-token-broad-default"- },{"category": "identity","id": "det-identity-025",@@ -12087,26 +12018,6 @@"severity": "critical","slug": "ident-github-org-2fa-disabled"},- {- "category": "identity",- "id": "det-identity-154",- "match_when": {- "action": "personal_access_token.create",- "scopes_contains_all": [- "repo",- "workflow",- "admin:org"- ]- },- "mitre": [- "T1098.001"- ],- "name": "GitHub Classic PAT Created With repo+workflow+admin:org",- "product": "github",- "service": "audit",- "severity": "high",- "slug": "ident-github-pat-classic-created-with-broad-scopes"- },{"category": "identity","id": "det-identity-157",diff --git a/services/api/app/data/detections/windowed_ruleset.json b/services/api/app/data/detections/windowed_ruleset.jsonindex 355b8cea7..e6c542aba 100644--- a/services/api/app/data/detections/windowed_ruleset.json+++ b/services/api/app/data/detections/windowed_ruleset.json@@ -1050,11 +1050,11 @@},{"category": "identity",- "distinct_by": "repository",+ "distinct_by": "repo","group_by": "actor","id": "wd-ident-github-deploy-key-added-org-wide","match_when": {- "action": "deploy_key.add"+ "action": "public_key.create"},"mitre": ["T1098.001"diff --git a/services/api/app/data/marketplace/index.json b/services/api/app/data/marketplace/index.jsonindex 0af060131..1ac50e9a9 100644--- a/services/api/app/data/marketplace/index.json+++ b/services/api/app/data/marketplace/index.json@@ -1,7 +1,7 @@{"$schema": "https://example.com/schemas/marketplace/v1.json","version": "1.0.0",- "generated": "2026-10-12T04:44:25Z",+ "generated": "2026-10-28T19:50:45Z","categories": [{"id": "playbooks",@@ -38,10 +38,10 @@"imported": 6113,"stable": 901},- "executable": 2703,- "quarantined": 4480,- "executable_detections": 2535,- "reference_only_detections": 4480,+ "executable": 2698,+ "quarantined": 4485,+ "executable_detections": 2530,+ "reference_only_detections": 4485,"not_a_detection": 168},"mitre_coverage": {@@ -159,7 +159,7 @@"T1091": 1,"T1095": 4,"T1098": 48,- "T1098.001": 21,+ "T1098.001": 19,"T1098.003": 8,"T1098.004": 6,"T1098.005": 1,@@ -211,9 +211,9 @@"T1190": 39,"T1195": 3,"T1195.001": 2,- "T1195.002": 7,+ "T1195.002": 6,"T1197": 13,- "T1199": 12,+ "T1199": 11,"T1200": 3,"T1201": 3,"T1202": 26,@@ -319,7 +319,7 @@"T1550.003": 3,"T1550.004": 1,"T1552": 3,- "T1552.001": 17,+ "T1552.001": 16,"T1552.002": 3,"T1552.004": 7,"T1552.005": 1,@@ -439,7 +439,7 @@"T1686.003": 10,"T1689": 1},- "total_with_mitre": 2405,+ "total_with_mitre": 2400,"unique_techniques_all_rules": 494,"techniques_all_rules": {"T1001.003": 2,@@ -31020,10 +31020,11 @@"verified": true,"source": "core","tier": "stable",- "enabled": true,- "executable": true,+ "enabled": false,+ "executable": false,"path": "detections/application/github-protected-branch-bypass.yaml",- "sha256": "408d302476035003e40f95c04c61d77e4ed4136848a38f6e6e5bf4407a28ec06"+ "quarantine_reason": "not executable (needs-connector-field): wants `ref_in_protected_branches` and `actor_role` on a git.push, and the audit entry carries neither a ref nor the actor's org role. The observable form of a protection bypass in this telemetry is `protected_branch.policy_override`, which app-protected-branch-disabled already matches.",+ "sha256": "e01150cf5d5fc13af7fe4092f7956d7589061b7b89721797946e1af10753cabd"},{"id": "det-application-017",@@ -31048,7 +31049,7 @@"enabled": true,"executable": true,"path": "detections/application/github-public-repo-flip.yaml",- "sha256": "a84b1745a96ff19c92c44021c914e4f6fcdf51dd0e26ed43235fb65a5a227566"+ "sha256": "301ff06edbbf04aeb7ece2e2dccdd2596b2d8d3a89bf294eff3e9891787acf33"},{"id": "det-application-018",@@ -31774,10 +31775,11 @@"verified": true,"source": "core","tier": "stable",- "enabled": true,- "executable": true,+ "enabled": false,+ "executable": false,"path": "detections/application/app-ci-workflow-modified-by-non-owner.yaml",- "sha256": "cbdd8b151fb99ccdede43f2f4e91b16bfd8f7d5a9a458a787dfe1d0b2d427489"+ "quarantine_reason": "not executable (needs-connector-field): matches pushes that modify .github/workflows/ without CODEOWNER approval, but the audit log's git.push entries carry no file paths and no review role \u2014 `path` and `approver_role` exist in no GitHub telemetry this connector pulls. The push webhook's per-commit file list could carry the paths; surfacing it is connector work.",+ "sha256": "24368520c3844f542e60e7af76035978ea893a4c415b04d1a3871bdbb62694a0"},{"id": "det-application-047",@@ -31802,7 +31804,7 @@"enabled": true,"executable": true,"path": "detections/application/app-self-hosted-runner-external.yaml",- "sha256": "826b9b5d236411e0dc567ac2341bc6c58aa6ce74b4fd5ebbddb574ca919d6f14"+ "sha256": "34f18e7c0f5c90ba516ae13137ddf9e1ef6fc0ed00e539d9ed96863a11093432"},{"id": "det-application-048",@@ -31927,7 +31929,7 @@"enabled": true,"executable": true,"path": "detections/application/app-deploy-key-added-github.yaml",- "sha256": "9ee43d16d2cc1f4b7b35f13e49e1f726097dc7fcdd0167441416fa70f9d2bc50"+ "sha256": "1b8442952eee7ef1b38bea033db18ac15c2fd960cf7a39075b07e7844bb2338a"},{"id": "det-application-053",@@ -32054,7 +32056,7 @@"enabled": true,"executable": true,"path": "detections/application/app-protected-branch-disabled.yaml",- "sha256": "f74a64858a2962bcbac0134f1a5c3b1aa38913f7639dc0fcc63595e70083e303"+ "sha256": "b63813e952ba0970198ae425d078deda160beccffedfa765f1a6d9707f602f8a"},{"id": "det-application-058",@@ -38774,10 +38776,11 @@"verified": true,"source": "core","tier": "stable",- "enabled": true,- "executable": true,+ "enabled": false,+ "executable": false,"path": "detections/data-exfil/github-pii-pattern-push.yaml",- "sha256": "99d74ffff6ec73dcbcff94ea9363abc2877d92ce0f27e211e265a94d79b5a266"+ "quarantine_reason": "not executable (needs-external-source): greps `diff_text` for secret patterns, and no GitHub telemetry carries diff contents \u2014 the audit log's git.push has no payload and webhooks name files, not hunks. Content inspection is GitHub secret scanning's job; surfacing its alerts is connector work, not a rewrite of this rule.",+ "sha256": "9ec45286627557b194b6a1ad1f82877cf959b727fd185997258993c21aa53909"},{"id": "det-data-exfil-011",@@ -47276,10 +47279,11 @@"verified": true,"source": "core","tier": "stable",- "enabled": true,- "executable": true,+ "enabled": false,+ "executable": false,"path": "detections/identity/app-token-broad-default.yaml",- "sha256": "e3839bca699a59da546ccafd93cbaaf1cdc7b360331ba986e87f449179c13209"+ "quarantine_reason": "not executable (needs-connector-field): integration_installation.create entries carry the app's name but not its permission set, so `permission_administration` is never present. The installed app's permissions are exposed by GET /orgs/{org}/installations; surfacing that is connector work.",+ "sha256": "8bf57a9cc950b80d33dce074e9acb9daaa7c9a1b46a0781211c5cdaa9980bb20"},{"id": "det-identity-025",@@ -50550,10 +50554,11 @@"verified": true,"source": "core","tier": "stable",- "enabled": true,- "executable": true,+ "enabled": false,+ "executable": false,"path": "detections/identity/ident-github-pat-classic-created-with-broad-scopes.yaml",- "sha256": "f2799fdd6d0cba81929a38a331dbf194124f9c5bf772414a286d759e4d3fb6cd"+ "quarantine_reason": "not executable (needs-external-source): classic-PAT creation never reaches the org audit log \u2014 the documented personal_access_token.* lifecycle covers fine-grained tokens \u2014 and no audit entry carries a created token's scopes: the common `token_scopes` field describes the token that authenticated the API call, not the token being created.",+ "sha256": "3857957fad4cd0871d68735956badce1c5d0d27abdf05c16dcee134dd2f3def1"},{"id": "det-identity-155",@@ -50605,7 +50610,7 @@"executable": false,"path": "detections/identity/ident-github-deploy-key-added-org-wide.yaml","quarantine_reason": "superseded by the windowed rule wd-ident-github-deploy-key-added-org-wide; this stateless form named a counter no source emits",- "sha256": "77f95373794530900f68dcf340bbf424c147c44bfc9baea79fb08f8c066bc851"+ "sha256": "c35989d8944dcda686869c3e3d88af85ffa2e294ee188fb01a0fd4b176e9c338"},{"id": "det-identity-157",diff --git a/services/api/app/services/builtin_rules.py b/services/api/app/services/builtin_rules.pyindex c1ae11c9b..7f7e2dc28 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,614 detection rules into fusion and fires+Issue #1273: a core install loads 2,609 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,614 rows into Postgres at boot was the other option and is worse:+Seeding 2,609 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,614 UUIDv5 digests, which is cheap once and wasteful on every+ 2,609 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 dbab9b100..6d2521ff5 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,614 rows per tenant in the table on the first page load, and the+would put 2,609 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 b35cb1700..d6ef1b50f 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,614 detection rules into fusion and fires+Issue #1273: a core install loads 2,609 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@@ -66,7 +66,7 @@ PACKAGED = REPO / "services" / "api" / "app" / "data" / "detections"#: regeneration that silently empties one is a failure here rather than a#: quieter comparison of two numbers that moved together.ARTEFACTS: dict[str, int] = {- "detection_ruleset.json": 765,+ "detection_ruleset.json": 760,"detection_ruleset_imported.json": 1770,"windowed_ruleset.json": 76,}@@ -76,13 +76,16 @@ ARTEFACTS: dict[str, int] = {#: why the loaded windowed count is 73 against a file holding 72.PYTHON_RESIDENT_WINDOWED = 3-#: 765 + 1770 stateless, 76 windowed (73 of the 76 file entries plus the three+#: 760 + 1770 stateless, 76 windowed (73 of the 76 file entries plus the three#: above), 3 sequence (the other three file entries). Measured, not assumed —#: `test_catalogue_matches_what_fusion_actually_loads` re-derives it by running#: fusion's loaders. The 2026-10-12 merge train moved it 2586 -> 2614: +24#: native rules (depth 3.4's enrichment inputs) and +4 windowed (depth 7.3's-#: AitM family).-FUSION_LOADED_TOTAL = 2614+#: AitM family). Issue #1545 moved it 2614 -> 2609: five GitHub rules whose+#: evidence the org audit log cannot carry were retired with reasons+#: (`enrichment_decisions.py`) and stopped being counted as executable,+#: which they never were.+FUSION_LOADED_TOTAL = 2609TENANT = uuid.UUID("aaaaaaaa-0000-0000-0000-00000000a173")ACTOR = uuid.UUID("bbbbbbbb-0000-0000-0000-00000000b173")@@ -336,7 +339,7 @@ class TestTheConsoleReadsTheLoadedCorpus:assert body["missingArtefacts"] == []async def test_the_page_is_bounded_and_the_total_is_not(self, client) -> None:- """2,614 rules serialised is several MB; the header count must still be true."""+ """2,609 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/connectors/app/connectors/github.py b/services/connectors/app/connectors/github.pyindex d0a13fe6e..41249f196 100644--- a/services/connectors/app/connectors/github.py+++ b/services/connectors/app/connectors/github.py@@ -251,11 +251,17 @@ class GitHubConnector(BaseConnector):"org.update_member", # role changes (member → owner is the canary)"org.transfer",# access tokens / SSH / SSO- "personal_access_token.create",+ #+ # Two strings this list used to carry name actions GitHub never+ # emits (issue #1545): `deploy_key.create` — deploy keys do not have+ # their own audit category, an add is logged as `public_key.create`+ # (below) — and `personal_access_token.create` — the documented+ # lifecycle is for fine-grained tokens, where the risk moment is+ # `access_granted` (below). A severity list naming actions the+ # vendor never emits is a claim nothing can test."personal_access_token.access_granted","oauth_authorization.create","public_key.create",- "deploy_key.create","two_factor_authentication.disabled",# branch protection bypass / deletion"protected_branch.destroy",diff --git a/services/fusion/app/data/detection_ruleset.json b/services/fusion/app/data/detection_ruleset.jsonindex c9159bad4..08223bb91 100644--- a/services/fusion/app/data/detection_ruleset.json+++ b/services/fusion/app/data/detection_ruleset.json@@ -1,5 +1,5 @@{- "count": 765,+ "count": 760,"rules": [{"category": "application",@@ -288,32 +288,12 @@"severity": "high","slug": "ci-secret-printed-to-log"},- {- "category": "application",- "id": "det-application-016",- "match_when": {- "action": "git.push",- "actor_role_not_in": [- "admin",- "release"- ],- "ref_in_protected_branches": true- },- "mitre": [- "T1195.002"- ],- "name": "Push to Protected Branch by Non-Admin",- "product": "github",- "service": "audit",- "severity": "high",- "slug": "github-protected-branch-bypass"- },{"category": "application","id": "det-application-017","match_when": {- "action": "repo.visibility_change",- "visibility": "public"+ "action": "repo.access",+ "public_repo": true},"mitre": ["T1530"@@ -771,28 +751,14 @@"severity": "medium","slug": "app-csp-disabled"},- {- "category": "application",- "id": "det-application-046",- "match_when": {- "approver_role_neq": "codeowner",- "event_type": "push",- "path_contains": ".github/workflows/"- },- "mitre": [- "T1199"- ],- "name": "CI Workflow Modified By Account Without CODEOWNER Approval",- "product": "github",- "service": "repo",- "severity": "high",- "slug": "app-ci-workflow-modified-by-non-owner"- },{"category": "application","id": "det-application-047","match_when": {- "event_type": "runner_register",+ "action_in": [+ "org.register_self_hosted_runner",+ "repo.register_self_hosted_runner"+ ],"ip_is_internal": false},"mitre": [@@ -876,7 +842,8 @@"category": "application","id": "det-application-052","match_when": {- "event_type": "deploy_key.create"+ "action": "public_key.create",+ "repo_contains": "/"},"mitre": ["T1098.004"@@ -924,7 +891,7 @@"category": "application","id": "det-application-057","match_when": {- "event_type_in": [+ "action_in": ["protected_branch.policy_override","protected_branch.destroy"]@@ -4341,26 +4308,6 @@"severity": "medium","slug": "off-hours-bulk-download"},- {- "category": "data-exfil",- "id": "det-data-exfil-010",- "match_when": {- "action": "git.push",- "diff_text_pattern_match_any": [- "AKIA[0-9A-Z]{16}",- "ghp_[A-Za-z0-9]{36}",- "[A-Z0-9._%+-]+@[A-Z0-9.-]+ pii=true"- ]- },- "mitre": [- "T1552.001"- ],- "name": "Git Push Containing PII or Secret Pattern",- "product": "github",- "service": "audit",- "severity": "high",- "slug": "github-pii-pattern-push"- },{"category": "data-exfil","id": "det-data-exfil-011",@@ -10288,22 +10235,6 @@"severity": "high","slug": "oauth-broad-scope-grant"},- {- "category": "identity",- "id": "det-identity-024",- "match_when": {- "action": "integration_installation.create",- "permission_administration": "write"- },- "mitre": [- "T1098.001"- ],- "name": "GitHub App Installed with Repo Admin Permission",- "product": "github",- "service": "audit",- "severity": "high",- "slug": "app-token-broad-default"- },{"category": "identity","id": "det-identity-025",@@ -12087,26 +12018,6 @@"severity": "critical","slug": "ident-github-org-2fa-disabled"},- {- "category": "identity",- "id": "det-identity-154",- "match_when": {- "action": "personal_access_token.create",- "scopes_contains_all": [- "repo",- "workflow",- "admin:org"- ]- },- "mitre": [- "T1098.001"- ],- "name": "GitHub Classic PAT Created With repo+workflow+admin:org",- "product": "github",- "service": "audit",- "severity": "high",- "slug": "ident-github-pat-classic-created-with-broad-scopes"- },{"category": "identity","id": "det-identity-157",diff --git a/services/fusion/app/data/windowed_ruleset.json b/services/fusion/app/data/windowed_ruleset.jsonindex 355b8cea7..e6c542aba 100644--- a/services/fusion/app/data/windowed_ruleset.json+++ b/services/fusion/app/data/windowed_ruleset.json@@ -1050,11 +1050,11 @@},{"category": "identity",- "distinct_by": "repository",+ "distinct_by": "repo","group_by": "actor","id": "wd-ident-github-deploy-key-added-org-wide","match_when": {- "action": "deploy_key.add"+ "action": "public_key.create"},"mitre": ["T1098.001"diff --git a/services/fusion/app/services/derived_fields.py b/services/fusion/app/services/derived_fields.pyindex f742f4ddb..8c783ae18 100644--- a/services/fusion/app/services/derived_fields.py+++ b/services/fusion/app/services/derived_fields.py@@ -29,6 +29,7 @@ detection that fires on ignorance.from __future__ import annotations+import ipaddressimport refrom datetime import datetimefrom typing import Any@@ -139,6 +140,48 @@ def time_of_day_fields(}+#: Internal address space, by explicit list rather than `ipaddress.is_private`+#: / `is_global`: those predicates have moved between Python minors (the+#: documentation ranges flipped under the IANA special-registry alignment),+#: and a security predicate must not answer differently under two interpreter+#: builds of the same commit. RFC 1918, loopback and link-local plus their+#: IPv6 equivalents are internal; everything else — including carrier-grade+#: NAT and the documentation ranges — is not, so a runner registering from a+#: CGN address reads as external, which is the alarm an operator wants.+_INTERNAL_NETWORKS = tuple(+ ipaddress.ip_network(net)+ for net in (+ "10.0.0.0/8",+ "172.16.0.0/12",+ "192.168.0.0/16",+ "127.0.0.0/8",+ "169.254.0.0/16",+ "fc00::/7",+ "fe80::/10",+ "::1/128",+ )+)+++def ip_privacy_fields(event: dict[str, Any], requested: set[str] | None = None) -> dict[str, bool]:+ """Compute `ip_is_internal` from `src_ip`, when some rule asks for it.++ Absent, not false, when the event carries no parseable source address —+ an unknown origin is not an external one, and a rule gated on+ `ip_is_internal: false` must not fire because we did not know.+ """+ if not requested or "ip_is_internal" not in requested:+ return {}+ raw = event.get("src_ip")+ if not isinstance(raw, str) or not raw.strip():+ return {}+ try:+ addr = ipaddress.ip_address(raw.strip())+ except ValueError:+ return {}+ return {"ip_is_internal": any(addr in net for net in _INTERNAL_NETWORKS)}++def enrich(event: dict[str, Any],requested: set[str] | None = None,@@ -156,6 +199,7 @@ def enrich(derived: dict[str, Any] = {}derived.update(time_of_day_fields(event, business_start=business_start, business_end=business_end))derived.update(comparison_fields(event, requested))+ derived.update(ip_privacy_fields(event, requested))if not derived:return event@@ -181,7 +225,7 @@ def requested_derived_fields(rules: list[dict[str, Any]]) -> set[str]:walk(value)continuefield, _ = _split_op(key)- if _COMPARISON_RE.match(field) or field.startswith("is_"):+ if _COMPARISON_RE.match(field) or field.startswith("is_") or field == "ip_is_internal":names.add(field)elif isinstance(clause, list):for item in clause:diff --git a/services/fusion/tests/test_derived_fields.py b/services/fusion/tests/test_derived_fields.pyindex 447e3d875..7363df0be 100644--- a/services/fusion/tests/test_derived_fields.py+++ b/services/fusion/tests/test_derived_fields.py@@ -20,6 +20,7 @@ import pytestfrom app.services.derived_fields import (comparison_fields,enrich,+ ip_privacy_fields,requested_derived_fields,time_of_day_fields,)@@ -137,6 +138,38 @@ class TestTimeOfDay:assert time_of_day_fields(event, business_start=9, business_end=23)["is_business_hours"] is True+class TestIpPrivacy:+ """`ip_is_internal`, derived from `src_ip` (issue #1545).++ The ranges are an explicit list rather than `ipaddress.is_private`,+ because that predicate has moved between Python minors and a security+ predicate must not answer differently under two interpreter builds of+ the same commit.+ """++ @pytest.mark.parametrize("ip", ["10.20.30.40", "172.16.9.1", "192.168.1.5", "127.0.0.1", "169.254.1.1", "fe80::1", "fc00::1", "::1"])+ def test_private_loopback_and_link_local_are_internal(self, ip: str) -> None:+ assert ip_privacy_fields({"src_ip": ip}, {"ip_is_internal"}) == {"ip_is_internal": True}++ @pytest.mark.parametrize("ip", ["203.0.113.9", "198.51.100.7", "100.64.0.1", "2001:db8::1"])+ def test_everything_else_is_external_including_cgn_and_documentation_ranges(self, ip: str) -> None:+ """A runner registering from carrier-grade NAT reads as external,+ which is the alarm an operator wants."""+ assert ip_privacy_fields({"src_ip": ip}, {"ip_is_internal"}) == {"ip_is_internal": False}++ def test_a_missing_address_yields_no_key_rather_than_false(self) -> None:+ """An unknown origin is not an external one: a rule gated on+ `ip_is_internal: false` must not fire because we did not know."""+ assert ip_privacy_fields({"actor": "alice"}, {"ip_is_internal"}) == {}++ def test_an_unparseable_address_yields_no_key(self) -> None:+ assert ip_privacy_fields({"src_ip": "not-an-ip"}, {"ip_is_internal"}) == {}++ def test_not_computed_unless_some_rule_asks(self) -> None:+ assert ip_privacy_fields({"src_ip": "10.0.0.1"}, set()) == {}+ assert ip_privacy_fields({"src_ip": "10.0.0.1"}, {"actor_eq_target"}) == {}++class TestEnrich:def test_a_vendor_value_is_never_overwritten(self) -> None:"""A vendor's own answer about its own tenant's hours beats ours."""@@ -167,6 +200,10 @@ class TestRequestedFields:]assert requested_derived_fields(rules) == {"actor_eq_target", "is_business_hours"}+ def test_collects_the_ip_privacy_field(self) -> None:+ rules = [{"match_when": {"action": "org.register_self_hosted_runner", "ip_is_internal": False}}]+ assert requested_derived_fields(rules) == {"ip_is_internal"}+def test_walks_nested_clauses(self) -> None:rules = [{"match_when": {"any_of": [{"actor_eq_target": True}, {"x": 1}]}}]assert "actor_eq_target" in requested_derived_fields(rules)diff --git a/tests/test_packaged_detection_corpus_gate.py b/tests/test_packaged_detection_corpus_gate.pyindex 4c70f812f..7bf38b8dc 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,614. A gate+that lists no detection rules while the engine loads and fires 2,609. 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 "2614 rules" in result.stdout+ assert "2609 rules" in result.stdoutclass TestTheGateCatchesItsOwnAbsence: