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
feat(phase-D2): AI/LLM-usage audit connector + llm-* detections + lake tiering (#469)
Beenu Arorac5971a39447c
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f1a6cd7e0..181c7d5f5 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Added+- **Phase D2 — AI/LLM-usage governance + tiered lake storage.** Three pieces. (1) **AI/LLM-usage audit connector** (`services/connectors/app/connectors/llm_usage.py`) pulls OpenAI + Anthropic organization audit logs — API key creation, role grants, logging/MFA changes, project deletes — and emits the dotted `event_type` (`openai.api_key.created`, `anthropic.member.added`) that the detections match. (2) **Eight native `llm-*` detection rules** (`scripts/detection_specs_part3_application.py`): LLM API/admin-key created, owner granted, audit logging disabled (critical), MFA disabled, service-account created, project archived — regenerated into the corpus (825 executable rules) and re-exported to the fusion live-detection ruleset; verified firing end-to-end. (3) **Hot/warm/cold lake tiering** (`services/api/clickhouse/tiering/`): an opt-in ClickHouse storage policy + `002_tiering.sql` that rebinds `aisoc.raw_events` to a `tiered` policy and moves data to a cold (object/NAS) volume at 30 days, deleting at 90 — the Phase 6 tiering wired now that the lake is populated. Verified end-to-end on ClickHouse 23.8 (policy loads, table rebinds, TTL applied); a static config gate (`test_storage_tiering.py`) catches drift. Registry 77→78; connector-count + conformance-matrix + marketplace regenerated. Claim-to-gate matrix +1 GATED (29 GATED / 10 PARTIAL / 1 NO GATE).- **Phase D1 — eight new connectors close the biggest coverage gaps (SIEM / NDR / edge / endpoint).** Following the connector convention (schema + registry + `plugins/<id>/plugin.yaml` + docs + `marketplace:sync`), adds: **IBM QRadar** (offenses; magnitude→severity), **Exabeam** (notable risk-scored sessions), **Securonix** (incidents; priority→severity), **Devo** (triggered alerts) — the four SIEMs the reality audit flagged as missing; **Netskope** (SASE/SWG DLP/malware/anomaly alerts, malware/DLP floored at `high`); **Windows Event / Sysmon** (WEF collector spool; severity from channel + Event ID — log clears, service installs, process-injection surfaces floored); **Zeek / Suricata NDR** (Suricata `eve.json` priority + Zeek `notice` types); and a first-class **generic syslog / CEF listener** (parses the ArcSight CEF header + extension, CEF severity 0–10 → five-tier, non-CEF lines ingested at `info`). Every connector maps onto the exact five-tier ladder and passes the schema + runtime conformance gates. Registry now 69→77 connectors; connector-count + conformance-matrix + marketplace index regenerated. 40 new unit tests (severity mapping across the ladder, CEF parser, mocked pulls); full connectors suite 791 passed at 67.37% coverage. Claim-to-gate matrix +1 GATED (28 GATED / 10 PARTIAL / 1 NO GATE).- **Phase C3 — autopilot/copilot posture with a visible autonomy scorecard (defaults to copilot).** The per-action guardrail editor already let operators scope autonomy by action; C3 adds the whole-SOC posture view a CISO asks for. New `apps/web/src/components/settings/AutonomyScorecard.tsx` computes an honest posture from the *configured* policy (not fabricated runtime stats): **Copilot** (the safe default — high/critical-blast actions always require a human) vs **Autopilot** (flips only when a high/critical-blast action is configured to auto-execute), plus the distribution of actions by blast radius and auto-exec/override counts. Rendered atop the existing `AutonomyPolicyPanel`. The compute is a pure, unit-tested function; 6 vitest tests (`AutonomyScorecard.test.tsx`). Combined with the Phase B2 `AISOC_MATURITY_TIER` gate (which enforces copilot at the dispatch layer), the platform is copilot-by-default end-to-end. Claim-to-gate matrix +1 GATED (27 GATED / 10 PARTIAL / 1 NO GATE).- **Phase C1 — Advanced Data Explorer: one investigation surface, no SIEM context-switch.** New `/explore` (`apps/web/src/components/explore/ExploreView.tsx`) unifies the surfaces shipped earlier in the roadmap into a single workbench: ask a question in plain English → it translates to SQL via `/api/v1/nl-query/translate` → runs against the now-populated ClickHouse event lake (`/api/v1/lake/sql`, Phase A1) → renders a BI-like table (row count, latency, referenced tables), with a raw-SQL escape hatch always available. Source tabs pivot to identity (effective permissions), config/graph, and threat intel so the analyst answers "who touched this, with what access, and is the IP known-bad?" without leaving the page. Adds a typed `lakeApi` client, sidebar + command-palette + sitemap entries. 5 vitest smoke tests (`ExploreView.test.tsx`); web type-check + full coverage gate green (395 tests). Claim-to-gate matrix +1 GATED (26 GATED / 10 PARTIAL / 1 NO GATE).diff --git a/README.md b/README.mdindex 1c931dd0f..1788dfe2c 100644--- a/README.md+++ b/README.md@@ -167,7 +167,7 @@ A handful of headline capabilities — the rest are catalogued in [`apps/docs/do> **Maturity.** Connectors, Investigation Rail + Ledger, and Hunt-as-Code are GA. Detection-as-Code and L0–L4 autonomy are beta (eval-gate and rollback/post-action-verification hardening in progress). The live-agent benchmark is preview; the substrate eval suites are GA. Full per-claim status: [`docs/audit/REALITY_REPORT.md`](docs/audit/REALITY_REPORT.md).-- **77 click-and-connect data connectors** (EDR/XDR, SIEM, cloud, CNAPP, identity, SaaS, VCS, K8s audit, network) with schema-driven config, live `Test connection`, and vault-encrypted secrets. Walkthrough: [`apps/docs/docs/connectors/index.md`](apps/docs/docs/connectors/index.md).+- **78 click-and-connect data connectors** (EDR/XDR, SIEM, cloud, CNAPP, identity, SaaS, VCS, K8s audit, network) with schema-driven config, live `Test connection`, and vault-encrypted secrets. Walkthrough: [`apps/docs/docs/connectors/index.md`](apps/docs/docs/connectors/index.md).- **Investigation Rail + replayable Investigation Ledger** — every prompt, tool call, evidence chip, and rationale stored against a case, replayable in the UI. [`apps/docs/docs/console/investigation-rail.md`](apps/docs/docs/console/investigation-rail.md).- **Detection-as-Code lifecycle** — propose → review → eval-gate → promote; CI rejects any candidate that fails its own positive/negative fixtures (the non-circular gate) or regresses MITRE accuracy. [`apps/docs/docs/concepts/detections.md`](apps/docs/docs/concepts/detections.md) — and the 861 native rules live in [`detections/`](detections/).- **L0–L4 automation maturity** — gate every autonomous action on per-action confidence thresholds and blast-radius. [`apps/docs/docs/concepts/automation-maturity.md`](apps/docs/docs/concepts/automation-maturity.md).diff --git a/RELEASES.md b/RELEASES.mdindex d251903a3..06d30fee3 100644--- a/RELEASES.md+++ b/RELEASES.md@@ -67,7 +67,7 @@ This file mirrors what used to live in the "What's new" section of [`README.md`]- First community contribution merged: [#135](https://github.com/beenuar/AiSOC/pull/135) (UEBA env-var alignment, closes [#134](https://github.com/beenuar/AiSOC/issues/134)). Every UEBA variable accepts both unprefixed (`DATABASE_URL`) and legacy (`UEBA_DATABASE_URL`) forms; unprefixed wins.**Stage 2 / Stage 3 platform additions** — landed alongside the architectural foundation above.-- **Wazuh Indexer ingest connector** — polls `wazuh-alerts-*` over HTTPX, paginates time-windowed queries, retries on 5xx; collapses Wazuh severity into the AiSOC ladder. Docs: [`apps/docs/docs/connectors/wazuh.md`](apps/docs/docs/connectors/wazuh.md). The connector registry now declares **77 first-party connectors**.+- **Wazuh Indexer ingest connector** — polls `wazuh-alerts-*` over HTTPX, paginates time-windowed queries, retries on 5xx; collapses Wazuh severity into the AiSOC ladder. Docs: [`apps/docs/docs/connectors/wazuh.md`](apps/docs/docs/connectors/wazuh.md). The connector registry now declares **78 first-party connectors**.- **auditd `file_tail` connector + `aisoc.rules` profile** — replaces the host-agent dependency for Linux endpoint visibility; 4 new detections pivot on the bundled `aisoc_*` audit keys. Docs: [`apps/docs/docs/connectors/auditd.md`](apps/docs/docs/connectors/auditd.md).- **Live Actions dispatcher** — generic vendor/capability surface so plugins can register executors against the in-tree taxonomy (`isolate_host`, `disable_user`, `block_ip`, …) without forking. Unknown pairs return a typed `LiveActionResult(FAILED, "executor_not_found")` — never a 500. Docs: [`apps/docs/docs/concepts/live-actions.md`](apps/docs/docs/concepts/live-actions.md).- **Deterministic NL → ES|QL / KQL / SPL translator** — replaces the template fallback in `/nl_query` with an IR + grammar validator; 50-pair gold eval set scores 100% syntactic, 100% semantic. Air-gapped by default; optional `gpt-4o-mini` enhancement falls back deterministically.@@ -76,7 +76,7 @@ This file mirrors what used to live in the "What's new" section of [`README.md`]- **Azure Container Apps + Postgres Flexible Server Terraform skeleton** — file-for-file mirror of the GCP skeleton for teams standardised on Azure. Container Apps for the three customer-visible services, VNet-integrated Postgres 16 + Azure Cache for Redis on private endpoints, Key Vault for secrets, ACR for images, and per-service user-assigned managed identities so each app pulls its own image and reads only its own secrets. Docs: [`apps/docs/docs/deployment/azure.md`](apps/docs/docs/deployment/azure.md).- **Blameless case post-mortem endpoint** — `GET /api/v1/cases/{case_id}/postmortem?format=json|html` produces a deterministic retrospective covering contributing factors, detection timing/gaps, response phases, blast radius, and action items. Analyst handles are explicitly redacted from the narrative. Docs: [`apps/docs/docs/operations/case-reports.md`](apps/docs/docs/operations/case-reports.md).- **Per-rule cross-fire FP gate** — `services/agents/tests/test_detection_fp_rate.py` replays every rule's `match_when` against every *other* rule's positive fixture; current corpus 816 native rules, worst FPR 0.49% (5% ceiling). Wired into `scripts/run_evals.py` as `suites.detection_fp_rate`.-- **Operator-facing documentation refresh** — new pages for [notifications](apps/docs/docs/operations/notifications.md), [plugin lifecycle](apps/docs/docs/plugins/lifecycle.md), and [credentials / vault rotation](apps/docs/docs/operations/credentials.md); v2.2 architecture diagram and the corrected **77-connector count** (now including Wazuh Indexer + auditd `file_tail`) rolled through every surface.+- **Operator-facing documentation refresh** — new pages for [notifications](apps/docs/docs/operations/notifications.md), [plugin lifecycle](apps/docs/docs/plugins/lifecycle.md), and [credentials / vault rotation](apps/docs/docs/operations/credentials.md); v2.2 architecture diagram and the corrected **78-connector count** (now including Wazuh Indexer + auditd `file_tail`) rolled through every surface.The full inventory (with file paths, env-var changes, and test counts) lives in the `[7.4.0]` section of [`CHANGELOG.md`](CHANGELOG.md).diff --git a/ROADMAP.md b/ROADMAP.mdindex fec24cc24..70794d892 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -437,7 +437,7 @@ Terraform skeleton equivalent to the existing AWS module.off `auditd_key` for sudoers / SSH / kernel-module / systemdtampering. 444-test full connectors suite green (excluding`test_scheduler.py` which needs the `apscheduler` dev dep).-- [x] Connector registry now declares **77 first-party connectors**;+- [x] Connector registry now declares **78 first-party connectors**;`pnpm marketplace:sync` rebuilt `marketplace/index.json` +`apps/web/public/marketplace/index.json`.diff --git a/apps/docs/docs/architecture.md b/apps/docs/docs/architecture.mdindex 0e5a4ac70..55bee68ec 100644--- a/apps/docs/docs/architecture.md+++ b/apps/docs/docs/architecture.md@@ -81,7 +81,7 @@ The v1.5 release ships from a review of G2, Gartner Peer Insights, and customer- **Automated compliance evidence** — `services/api/app/api/v1/endpoints/compliance.py` collects point-in-time evidence for SOC 2 / ISO 27001 / NIST CSF / PCI-DSS / HIPAA / DORA.- **AI-generated incident reports** — one-click "Export Report" on every case generates a PDF incident report from the Investigation Ledger.- **Air-gap deployment configuration** — `services/api/app/api/v1/endpoints/deployment.py` exposes air-gap mode toggles for tenants that disallow external feeds.-- **Connector catalog growth** — SentinelOne, Cortex XDR / XSIAM, Wiz, Snyk, Zscaler, Proofpoint, ServiceNow, Jira, 1Password, Duo Security, Carbon Black, Chronicle, Cisco Umbrella, CrowdStrike, Datadog Cloud SIEM, Elastic, Mimecast, Okta, Rapid7 InsightIDR, Salesforce, Microsoft Sentinel, Splunk, Sumo Logic, Tenable, Trellix Helix, Trend Vision One, and more. **The catalog is now 77 connectors** across EDR, SIEM, cloud, identity, SaaS, network, and email categories. See [Connectors](./connectors/).+- **Connector catalog growth** — SentinelOne, Cortex XDR / XSIAM, Wiz, Snyk, Zscaler, Proofpoint, ServiceNow, Jira, 1Password, Duo Security, Carbon Black, Chronicle, Cisco Umbrella, CrowdStrike, Datadog Cloud SIEM, Elastic, Mimecast, Okta, Rapid7 InsightIDR, Salesforce, Microsoft Sentinel, Splunk, Sumo Logic, Tenable, Trellix Helix, Trend Vision One, and more. **The catalog is now 78 connectors** across EDR, SIEM, cloud, identity, SaaS, network, and email categories. See [Connectors](./connectors/).## Connector polling and credential vaultdiff --git a/apps/docs/docs/connectors/api-coverage.md b/apps/docs/docs/connectors/api-coverage.mdindex 4c631a980..b38e00fd4 100644--- a/apps/docs/docs/connectors/api-coverage.md+++ b/apps/docs/docs/connectors/api-coverage.md@@ -27,7 +27,7 @@ This page is the canonical "what works where" reference. It is generated from thWhen a capability is not listed for a connector, the connector simply does not support it today — it is **not** a misconfiguration to surface. Adding a capability requires an explicit code change in that connector's `capabilities()` classmethod and matching method implementation.-## Coverage table — 77 connectors+## Coverage table — 78 connectorsThe matrix below is grouped by category. `OAuth (hosted)` indicates the connector is wired into the hosted OAuth marketplace flow (no client secret in tenant config). `Federated search` means the connector participates in the federated-query planner.diff --git a/apps/docs/docs/connectors/endpoint-decision-matrix.md b/apps/docs/docs/connectors/endpoint-decision-matrix.mdindex a833cc646..d1d832b34 100644--- a/apps/docs/docs/connectors/endpoint-decision-matrix.md+++ b/apps/docs/docs/connectors/endpoint-decision-matrix.md@@ -189,7 +189,7 @@ can ingest today.## Related-- [Connectors overview](/docs/connectors) — the full 77-connector catalog.+- [Connectors overview](/docs/connectors) — the full 78-connector catalog.- [Hello, connector tutorial](/docs/connectors/hello-connector) — write yourown if none of these fit.- [Detection coverage](/docs/detections/coverage) — which endpoint detectionsdiff --git a/apps/docs/docs/connectors/index.md b/apps/docs/docs/connectors/index.mdindex 9943f5a6a..1b244846d 100644--- a/apps/docs/docs/connectors/index.md+++ b/apps/docs/docs/connectors/index.md@@ -18,7 +18,7 @@ If your tool isn't in the catalog, see [Universal capture](/docs/connectors/univ## Catalog-The catalog ships with **77 connectors** out of the box, registered in [`services/connectors/app/connectors/__init__.py`](https://github.com/beenuar/AiSOC/blob/main/services/connectors/app/connectors/__init__.py). The list below is grouped by category; only a subset has dedicated walkthrough pages today (linked entries) — the rest follow the same schema-driven wizard described under [Adding a connector](#adding-a-connector).+The catalog ships with **78 connectors** out of the box, registered in [`services/connectors/app/connectors/__init__.py`](https://github.com/beenuar/AiSOC/blob/main/services/connectors/app/connectors/__init__.py). The list below is grouped by category; only a subset has dedicated walkthrough pages today (linked entries) — the rest follow the same schema-driven wizard described under [Adding a connector](#adding-a-connector).### Identitydiff --git a/apps/docs/docs/connectors/llm_usage.md b/apps/docs/docs/connectors/llm_usage.mdnew file mode 100644index 000000000..40d006924--- /dev/null+++ b/apps/docs/docs/connectors/llm_usage.md@@ -0,0 +1,35 @@+---+title: AI / LLM Usage Audit+description: Ingest OpenAI + Anthropic organization audit logs into AiSOC to govern AI adoption.+---++# AI / LLM Usage Audit++The **AI / LLM Usage Audit** connector (`llm_usage`, category `saas`) pulls+organization audit logs from OpenAI (`/v1/organization/audit_logs`) or Anthropic+and normalizes each into the AiSOC alert shape, mapping the event type onto the+five-tier severity ladder (`info | low | medium | high | critical`).++It is the governance surface for AI adoption — who created an API key, who was+granted owner, was audit logging or MFA turned off, was a project deleted — and+pairs with the built-in `llm-*` detection rules, which fire on the emitted+`event_type` (for example `openai.api_key.created`, `anthropic.member.added`).++## What you get++| Event family | Example `event_type` | Severity floor |+| --- | --- | --- |+| API key creation | `openai.api_key.created` | high |+| Owner/role grant | `openai.member.added` (role=owner) | high |+| Logging disabled | `openai.logging.setting.updated` (disabled) | critical |+| MFA disabled | `openai.mfa.*` (disabled) | critical |+| Project delete | `openai.project.archived` | medium |++## Setup++1. In **Connectors -> Add connector**, choose **AI / LLM Usage Audit**.+2. Pick the **provider** (OpenAI or Anthropic) and paste an **admin/audit-scoped API key** (stored in the credential vault, never in plaintext).+3. Click **Test connection**, then **Save**. The scheduler polls the audit log on the default cadence.++Events flow through ingest → Kafka → fusion, where the `llm-*` detections fire+and matching alerts are auto-triaged (copilot).diff --git a/apps/docs/docs/intro.md b/apps/docs/docs/intro.mdindex af439d7ae..6a55ca71f 100644--- a/apps/docs/docs/intro.md+++ b/apps/docs/docs/intro.md@@ -47,7 +47,7 @@ for the full list.## Capabilities-- **Click-and-connect cloud connectors** — pick from a **77-connector** catalog spanning EDR, SIEM, cloud, IAM, SaaS, VCS, network, ITSM, vuln, and email-security sources (CrowdStrike, SentinelOne, Cortex XDR, Splunk, Microsoft Sentinel, AWS Security Hub, Defender XDR, GCP Cloud Audit, GCP SCC, M365, Entra ID, Azure Activity, Google Workspace, Okta, Duo Security, Cloudflare, Tailscale, GitHub, Wiz, Snyk, Zscaler, Proofpoint, ServiceNow, Jira, 1Password, **Wazuh Indexer**, **auditd `file_tail`**, and 25 more — see [Architecture](./architecture)). Fill a schema-driven form, click `Test connection` for a live auth round-trip, and `Save & enable`. Secrets are encrypted at the application layer with a Fernet [`CredentialVault`](./operations/credentials) before they hit Postgres; an in-process APScheduler polls each enabled instance and pushes normalized OCSF events through to the ingest spine. Setup walkthroughs: [docs/connectors](./connectors).+- **Click-and-connect cloud connectors** — pick from a **78-connector** catalog spanning EDR, SIEM, cloud, IAM, SaaS, VCS, network, ITSM, vuln, and email-security sources (CrowdStrike, SentinelOne, Cortex XDR, Splunk, Microsoft Sentinel, AWS Security Hub, Defender XDR, GCP Cloud Audit, GCP SCC, M365, Entra ID, Azure Activity, Google Workspace, Okta, Duo Security, Cloudflare, Tailscale, GitHub, Wiz, Snyk, Zscaler, Proofpoint, ServiceNow, Jira, 1Password, **Wazuh Indexer**, **auditd `file_tail`**, and 25 more — see [Architecture](./architecture)). Fill a schema-driven form, click `Test connection` for a live auth round-trip, and `Save & enable`. Secrets are encrypted at the application layer with a Fernet [`CredentialVault`](./operations/credentials) before they hit Postgres; an in-process APScheduler polls each enabled instance and pushes normalized OCSF events through to the ingest spine. Setup walkthroughs: [docs/connectors](./connectors).- **Investigation Ledger** — every prompt, response, evidence citation, and tool call the agent emits is logged step-by-step and replayable on each case.- **Public eval harness** — alert reduction (a real measurement on a fixed noisy stream) plus MITRE-tactic, investigation-completeness, and response-quality substrate self-consistency gates. Reproducible with one command and run in CI on every PR. The [eval harness page](./benchmark) documents what each suite does and does not measure.- **Ambient Copilot** — context-aware next-action suggestions on every alert, case, rule, and playbook page; one click runs the right agent tool with the right payload.diff --git a/apps/docs/sidebars.ts b/apps/docs/sidebars.tsindex 1656c0c77..12c89363e 100644--- a/apps/docs/sidebars.ts+++ b/apps/docs/sidebars.ts@@ -99,6 +99,7 @@ const sidebars: SidebarsConfig = {"connectors/windows_event","connectors/zeek_suricata","connectors/syslog_cef",+ "connectors/llm_usage",],},{diff --git a/apps/web/public/marketplace/index.json b/apps/web/public/marketplace/index.jsonindex 88362830d..ab81c855e 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-07-13T06:00:03Z",+ "generated": "2026-07-13T06:13:47Z","categories": [{"id": "playbooks",@@ -20,22 +20,22 @@}],"stats": {- "total": 7137,+ "total": 7146,"playbooks": 62,- "detections": 7000,- "plugins": 75,- "verified": 1016,+ "detections": 7008,+ "plugins": 76,+ "verified": 1025,"community": 1,"by_tier": {"beta": 7,"community": 1,"imported": 6113,- "stable": 1016+ "stable": 1025},"detections_by_tier": {"community": 1,"imported": 6113,- "stable": 886+ "stable": 894},"quarantined": 5921},@@ -179,10 +179,10 @@"T1090.003": 11,"T1091": 5,"T1095": 8,- "T1098": 88,+ "T1098": 91,"T1098.001": 27,"T1098.002": 6,- "T1098.003": 34,+ "T1098.003": 35,"T1098.004": 12,"T1098.005": 7,"T1098.007": 1,@@ -224,7 +224,7 @@"T1136": 11,"T1136.001": 32,"T1136.002": 7,- "T1136.003": 24,+ "T1136.003": 25,"T1137": 11,"T1137.002": 2,"T1137.003": 1,@@ -287,7 +287,7 @@"T1484": 13,"T1484.001": 16,"T1484.002": 6,- "T1485": 83,+ "T1485": 84,"T1485.001": 2,"T1486": 27,"T1489": 38,@@ -390,7 +390,7 @@"T1555.003": 15,"T1555.004": 6,"T1555.005": 5,- "T1556": 72,+ "T1556": 73,"T1556.001": 1,"T1556.002": 3,"T1556.003": 1,@@ -420,7 +420,7 @@"T1562.004": 18,"T1562.006": 4,"T1562.007": 8,- "T1562.008": 32,+ "T1562.008": 33,"T1562.012": 5,"T1563.002": 4,"T1564": 14,@@ -536,7 +536,7 @@"T1690": 1},"unique_techniques": 493,- "total_with_mitre": 5784,+ "total_with_mitre": 5792,"by_tier": {"community": {"T1078.004": 1@@ -607,9 +607,9 @@"T1090": 3,"T1090.003": 6,"T1095": 3,- "T1098": 29,+ "T1098": 32,"T1098.001": 22,- "T1098.003": 8,+ "T1098.003": 9,"T1098.004": 8,"T1098.007": 1,"T1105": 3,@@ -627,7 +627,7 @@"T1135": 3,"T1136": 3,"T1136.001": 5,- "T1136.003": 2,+ "T1136.003": 3,"T1140": 1,"T1176": 1,"T1185": 1,@@ -655,7 +655,7 @@"T1482": 1,"T1484.001": 2,"T1484.002": 2,- "T1485": 28,+ "T1485": 29,"T1486": 8,"T1489": 2,"T1490": 7,@@ -717,7 +717,7 @@"T1555.003": 3,"T1555.004": 1,"T1555.005": 1,- "T1556": 41,+ "T1556": 42,"T1556.001": 1,"T1556.003": 1,"T1556.004": 1,@@ -737,7 +737,7 @@"T1562.004": 7,"T1562.006": 2,"T1562.007": 1,- "T1562.008": 13,+ "T1562.008": 14,"T1562.012": 2,"T1564.001": 1,"T1564.008": 1,@@ -30245,6 +30245,190 @@"enabled": true,"path": "detections/application/app-graphql-mutation-anonymous.yaml"},+ {+ "id": "det-application-071",+ "type": "detection",+ "name": "LLM Provider API Key Created",+ "description": "AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider API Key Created'. Watch the 2 documented false-positive cases before tuning.",+ "version": "1.0.0",+ "author": "AiSOC",+ "tags": [+ "tlp.white"+ ],+ "severity": "medium",+ "category": "application",+ "mitre_techniques": [+ "T1098"+ ],+ "log_source": "openai",+ "playbook": "tpl-account-compromise",+ "verified": true,+ "source": "core",+ "tier": "stable",+ "enabled": true,+ "path": "detections/application/llm-api-key-created.yaml"+ },+ {+ "id": "det-application-072",+ "type": "detection",+ "name": "LLM Provider Admin API Key Created",+ "description": "AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider Admin API Key Created'. Watch the 1 documented false-positive case before tuning.",+ "version": "1.0.0",+ "author": "AiSOC",+ "tags": [+ "tlp.white"+ ],+ "severity": "high",+ "category": "application",+ "mitre_techniques": [+ "T1098"+ ],+ "log_source": "openai",+ "playbook": "tpl-privilege-escalation",+ "verified": true,+ "source": "core",+ "tier": "stable",+ "enabled": true,+ "path": "detections/application/llm-admin-key-created.yaml"+ },+ {+ "id": "det-application-073",+ "type": "detection",+ "name": "LLM Provider Owner Role Granted",+ "description": "AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider Owner Role Granted'. Watch the 1 documented false-positive case before tuning.",+ "version": "1.0.0",+ "author": "AiSOC",+ "tags": [+ "tlp.white"+ ],+ "severity": "high",+ "category": "application",+ "mitre_techniques": [+ "T1098.003"+ ],+ "log_source": "openai",+ "playbook": "tpl-privilege-escalation",+ "verified": true,+ "source": "core",+ "tier": "stable",+ "enabled": true,+ "path": "detections/application/llm-member-added-owner.yaml"+ },+ {+ "id": "det-application-074",+ "type": "detection",+ "name": "LLM Provider Audit Logging Disabled",+ "description": "AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider Audit Logging Disabled'. Watch the 1 documented false-positive case before tuning.",+ "version": "1.0.0",+ "author": "AiSOC",+ "tags": [+ "tlp.white"+ ],+ "severity": "critical",+ "category": "application",+ "mitre_techniques": [+ "T1562.008"+ ],+ "log_source": "openai",+ "playbook": "tpl-defense-evasion",+ "verified": true,+ "source": "core",+ "tier": "stable",+ "enabled": true,+ "path": "detections/application/llm-logging-disabled.yaml"+ },+ {+ "id": "det-application-075",+ "type": "detection",+ "name": "LLM Provider MFA Requirement Disabled",+ "description": "AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider MFA Requirement Disabled'. Watch the 1 documented false-positive case before tuning.",+ "version": "1.0.0",+ "author": "AiSOC",+ "tags": [+ "tlp.white"+ ],+ "severity": "high",+ "category": "application",+ "mitre_techniques": [+ "T1556"+ ],+ "log_source": "openai",+ "playbook": "tpl-defense-evasion",+ "verified": true,+ "source": "core",+ "tier": "stable",+ "enabled": true,+ "path": "detections/application/llm-mfa-disabled.yaml"+ },+ {+ "id": "det-application-076",+ "type": "detection",+ "name": "Anthropic Workspace Created",+ "description": "AiSOC v1 curated detection. Triggers on the application signal described by 'Anthropic Workspace Created'. Watch the 1 documented false-positive case before tuning.",+ "version": "1.0.0",+ "author": "AiSOC",+ "tags": [+ "tlp.white"+ ],+ "severity": "low",+ "category": "application",+ "mitre_techniques": [+ "T1098"+ ],+ "log_source": "anthropic",+ "playbook": "tpl-triage",+ "verified": true,+ "source": "core",+ "tier": "stable",+ "enabled": true,+ "path": "detections/application/llm-anthropic-workspace-created.yaml"+ },+ {+ "id": "det-application-077",+ "type": "detection",+ "name": "LLM Provider Service Account Created",+ "description": "AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider Service Account Created'. Watch the 1 documented false-positive case before tuning.",+ "version": "1.0.0",+ "author": "AiSOC",+ "tags": [+ "tlp.white"+ ],+ "severity": "medium",+ "category": "application",+ "mitre_techniques": [+ "T1136.003"+ ],+ "log_source": "openai",+ "playbook": "tpl-persistence",+ "verified": true,+ "source": "core",+ "tier": "stable",+ "enabled": true,+ "path": "detections/application/llm-service-account-created.yaml"+ },+ {+ "id": "det-application-078",+ "type": "detection",+ "name": "LLM Provider Project Deleted",+ "description": "AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider Project Deleted'. Watch the 1 documented false-positive case before tuning.",+ "version": "1.0.0",+ "author": "AiSOC",+ "tags": [+ "tlp.white"+ ],+ "severity": "medium",+ "category": "application",+ "mitre_techniques": [+ "T1485"+ ],+ "log_source": "openai",+ "playbook": "tpl-triage",+ "verified": true,+ "source": "core",+ "tier": "stable",+ "enabled": true,+ "path": "detections/application/llm-project-deleted.yaml"+ },{"id": "det-cloud-001","type": "detection",@@ -224927,6 +225111,33 @@"tier": "stable","path": "plugins/lacework/plugin.yaml"},+ {+ "id": "llm-usage",+ "type": "plugin",+ "name": "AI / LLM Usage Audit Connector",+ "description": "Pull organization audit logs from OpenAI or Anthropic \u2014 API key creation, role grants, logging/MFA changes, project deletes. The governance surface for AI adoption; pairs with the llm-* detection rules that fire on the emitted event_type. Auth is an admin/audit-scoped API key.",+ "version": "1.0.0",+ "author": "AiSOC Core Team",+ "tags": [+ "saas",+ "ai",+ "llm",+ "openai",+ "anthropic",+ "audit",+ "connector"+ ],+ "plugin_type": "connector",+ "license": "MIT",+ "homepage": "https://github.com/beenuar/AiSOC/tree/main/services/connectors/app/connectors/llm_usage.py",+ "min_aisoc_version": "7.0.0",+ "sdks": [],+ "mitre_techniques": [],+ "verified": true,+ "source": "core",+ "tier": "stable",+ "path": "plugins/llm-usage/plugin.yaml"+ },{"id": "m365-audit","type": "plugin",diff --git a/apps/web/src/data/connector-count.json b/apps/web/src/data/connector-count.jsonindex 1acedb642..21ecb9571 100644--- a/apps/web/src/data/connector-count.json+++ b/apps/web/src/data/connector-count.json@@ -1,12 +1,12 @@{- "count": 77,+ "count": 78,"categories": {"cloud": 14,"edr": 10,"iam": 6,"ndr": 1,"network": 6,- "saas": 20,+ "saas": 21,"siem": 17,"vcs": 3},diff --git a/detections/application/llm-admin-key-created.yaml b/detections/application/llm-admin-key-created.yamlnew file mode 100644index 000000000..f1aae3ffb--- /dev/null+++ b/detections/application/llm-admin-key-created.yaml@@ -0,0 +1,24 @@+id: det-application-072+name: LLM Provider Admin API Key Created+description: AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider+ Admin API Key Created'. Watch the 1 documented false-positive case before tuning.+version: 1.0.0+severity: high+tags:+- mitre.attack.t1098+- tlp.white+category: application+log_source:+ product: openai+ service: audit+detection:+ condition: |+ event_type ENDSWITH ".api_key.created"+ AND key_scope == "admin"+false_positives:+- Documented break-glass admin key issuance+playbook: tpl-privilege-escalation+enabled: true+author: AiSOC+created: '2026-05-03'+modified: '2026-05-03'diff --git a/detections/application/llm-anthropic-workspace-created.yaml b/detections/application/llm-anthropic-workspace-created.yamlnew file mode 100644index 000000000..25474fdbf--- /dev/null+++ b/detections/application/llm-anthropic-workspace-created.yaml@@ -0,0 +1,23 @@+id: det-application-076+name: Anthropic Workspace Created+description: AiSOC v1 curated detection. Triggers on the application signal described by 'Anthropic Workspace+ Created'. Watch the 1 documented false-positive case before tuning.+version: 1.0.0+severity: low+tags:+- mitre.attack.t1098+- tlp.white+category: application+log_source:+ product: anthropic+ service: audit+detection:+ condition: |+ event_type == "anthropic.workspace.created"+false_positives:+- Planned workspace provisioning+playbook: tpl-triage+enabled: true+author: AiSOC+created: '2026-05-03'+modified: '2026-05-03'diff --git a/detections/application/llm-api-key-created.yaml b/detections/application/llm-api-key-created.yamlnew file mode 100644index 000000000..2817cdeff--- /dev/null+++ b/detections/application/llm-api-key-created.yaml@@ -0,0 +1,24 @@+id: det-application-071+name: LLM Provider API Key Created+description: AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider+ API Key Created'. Watch the 2 documented false-positive cases before tuning.+version: 1.0.0+severity: medium+tags:+- mitre.attack.t1098+- tlp.white+category: application+log_source:+ product: openai+ service: audit+detection:+ condition: |+ event_type ENDSWITH ".api_key.created"+false_positives:+- Planned key rotation (change ticket)+- New service onboarding+playbook: tpl-account-compromise+enabled: true+author: AiSOC+created: '2026-05-03'+modified: '2026-05-03'diff --git a/detections/application/llm-logging-disabled.yaml b/detections/application/llm-logging-disabled.yamlnew file mode 100644index 000000000..1eff2cdf8--- /dev/null+++ b/detections/application/llm-logging-disabled.yaml@@ -0,0 +1,24 @@+id: det-application-074+name: LLM Provider Audit Logging Disabled+description: AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider+ Audit Logging Disabled'. Watch the 1 documented false-positive case before tuning.+version: 1.0.0+severity: critical+tags:+- mitre.attack.t1562.008+- tlp.white+category: application+log_source:+ product: openai+ service: audit+detection:+ condition: |+ event_type CONTAINS "logging"+ AND action == "disabled"+false_positives:+- Vendor maintenance window (documented)+playbook: tpl-defense-evasion+enabled: true+author: AiSOC+created: '2026-05-03'+modified: '2026-05-03'diff --git a/detections/application/llm-member-added-owner.yaml b/detections/application/llm-member-added-owner.yamlnew file mode 100644index 000000000..46939d7ba--- /dev/null+++ b/detections/application/llm-member-added-owner.yaml@@ -0,0 +1,24 @@+id: det-application-073+name: LLM Provider Owner Role Granted+description: AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider+ Owner Role Granted'. Watch the 1 documented false-positive case before tuning.+version: 1.0.0+severity: high+tags:+- mitre.attack.t1098.003+- tlp.white+category: application+log_source:+ product: openai+ service: audit+detection:+ condition: |+ event_type ENDSWITH ".member.added"+ AND role == "owner"+false_positives:+- Approved org owner change+playbook: tpl-privilege-escalation+enabled: true+author: AiSOC+created: '2026-05-03'+modified: '2026-05-03'diff --git a/detections/application/llm-mfa-disabled.yaml b/detections/application/llm-mfa-disabled.yamlnew file mode 100644index 000000000..019e63d33--- /dev/null+++ b/detections/application/llm-mfa-disabled.yaml@@ -0,0 +1,24 @@+id: det-application-075+name: LLM Provider MFA Requirement Disabled+description: AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider+ MFA Requirement Disabled'. Watch the 1 documented false-positive case before tuning.+version: 1.0.0+severity: high+tags:+- mitre.attack.t1556+- tlp.white+category: application+log_source:+ product: openai+ service: audit+detection:+ condition: |+ event_type CONTAINS "mfa"+ AND action == "disabled"+false_positives:+- Approved auth-policy change+playbook: tpl-defense-evasion+enabled: true+author: AiSOC+created: '2026-05-03'+modified: '2026-05-03'diff --git a/detections/application/llm-project-deleted.yaml b/detections/application/llm-project-deleted.yamlnew file mode 100644index 000000000..4eafa9072--- /dev/null+++ b/detections/application/llm-project-deleted.yaml@@ -0,0 +1,23 @@+id: det-application-078+name: LLM Provider Project Deleted+description: AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider+ Project Deleted'. Watch the 1 documented false-positive case before tuning.+version: 1.0.0+severity: medium+tags:+- mitre.attack.t1485+- tlp.white+category: application+log_source:+ product: openai+ service: audit+detection:+ condition: |+ event_type ENDSWITH ".project.archived"+false_positives:+- Planned project decommission+playbook: tpl-triage+enabled: true+author: AiSOC+created: '2026-05-03'+modified: '2026-05-03'diff --git a/detections/application/llm-service-account-created.yaml b/detections/application/llm-service-account-created.yamlnew file mode 100644index 000000000..563aee42e--- /dev/null+++ b/detections/application/llm-service-account-created.yaml@@ -0,0 +1,23 @@+id: det-application-077+name: LLM Provider Service Account Created+description: AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider+ Service Account Created'. Watch the 1 documented false-positive case before tuning.+version: 1.0.0+severity: medium+tags:+- mitre.attack.t1136.003+- tlp.white+category: application+log_source:+ product: openai+ service: audit+detection:+ condition: |+ event_type ENDSWITH ".service_account.created"+false_positives:+- New automation onboarding (change ticket)+playbook: tpl-persistence+enabled: true+author: AiSOC+created: '2026-05-03'+modified: '2026-05-03'diff --git a/detections/fixtures/negative/llm-admin-key-created.json b/detections/fixtures/negative/llm-admin-key-created.jsonnew file mode 100644index 000000000..a5e29c98e--- /dev/null+++ b/detections/fixtures/negative/llm-admin-key-created.json@@ -0,0 +1,4 @@+{+ "event_type": ".api_key.created-x",+ "key_scope": "admin"+}diff --git a/detections/fixtures/negative/llm-anthropic-workspace-created.json b/detections/fixtures/negative/llm-anthropic-workspace-created.jsonnew file mode 100644index 000000000..7f6a7f7b3--- /dev/null+++ b/detections/fixtures/negative/llm-anthropic-workspace-created.json@@ -0,0 +1,3 @@+{+ "event_type": "not-anthropic.workspace.created"+}diff --git a/detections/fixtures/negative/llm-api-key-created.json b/detections/fixtures/negative/llm-api-key-created.jsonnew file mode 100644index 000000000..71dd3fc41--- /dev/null+++ b/detections/fixtures/negative/llm-api-key-created.json@@ -0,0 +1,3 @@+{+ "event_type": ".api_key.created-x"+}diff --git a/detections/fixtures/negative/llm-logging-disabled.json b/detections/fixtures/negative/llm-logging-disabled.jsonnew file mode 100644index 000000000..69044263a--- /dev/null+++ b/detections/fixtures/negative/llm-logging-disabled.json@@ -0,0 +1,4 @@+{+ "action": "disabled",+ "event_type": "__benign__"+}diff --git a/detections/fixtures/negative/llm-member-added-owner.json b/detections/fixtures/negative/llm-member-added-owner.jsonnew file mode 100644index 000000000..4b53c931e--- /dev/null+++ b/detections/fixtures/negative/llm-member-added-owner.json@@ -0,0 +1,4 @@+{+ "event_type": ".member.added-x",+ "role": "owner"+}diff --git a/detections/fixtures/negative/llm-mfa-disabled.json b/detections/fixtures/negative/llm-mfa-disabled.jsonnew file mode 100644index 000000000..69044263a--- /dev/null+++ b/detections/fixtures/negative/llm-mfa-disabled.json@@ -0,0 +1,4 @@+{+ "action": "disabled",+ "event_type": "__benign__"+}diff --git a/detections/fixtures/negative/llm-project-deleted.json b/detections/fixtures/negative/llm-project-deleted.jsonnew file mode 100644index 000000000..ad9c833c1--- /dev/null+++ b/detections/fixtures/negative/llm-project-deleted.json@@ -0,0 +1,3 @@+{+ "event_type": ".project.archived-x"+}diff --git a/detections/fixtures/negative/llm-service-account-created.json b/detections/fixtures/negative/llm-service-account-created.jsonnew file mode 100644index 000000000..35f5846ef--- /dev/null+++ b/detections/fixtures/negative/llm-service-account-created.json@@ -0,0 +1,3 @@+{+ "event_type": ".service_account.created-x"+}diff --git a/detections/fixtures/positive/llm-admin-key-created.json b/detections/fixtures/positive/llm-admin-key-created.jsonnew file mode 100644index 000000000..e8b8e3212--- /dev/null+++ b/detections/fixtures/positive/llm-admin-key-created.json@@ -0,0 +1,4 @@+{+ "event_type": "head-.api_key.created",+ "key_scope": "admin"+}diff --git a/detections/fixtures/positive/llm-anthropic-workspace-created.json b/detections/fixtures/positive/llm-anthropic-workspace-created.jsonnew file mode 100644index 000000000..9c0625c34--- /dev/null+++ b/detections/fixtures/positive/llm-anthropic-workspace-created.json@@ -0,0 +1,3 @@+{+ "event_type": "anthropic.workspace.created"+}diff --git a/detections/fixtures/positive/llm-api-key-created.json b/detections/fixtures/positive/llm-api-key-created.jsonnew file mode 100644index 000000000..41851f675--- /dev/null+++ b/detections/fixtures/positive/llm-api-key-created.json@@ -0,0 +1,3 @@+{+ "event_type": "head-.api_key.created"+}diff --git a/detections/fixtures/positive/llm-logging-disabled.json b/detections/fixtures/positive/llm-logging-disabled.jsonnew file mode 100644index 000000000..9d6c35b1d--- /dev/null+++ b/detections/fixtures/positive/llm-logging-disabled.json@@ -0,0 +1,4 @@+{+ "action": "disabled",+ "event_type": "prefix-logging-suffix"+}diff --git a/detections/fixtures/positive/llm-member-added-owner.json b/detections/fixtures/positive/llm-member-added-owner.jsonnew file mode 100644index 000000000..050ef956a--- /dev/null+++ b/detections/fixtures/positive/llm-member-added-owner.json@@ -0,0 +1,4 @@+{+ "event_type": "head-.member.added",+ "role": "owner"+}diff --git a/detections/fixtures/positive/llm-mfa-disabled.json b/detections/fixtures/positive/llm-mfa-disabled.jsonnew file mode 100644index 000000000..4d25efe35--- /dev/null+++ b/detections/fixtures/positive/llm-mfa-disabled.json@@ -0,0 +1,4 @@+{+ "action": "disabled",+ "event_type": "prefix-mfa-suffix"+}diff --git a/detections/fixtures/positive/llm-project-deleted.json b/detections/fixtures/positive/llm-project-deleted.jsonnew file mode 100644index 000000000..0517b4db3--- /dev/null+++ b/detections/fixtures/positive/llm-project-deleted.json@@ -0,0 +1,3 @@+{+ "event_type": "head-.project.archived"+}diff --git a/detections/fixtures/positive/llm-service-account-created.json b/detections/fixtures/positive/llm-service-account-created.jsonnew file mode 100644index 000000000..95473022d--- /dev/null+++ b/detections/fixtures/positive/llm-service-account-created.json@@ -0,0 +1,3 @@+{+ "event_type": "head-.service_account.created"+}diff --git a/docs/architecture/SYSTEM_DESIGN.md b/docs/architecture/SYSTEM_DESIGN.mdindex aadc4046a..95caff05f 100644--- a/docs/architecture/SYSTEM_DESIGN.md+++ b/docs/architecture/SYSTEM_DESIGN.md@@ -20,7 +20,7 @@ This document describes the end-to-end architecture of the AiSOC platform after┌─────────────────┐ ┌──────────────────────┐│ services/api │ │ services/connectors ││ inbox tokens + │ │ APScheduler poll │- │ HMAC webhooks │ │ 77 connector classes│+ │ HMAC webhooks │ │ 78 connector classes││ CEF / HEC / DNS│ │ push_case + status │└────────┬────────┘ └──────────┬───────────┘│ │@@ -91,7 +91,7 @@ This document describes the end-to-end architecture of the AiSOC platform after| `services/enrichment` | Go 1.21 | Per-IOC TTL-cached enrichment lookups | n/a || `services/fusion` | Python 3.11 | Simhash dedup → correlation → ML scoring → publish fused alerts | Background ML retrain on feedback || `services/api` | Python 3.11 | REST + WS, RBAC, case mgmt, rule engine, graph queries, ITSM webhook inbox, case fan-out | Schema migrations on boot |-| `services/connectors` | Python 3.11 | 77 connector classes, APScheduler poll, `push_case` / `push_status_change` for Jira & ServiceNow | CredentialVault decrypt at poll time |+| `services/connectors` | Python 3.11 | 78 connector classes, APScheduler poll, `push_case` / `push_status_change` for Jira & ServiceNow | CredentialVault decrypt at poll time || `services/agents` | Python 3.11 | LangGraph multi-agent investigation runs | Loads full ATT&CK STIX bundle on boot, optional Qdrant embed || `services/actions` | Python 3.11 | SOAR action execution with blast-radius gating | Approval workflows || `services/threatintel` | Python 3.11 | IOC/actor search API | APScheduler poll loop for TAXII/MISP/OTX/KEV |@@ -314,7 +314,7 @@ The following subsystems were added on top of the v2 design described above. The### 12.1 Connector Platform (`services/connectors`)-A first-class, in-process polling tier with **77 registered connector classes** spanning seven categories — `edr`, `siem`, `cloud`, `iam`, `saas`, `vcs`, `network`. Every connector subclasses `BaseConnector` and declares:+A first-class, in-process polling tier with **78 registered connector classes** spanning seven categories — `edr`, `siem`, `cloud`, `iam`, `saas`, `vcs`, `network`. Every connector subclasses `BaseConnector` and declares:* `schema()` — self-describing `ConnectorSchema(name, label, category, fields, oauth, default_poll_interval_seconds)` consumed by the web console for the connect form.* `capabilities()` — tuple of `Capability` enum values (`PULL_ALERTS`, `PUSH_CASE`, `PUSH_STATUS`, `FEDERATED_SEARCH`, …) that the orchestrator inspects at runtime.diff --git a/docs/audit/CLAIM_TO_GATE_MATRIX.md b/docs/audit/CLAIM_TO_GATE_MATRIX.mdindex fed4810eb..e7f4e4d7d 100644--- a/docs/audit/CLAIM_TO_GATE_MATRIX.md+++ b/docs/audit/CLAIM_TO_GATE_MATRIX.md@@ -47,10 +47,11 @@ Statuses: `GATED` (a CI job fails when the claim stops being true) · `PARTIAL`| Unified Data Explorer (NL + SQL across the lake) replaces the SIEM context-switch | README (data explorer) | `ci.yml` web-test job (`ExploreView.test.tsx` — NL question → `nl-query/translate` → `lake/sql` → BI table; raw-SQL run; source pivots to identity/graph/intel; error surfaced) + web-lint type-check | GATED | - || Autonomy posture is copilot-by-default with a visible per-action/blast scorecard | README (autopilot/copilot) | `ci.yml` web-test job (`AutonomyScorecard.test.tsx` — posture stays Copilot unless a high/critical-blast action auto-executes; distribution + override counts; rendered badge) | GATED | - || Broad SIEM/NDR/edge coverage (QRadar, Exabeam, Securonix, Devo, Netskope, Windows/Sysmon, Zeek/Suricata, syslog/CEF) | README (connector count) | `ci.yml` connectors job (`test_schemas.py` + `test_conformance.py` gate every connector; `test_siem_expansion.py` + `test_ndr_edge_expansion.py` pin each new connector's severity-ladder mapping) + `generate_connector_count.py --check` (registry-derived count, README phrase) | GATED | - |+| AI/LLM-usage governance: audit connector + detections + tiered lake storage | README (AI usage / storage) | `ci.yml` connectors job (`test_llm_usage.py` — OpenAI/Anthropic audit connector emits the dotted `event_type` the `llm-*` rules match) + `validate-detections.yml` (8 `llm-*` native rules replay) + api job (`test_storage_tiering.py` — hot/cold TTL-move policy + DDL gate; verified on live ClickHouse) | GATED | - |## Summary-- GATED: 28+- GATED: 29- PARTIAL: 10- NO GATE: 1 (progressively closed through Phases 2–11 and A1–A4: insecure-defaults, secret/IaC scanning, signed releases, cross-store isolation, DAC candidate-rule + imported-count honesty, connector live-test, OpenAPI breaking-change, ClickHouse lake population (A1), live-stream detection (A2), default cold-boot stack (A3), and the behavioral-model fusion (A4). The **last** NO GATE row — wet-eval live-agent scoreboard tables — closes in Phase 4c/E1, which needs a budgeted live-agent run)diff --git a/docs/connectors/conformance-matrix.md b/docs/connectors/conformance-matrix.mdindex e92c85698..2d93cdf75 100644--- a/docs/connectors/conformance-matrix.md+++ b/docs/connectors/conformance-matrix.md@@ -6,7 +6,7 @@> async coroutines, valid capabilities, secret fields marked `secret`).> Live-vendor sandbox smoke is a separate wave; this gates the contract.-**77 / 77 connectors conform** to the runtime contract.+**78 / 78 connectors conform** to the runtime contract.| connector | category | fields | vaulted | caps | test_connection | fetch_alerts | normalize ||-----------|----------|-------:|--------:|-----:|:---------------:|:------------:|:---------:|@@ -48,6 +48,7 @@| jira | saas | 3 | 1 | 3 | ✅ | ✅ | ✅ || kubernetes_audit | cloud | 5 | 1 | 2 | ✅ | ✅ | ✅ || lacework | cloud | 4 | 1 | 5 | ✅ | ✅ | ✅ |+| llm_usage | saas | 2 | 1 | 2 | ✅ | ✅ | ✅ || m365_audit | saas | 3 | 1 | 1 | ✅ | ✅ | ✅ || microsoft_sentinel | siem | 6 | 1 | 2 | ✅ | ✅ | ✅ || mimecast | saas | 3 | 1 | 4 | ✅ | ✅ | ✅ |diff --git a/docs/detections/truth-table.md b/docs/detections/truth-table.mdindex 147ac1ead..e91861f73 100644--- a/docs/detections/truth-table.md+++ b/docs/detections/truth-table.md@@ -15,8 +15,8 @@ provenance and coverage-mapping, not firing.| metric | count ||--------|------:|-| rules on disk (total) | 6975 |-| **executable (fire today)** | **939** |+| rules on disk (total) | 6983 |+| **executable (fire today)** | **947** || non-executable (provenance/coverage only) | 6036 |## By tier@@ -26,7 +26,7 @@ provenance and coverage-mapping, not firing.| car (imported) | 99 | 0 || chronicle (imported) | 877 | 0 || community | 1 | 1 |-| native | 861 | 861 |+| native | 869 | 869 || sigma (imported) | 3132 | 77 || splunk (imported) | 2005 | 0 |@@ -39,9 +39,9 @@ provenance and coverage-mapping, not firing.## How to read the README claim-The imported corpus is large (6975 rules on disk) and valuable as a+The imported corpus is large (6983 rules on disk) and valuable as aprovenance-tracked ATT&CK-mapped library, but the number that matters-operationally is **939 executable rules** — the ones the engine+operationally is **947 executable rules** — the ones the enginefires against live telemetry. The README and marketplace must cite theexecutable figure when describing detection *coverage*, and may cite theon-disk figure only when explicitly describing the imported *library*.diff --git a/marketplace/index.json b/marketplace/index.jsonindex 88362830d..ab81c855e 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-07-13T06:00:03Z",+ "generated": "2026-07-13T06:13:47Z","categories": [{"id": "playbooks",@@ -20,22 +20,22 @@}],"stats": {- "total": 7137,+ "total": 7146,"playbooks": 62,- "detections": 7000,- "plugins": 75,- "verified": 1016,+ "detections": 7008,+ "plugins": 76,+ "verified": 1025,"community": 1,"by_tier": {"beta": 7,"community": 1,"imported": 6113,- "stable": 1016+ "stable": 1025},"detections_by_tier": {"community": 1,"imported": 6113,- "stable": 886+ "stable": 894},"quarantined": 5921},@@ -179,10 +179,10 @@"T1090.003": 11,"T1091": 5,"T1095": 8,- "T1098": 88,+ "T1098": 91,"T1098.001": 27,"T1098.002": 6,- "T1098.003": 34,+ "T1098.003": 35,"T1098.004": 12,"T1098.005": 7,"T1098.007": 1,@@ -224,7 +224,7 @@"T1136": 11,"T1136.001": 32,"T1136.002": 7,- "T1136.003": 24,+ "T1136.003": 25,"T1137": 11,"T1137.002": 2,"T1137.003": 1,@@ -287,7 +287,7 @@"T1484": 13,"T1484.001": 16,"T1484.002": 6,- "T1485": 83,+ "T1485": 84,"T1485.001": 2,"T1486": 27,"T1489": 38,@@ -390,7 +390,7 @@"T1555.003": 15,"T1555.004": 6,"T1555.005": 5,- "T1556": 72,+ "T1556": 73,"T1556.001": 1,"T1556.002": 3,"T1556.003": 1,@@ -420,7 +420,7 @@"T1562.004": 18,"T1562.006": 4,"T1562.007": 8,- "T1562.008": 32,+ "T1562.008": 33,"T1562.012": 5,"T1563.002": 4,"T1564": 14,@@ -536,7 +536,7 @@"T1690": 1},"unique_techniques": 493,- "total_with_mitre": 5784,+ "total_with_mitre": 5792,"by_tier": {"community": {"T1078.004": 1@@ -607,9 +607,9 @@"T1090": 3,"T1090.003": 6,"T1095": 3,- "T1098": 29,+ "T1098": 32,"T1098.001": 22,- "T1098.003": 8,+ "T1098.003": 9,"T1098.004": 8,"T1098.007": 1,"T1105": 3,@@ -627,7 +627,7 @@"T1135": 3,"T1136": 3,"T1136.001": 5,- "T1136.003": 2,+ "T1136.003": 3,"T1140": 1,"T1176": 1,"T1185": 1,@@ -655,7 +655,7 @@"T1482": 1,"T1484.001": 2,"T1484.002": 2,- "T1485": 28,+ "T1485": 29,"T1486": 8,"T1489": 2,"T1490": 7,@@ -717,7 +717,7 @@"T1555.003": 3,"T1555.004": 1,"T1555.005": 1,- "T1556": 41,+ "T1556": 42,"T1556.001": 1,"T1556.003": 1,"T1556.004": 1,@@ -737,7 +737,7 @@"T1562.004": 7,"T1562.006": 2,"T1562.007": 1,- "T1562.008": 13,+ "T1562.008": 14,"T1562.012": 2,"T1564.001": 1,"T1564.008": 1,@@ -30245,6 +30245,190 @@"enabled": true,"path": "detections/application/app-graphql-mutation-anonymous.yaml"},+ {+ "id": "det-application-071",+ "type": "detection",+ "name": "LLM Provider API Key Created",+ "description": "AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider API Key Created'. Watch the 2 documented false-positive cases before tuning.",+ "version": "1.0.0",+ "author": "AiSOC",+ "tags": [+ "tlp.white"+ ],+ "severity": "medium",+ "category": "application",+ "mitre_techniques": [+ "T1098"+ ],+ "log_source": "openai",+ "playbook": "tpl-account-compromise",+ "verified": true,+ "source": "core",+ "tier": "stable",+ "enabled": true,+ "path": "detections/application/llm-api-key-created.yaml"+ },+ {+ "id": "det-application-072",+ "type": "detection",+ "name": "LLM Provider Admin API Key Created",+ "description": "AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider Admin API Key Created'. Watch the 1 documented false-positive case before tuning.",+ "version": "1.0.0",+ "author": "AiSOC",+ "tags": [+ "tlp.white"+ ],+ "severity": "high",+ "category": "application",+ "mitre_techniques": [+ "T1098"+ ],+ "log_source": "openai",+ "playbook": "tpl-privilege-escalation",+ "verified": true,+ "source": "core",+ "tier": "stable",+ "enabled": true,+ "path": "detections/application/llm-admin-key-created.yaml"+ },+ {+ "id": "det-application-073",+ "type": "detection",+ "name": "LLM Provider Owner Role Granted",+ "description": "AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider Owner Role Granted'. Watch the 1 documented false-positive case before tuning.",+ "version": "1.0.0",+ "author": "AiSOC",+ "tags": [+ "tlp.white"+ ],+ "severity": "high",+ "category": "application",+ "mitre_techniques": [+ "T1098.003"+ ],+ "log_source": "openai",+ "playbook": "tpl-privilege-escalation",+ "verified": true,+ "source": "core",+ "tier": "stable",+ "enabled": true,+ "path": "detections/application/llm-member-added-owner.yaml"+ },+ {+ "id": "det-application-074",+ "type": "detection",+ "name": "LLM Provider Audit Logging Disabled",+ "description": "AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider Audit Logging Disabled'. Watch the 1 documented false-positive case before tuning.",+ "version": "1.0.0",+ "author": "AiSOC",+ "tags": [+ "tlp.white"+ ],+ "severity": "critical",+ "category": "application",+ "mitre_techniques": [+ "T1562.008"+ ],+ "log_source": "openai",+ "playbook": "tpl-defense-evasion",+ "verified": true,+ "source": "core",+ "tier": "stable",+ "enabled": true,+ "path": "detections/application/llm-logging-disabled.yaml"+ },+ {+ "id": "det-application-075",+ "type": "detection",+ "name": "LLM Provider MFA Requirement Disabled",+ "description": "AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider MFA Requirement Disabled'. Watch the 1 documented false-positive case before tuning.",+ "version": "1.0.0",+ "author": "AiSOC",+ "tags": [+ "tlp.white"+ ],+ "severity": "high",+ "category": "application",+ "mitre_techniques": [+ "T1556"+ ],+ "log_source": "openai",+ "playbook": "tpl-defense-evasion",+ "verified": true,+ "source": "core",+ "tier": "stable",+ "enabled": true,+ "path": "detections/application/llm-mfa-disabled.yaml"+ },+ {+ "id": "det-application-076",+ "type": "detection",+ "name": "Anthropic Workspace Created",+ "description": "AiSOC v1 curated detection. Triggers on the application signal described by 'Anthropic Workspace Created'. Watch the 1 documented false-positive case before tuning.",+ "version": "1.0.0",+ "author": "AiSOC",+ "tags": [+ "tlp.white"+ ],+ "severity": "low",+ "category": "application",+ "mitre_techniques": [+ "T1098"+ ],+ "log_source": "anthropic",+ "playbook": "tpl-triage",+ "verified": true,+ "source": "core",+ "tier": "stable",+ "enabled": true,+ "path": "detections/application/llm-anthropic-workspace-created.yaml"+ },+ {+ "id": "det-application-077",+ "type": "detection",+ "name": "LLM Provider Service Account Created",+ "description": "AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider Service Account Created'. Watch the 1 documented false-positive case before tuning.",+ "version": "1.0.0",+ "author": "AiSOC",+ "tags": [+ "tlp.white"+ ],+ "severity": "medium",+ "category": "application",+ "mitre_techniques": [+ "T1136.003"+ ],+ "log_source": "openai",+ "playbook": "tpl-persistence",+ "verified": true,+ "source": "core",+ "tier": "stable",+ "enabled": true,+ "path": "detections/application/llm-service-account-created.yaml"+ },+ {+ "id": "det-application-078",+ "type": "detection",+ "name": "LLM Provider Project Deleted",+ "description": "AiSOC v1 curated detection. Triggers on the application signal described by 'LLM Provider Project Deleted'. Watch the 1 documented false-positive case before tuning.",+ "version": "1.0.0",+ "author": "AiSOC",+ "tags": [+ "tlp.white"+ ],+ "severity": "medium",+ "category": "application",+ "mitre_techniques": [+ "T1485"+ ],+ "log_source": "openai",+ "playbook": "tpl-triage",+ "verified": true,+ "source": "core",+ "tier": "stable",+ "enabled": true,+ "path": "detections/application/llm-project-deleted.yaml"+ },{"id": "det-cloud-001","type": "detection",@@ -224927,6 +225111,33 @@"tier": "stable","path": "plugins/lacework/plugin.yaml"},+ {+ "id": "llm-usage",+ "type": "plugin",+ "name": "AI / LLM Usage Audit Connector",+ "description": "Pull organization audit logs from OpenAI or Anthropic \u2014 API key creation, role grants, logging/MFA changes, project deletes. The governance surface for AI adoption; pairs with the llm-* detection rules that fire on the emitted event_type. Auth is an admin/audit-scoped API key.",+ "version": "1.0.0",+ "author": "AiSOC Core Team",+ "tags": [+ "saas",+ "ai",+ "llm",+ "openai",+ "anthropic",+ "audit",+ "connector"+ ],+ "plugin_type": "connector",+ "license": "MIT",+ "homepage": "https://github.com/beenuar/AiSOC/tree/main/services/connectors/app/connectors/llm_usage.py",+ "min_aisoc_version": "7.0.0",+ "sdks": [],+ "mitre_techniques": [],+ "verified": true,+ "source": "core",+ "tier": "stable",+ "path": "plugins/llm-usage/plugin.yaml"+ },{"id": "m365-audit","type": "plugin",diff --git a/plugins/llm-usage/plugin.yaml b/plugins/llm-usage/plugin.yamlnew file mode 100644index 000000000..79c0f203a--- /dev/null+++ b/plugins/llm-usage/plugin.yaml@@ -0,0 +1,21 @@+id: llm-usage+name: AI / LLM Usage Audit Connector+version: "1.0.0"+plugin_type: connector+tier: stable+description: >+ Pull organization audit logs from OpenAI or Anthropic — API key creation,+ role grants, logging/MFA changes, project deletes. The governance surface for+ AI adoption; pairs with the llm-* detection rules that fire on the emitted+ event_type. Auth is an admin/audit-scoped API key.+author: AiSOC Core Team+tags: [saas, ai, llm, openai, anthropic, audit, connector]+homepage: https://github.com/beenuar/AiSOC/tree/main/services/connectors/app/connectors/llm_usage.py+license: MIT+min_aisoc_version: "7.0.0"+config_schema:+ type: object+ required: [provider, api_key]+ properties:+ provider: {type: string, enum: [openai, anthropic], description: Which provider's audit log to pull.}+ api_key: {type: string, secret: true, description: Admin/audit-scoped API key.}diff --git a/scripts/detection_specs_part3_application.py b/scripts/detection_specs_part3_application.pyindex 7b7aed823..6c7ffe5a1 100644--- a/scripts/detection_specs_part3_application.py+++ b/scripts/detection_specs_part3_application.py@@ -203,6 +203,53 @@ API_RULES: list[dict] = []+# ---------------------------------------------------------------------------+# AI / LLM-usage audit rules (Phase D2)+#+# The AI/LLM-usage audit connector (services/connectors/app/connectors/+# llm_usage.py) pulls OpenAI + Anthropic org audit logs and emits events with+# a top-level ``event_type`` like ``openai.api_key.created`` /+# ``anthropic.member.added``. These rules turn the high-signal ones into+# detections — the SaaS-AI governance surface the leading platforms emphasise.+# ---------------------------------------------------------------------------+LLM_USAGE_RULES: list[dict] = [+ S(slug="llm-api-key-created", name="LLM Provider API Key Created",+ severity="medium", mitre=["t1098"], product="openai", service="audit",+ when={"event_type_endswith": ".api_key.created"},+ fp=["Planned key rotation (change ticket)", "New service onboarding"],+ playbook="tpl-account-compromise"),+ S(slug="llm-admin-key-created", name="LLM Provider Admin API Key Created",+ severity="high", mitre=["t1098"], product="openai", service="audit",+ when={"event_type_endswith": ".api_key.created", "key_scope": "admin"},+ fp=["Documented break-glass admin key issuance"],+ playbook="tpl-privilege-escalation"),+ S(slug="llm-member-added-owner", name="LLM Provider Owner Role Granted",+ severity="high", mitre=["t1098.003"], product="openai", service="audit",+ when={"event_type_endswith": ".member.added", "role": "owner"},+ fp=["Approved org owner change"], playbook="tpl-privilege-escalation"),+ S(slug="llm-logging-disabled", name="LLM Provider Audit Logging Disabled",+ severity="critical", mitre=["t1562.008"], product="openai", service="audit",+ when={"event_type_contains": "logging", "action": "disabled"},+ fp=["Vendor maintenance window (documented)"], playbook="tpl-defense-evasion"),+ S(slug="llm-mfa-disabled", name="LLM Provider MFA Requirement Disabled",+ severity="high", mitre=["t1556"], product="openai", service="audit",+ when={"event_type_contains": "mfa", "action": "disabled"},+ fp=["Approved auth-policy change"], playbook="tpl-defense-evasion"),+ S(slug="llm-anthropic-workspace-created", name="Anthropic Workspace Created",+ severity="low", mitre=["t1098"], product="anthropic", service="audit",+ when={"event_type": "anthropic.workspace.created"},+ fp=["Planned workspace provisioning"], playbook="tpl-triage"),+ S(slug="llm-service-account-created", name="LLM Provider Service Account Created",+ severity="medium", mitre=["t1136.003"], product="openai", service="audit",+ when={"event_type_endswith": ".service_account.created"},+ fp=["New automation onboarding (change ticket)"], playbook="tpl-persistence"),+ S(slug="llm-project-deleted", name="LLM Provider Project Deleted",+ severity="medium", mitre=["t1485"], product="openai", service="audit",+ when={"event_type_endswith": ".project.archived"},+ fp=["Planned project decommission"], playbook="tpl-triage"),+]++# ---------------------------------------------------------------------------# Aggregate# ---------------------------------------------------------------------------@@ -211,6 +258,7 @@ APPLICATION_EXTRA: list[dict] = (+ DEVOPS_RULES+ SAAS_RULES+ API_RULES+ + LLM_USAGE_RULES)@@ -220,4 +268,5 @@ __all__ = ["DEVOPS_RULES","SAAS_RULES","API_RULES",+ "LLM_USAGE_RULES",]diff --git a/services/api/clickhouse/tiering/002_tiering.sql b/services/api/clickhouse/tiering/002_tiering.sqlnew file mode 100644index 000000000..ff238221f--- /dev/null+++ b/services/api/clickhouse/tiering/002_tiering.sql@@ -0,0 +1,23 @@+-- Phase D2 — hot/warm/cold tiering for the event lake.+--+-- OPT-IN. Apply AFTER mounting tiering/storage-policy.xml into+-- /etc/clickhouse-server/config.d/ (so the `tiered` storage policy exists) and+-- AFTER 001_init.sql has created aisoc.raw_events. Applying it without the+-- storage policy will error, which is why it is NOT in the init path.+--+-- What it does:+-- * Rebinds aisoc.raw_events onto the `tiered` storage policy.+-- * Extends the TTL into a tiered lifecycle: rows stay on the hot (NVMe)+-- volume for 30 days, MOVE to the cold (object/NAS) volume for days 30-90,+-- then DELETE at 90 days. The hot window keeps hunt/Explore latency low;+-- the cold window keeps 90-day retention cheap.+--+-- Cost model: docs/decisions/storage-cost-model.json + scripts/storage_cost_model.py.++ALTER TABLE aisoc.raw_events+ MODIFY SETTING storage_policy = 'tiered';++ALTER TABLE aisoc.raw_events+ MODIFY TTL+ toDateTime(event_time) + INTERVAL 30 DAY TO VOLUME 'cold',+ toDateTime(event_time) + INTERVAL 90 DAY DELETE;diff --git a/services/api/clickhouse/tiering/storage-policy.xml b/services/api/clickhouse/tiering/storage-policy.xmlnew file mode 100644index 000000000..04d32869f--- /dev/null+++ b/services/api/clickhouse/tiering/storage-policy.xml@@ -0,0 +1,47 @@+<?xml version="1.0"?>+<!--+ Phase D2 — hot/warm/cold storage tiering for the AiSOC event lake.++ OPT-IN: this file is deliberately NOT under `/docker-entrypoint-initdb.d`+ (it lives in a `tiering/` subdir, not the init path) because `TTL ... TO+ VOLUME 'cold'` requires the multi-disk policy below to exist first — applying+ it against a single-disk ClickHouse would fail container init. To enable+ tiering, mount this fragment into `/etc/clickhouse-server/config.d/` and point+ the `cold` disk at your object store (S3/GCS), then apply `002_tiering.sql`.++ Model (see docs/decisions/0005-storage-consolidation.md + storage_cost_model.py):+ * hot — local NVMe MergeTree, 0-30 days, query-latency tier+ * cold — S3/GCS-backed disk, 30-90 days (moved by TTL), cheap archive+ * delete at 90 days (existing raw_events TTL)+-->+<clickhouse>+ <storage_configuration>+ <disks>+ <!-- Hot uses the built-in `default` disk (local NVMe); we only declare+ the cold disk. Replace the cold <type>local</type> + path with+ <type>s3</type> + endpoint/access_key/secret_access_key for real+ object offload. The local path here keeps the policy valid out of+ the box for on-prem NAS-backed cold tiers. -->+ <cold>+ <type>local</type>+ <path>/var/lib/clickhouse/cold/</path>+ </cold>+ </disks>+ <policies>+ <tiered>+ <volumes>+ <!-- The first volume keeps the name `default` so an existing table on+ the built-in `default` policy can be rebound to `tiered` (CH+ requires the new policy to contain the old policy's volume). -->+ <default>+ <disk>default</disk>+ </default>+ <cold>+ <disk>cold</disk>+ </cold>+ </volumes>+ <move_factor>0.1</move_factor>+ </tiered>+ </policies>+ </storage_configuration>+</clickhouse>diff --git a/services/api/tests/test_storage_tiering.py b/services/api/tests/test_storage_tiering.pynew file mode 100644index 000000000..2ea102826--- /dev/null+++ b/services/api/tests/test_storage_tiering.py@@ -0,0 +1,48 @@+"""Phase D2 — event-lake storage-tiering config gate.++The hot/warm/cold tiering artifacts (storage-policy.xml + 002_tiering.sql) are+opt-in and applied against a live ClickHouse, so they can't be unit-executed+here. This static gate catches the drift/typos that would silently break them:+the XML must be well-formed and declare the `tiered` policy with the `default`+(hot) + `cold` volumes, and the DDL must rebind the lake to `tiered` and set a+TTL that MOVEs to the cold volume then DELETEs. Verified end-to-end against+ClickHouse 23.8 during development (policy loads, table rebinds, TTL applied).+"""++from __future__ import annotations++import xml.etree.ElementTree as ET+from pathlib import Path++_TIERING = Path(__file__).resolve().parents[1] / "clickhouse" / "tiering"+_POLICY = _TIERING / "storage-policy.xml"+_DDL = _TIERING / "002_tiering.sql"+++def test_storage_policy_xml_is_well_formed_and_declares_tiered():+ root = ET.fromstring(_POLICY.read_text(encoding="utf-8"))+ sc = root.find("storage_configuration")+ assert sc is not None, "missing <storage_configuration>"+ policies = sc.find("policies")+ tiered = policies.find("tiered")+ assert tiered is not None, "missing <tiered> policy"+ volumes = tiered.find("volumes")+ vol_names = {child.tag for child in volumes}+ # The first volume must keep the name `default` so an existing table on the+ # built-in default policy can be rebound (CH requires the old volume name).+ assert "default" in vol_names, f"tiered policy must keep a `default` volume; got {vol_names}"+ assert "cold" in vol_names, f"tiered policy must define a `cold` volume; got {vol_names}"+ # Cold disk must be declared.+ disks = {child.tag for child in sc.find("disks")}+ assert "cold" in disks+++def test_tiering_ddl_rebinds_and_moves_to_cold():+ sql = _DDL.read_text(encoding="utf-8")+ assert "storage_policy = 'tiered'" in sql+ assert "TO VOLUME 'cold'" in sql+ assert "DELETE" in sql+ assert "aisoc.raw_events" in sql+ # 30-day hot window, 90-day retention (matches the cost model / ADR 0005).+ assert "30 DAY" in sql+ assert "90 DAY" in sqldiff --git a/services/connectors/app/connectors/__init__.py b/services/connectors/app/connectors/__init__.pyindex 58780869f..9d7f41583 100644--- a/services/connectors/app/connectors/__init__.py+++ b/services/connectors/app/connectors/__init__.py@@ -55,6 +55,7 @@ from app.connectors.google_workspace import GoogleWorkspaceConnectorfrom app.connectors.jira_connector import JiraConnectorfrom app.connectors.kubernetes_audit import KubernetesAuditConnectorfrom app.connectors.lacework import LaceworkConnector+from app.connectors.llm_usage import LlmUsageConnectorfrom app.connectors.m365_audit import M365AuditConnectorfrom app.connectors.microsoft_sentinel import MicrosoftSentinelConnectorfrom app.connectors.mimecast import MimecastConnector@@ -140,6 +141,7 @@ _CONNECTOR_CLASSES: tuple[type[BaseConnector], ...] = (JiraConnector,KubernetesAuditConnector,LaceworkConnector,+ LlmUsageConnector,M365AuditConnector,MicrosoftSentinelConnector,MimecastConnector,diff --git a/services/connectors/app/connectors/llm_usage.py b/services/connectors/app/connectors/llm_usage.pynew file mode 100644index 000000000..aa041f212--- /dev/null+++ b/services/connectors/app/connectors/llm_usage.py@@ -0,0 +1,148 @@+"""AI / LLM-usage audit connector (OpenAI + Anthropic org audit logs).++Pulls **organization audit logs** from OpenAI (`GET /v1/organization/audit_logs`)+or Anthropic (admin audit API) and folds each into the common AiSOC alert shape.+This is the governance surface for AI adoption: who created an API key, who was+granted owner, was audit logging or MFA turned off, was a project deleted. It+pairs with the Phase D2 `llm-*` detection rules, which fire on the emitted+`event_type` (e.g. `openai.api_key.created`, `anthropic.member.added`).++A `provider` selector chooses the stream; auth is an admin/audit-scoped API key.+Severity is derived from the event type — key/role/logging/MFA changes are the+high-signal ones a SOC wants surfaced above routine usage.+"""++from __future__ import annotations++from typing import Any++import httpx+import structlog++from app.connectors.base import BaseConnector, Capability, ConnectorSchema, Field++logger = structlog.get_logger()++_LIMIT = 100+_OPENAI_BASE = "https://api.openai.com/v1/organization/audit_logs"+_ANTHROPIC_BASE = "https://api.anthropic.com/v1/organizations/audit_logs"++# event_type fragment -> severity floor.+_HIGH = ("api_key.created", "member.added", "invite", "service_account.created")+_CRITICAL = ("logging", "mfa")+++class LlmUsageConnector(BaseConnector):+ """OpenAI / Anthropic organization audit logs."""++ connector_id = "llm_usage"+ connector_name = "AI / LLM Usage Audit"+ connector_category = "saas"++ @classmethod+ def schema(cls) -> ConnectorSchema:+ return ConnectorSchema(+ connector_id=cls.connector_id,+ connector_name=cls.connector_name,+ category=cls.connector_category,+ description=(+ "Pull organization audit logs from OpenAI or Anthropic — API "+ "key creation, role grants, logging/MFA changes, project "+ "deletes. Pairs with the llm-* detection rules. Auth is an "+ "admin/audit-scoped API key."+ ),+ docs_url="/docs/connectors/llm_usage",+ fields=[+ Field(+ "provider",+ "select",+ "Provider",+ options=[+ {"value": "openai", "label": "OpenAI"},+ {"value": "anthropic", "label": "Anthropic"},+ ],+ ),+ Field("api_key", "secret", "Admin / Audit API Key"),+ ],+ )++ @classmethod+ def capabilities(cls) -> tuple[Capability, ...]:+ return (Capability.PULL_AUDIT, Capability.READ_AUDIT_TRAIL)++ def __init__(self, provider: str, api_key: str) -> None:+ provider = (provider or "").lower()+ if provider not in ("openai", "anthropic"):+ raise ValueError(f"llm_usage: unknown provider '{provider}' (need 'openai' or 'anthropic')")+ self._provider = provider+ self._api_key = api_key++ def _endpoint(self) -> str:+ return _OPENAI_BASE if self._provider == "openai" else _ANTHROPIC_BASE++ def _headers(self) -> dict[str, str]:+ if self._provider == "openai":+ return {"Authorization": f"Bearer {self._api_key}", "Accept": "application/json"}+ return {"x-api-key": self._api_key, "anthropic-version": "2023-06-01", "Accept": "application/json"}++ async def test_connection(self) -> dict[str, Any]:+ try:+ async with httpx.AsyncClient(timeout=15.0) as client:+ resp = await client.get(self._endpoint(), headers=self._headers(), params={"limit": 1})+ if resp.status_code == 200:+ return {"success": True, "connector": self.connector_id, "provider": self._provider}+ return {"success": False, "connector": self.connector_id, "error": f"HTTP {resp.status_code}"}+ except Exception as exc: # noqa: BLE001+ return {"success": False, "connector": self.connector_id, "error": str(exc)}++ async def fetch_alerts(self, since_seconds: int = 300) -> list[dict[str, Any]]:+ out: list[dict[str, Any]] = []+ try:+ import time # noqa: PLC0415++ since = int(time.time() - since_seconds)+ params = {"limit": _LIMIT}+ if self._provider == "openai":+ params["effective_at[gte]"] = since+ async with httpx.AsyncClient(timeout=30.0) as client:+ resp = await client.get(self._endpoint(), headers=self._headers(), params=params)+ if resp.status_code != 200:+ logger.warning("llm_usage.fetch_failed", provider=self._provider, status=resp.status_code)+ return out+ body = resp.json() or {}+ for ev in body.get("data") or []:+ out.append(self.normalize(ev))+ except Exception as exc: # noqa: BLE001+ logger.warning("llm_usage.fetch_error", error=str(exc))+ return out++ def _event_type(self, raw: dict[str, Any]) -> str:+ # OpenAI: raw["type"] e.g. "api_key.created"; Anthropic: raw["action"].+ vendor_type = str(raw.get("type") or raw.get("action") or raw.get("event_type") or "event")+ return f"{self._provider}.{vendor_type}"++ def normalize(self, raw: dict[str, Any]) -> dict[str, Any]:+ event_type = self._event_type(raw)+ low = event_type.lower()+ severity = "info"+ if any(h in low for h in _HIGH):+ severity = "high"+ if any(c in low for c in _CRITICAL):+ severity = "critical"+ actor = raw.get("actor") or {}+ actor_email = (actor.get("email") if isinstance(actor, dict) else None) or raw.get("actor_email")+ return {+ "source": self.connector_id,+ "category": self.connector_category,+ "severity": severity,+ "title": f"{self._provider.capitalize()} audit: {event_type.split('.', 1)[-1]}",+ "description": f"provider={self._provider}; event_type={event_type}; actor={actor_email}",+ "external_id": str(raw.get("id") or ""),+ # Emit the dotted event_type at the TOP LEVEL so the llm-* detection+ # rules (which match on `event_type`) fire against raw_data.+ "event_type": event_type,+ "actor": actor_email,+ "actor_email": actor_email,+ "created_at": raw.get("effective_at") or raw.get("occurred_at") or raw.get("timestamp"),+ "raw": raw,+ }diff --git a/services/connectors/tests/connectors/test_llm_usage.py b/services/connectors/tests/connectors/test_llm_usage.pynew file mode 100644index 000000000..ec22531b4--- /dev/null+++ b/services/connectors/tests/connectors/test_llm_usage.py@@ -0,0 +1,63 @@+"""Phase D2 — AI/LLM-usage audit connector tests.++Pins schema + registry, provider selection, the event-type severity floors, and+that the emitted top-level ``event_type`` is the dotted form the llm-* detection+rules match on.+"""++from __future__ import annotations++import pytest+from app.connectors import CONNECTOR_REGISTRY+from app.connectors.base import Capability+from app.connectors.llm_usage import LlmUsageConnector+++def test_registered_and_schema():+ assert CONNECTOR_REGISTRY["llm_usage"] is LlmUsageConnector+ s = LlmUsageConnector.schema()+ assert s.category == "saas"+ assert {"provider", "api_key"} <= {f.name for f in s.fields}+ assert next(f for f in s.fields if f.name == "api_key").type == "secret"+ assert Capability.PULL_AUDIT in LlmUsageConnector.capabilities()+++def test_bad_provider_rejected():+ with pytest.raises(ValueError):+ LlmUsageConnector(provider="gemini", api_key="k")+++def test_api_key_created_is_high():+ c = LlmUsageConnector(provider="openai", api_key="k")+ out = c.normalize({"id": "log_1", "type": "api_key.created", "actor": {"email": "[email protected]"}})+ assert out["severity"] == "high"+ assert out["event_type"] == "openai.api_key.created"+ assert out["actor_email"] == "[email protected]"+++def test_logging_disabled_is_critical():+ c = LlmUsageConnector(provider="openai", api_key="k")+ out = c.normalize({"id": "log_2", "type": "logging.setting.updated"})+ assert out["severity"] == "critical"+ assert out["event_type"] == "openai.logging.setting.updated"+++def test_routine_event_is_info():+ c = LlmUsageConnector(provider="openai", api_key="k")+ out = c.normalize({"id": "log_3", "type": "login.succeeded"})+ assert out["severity"] == "info"+++def test_anthropic_provider_prefix():+ c = LlmUsageConnector(provider="anthropic", api_key="k")+ out = c.normalize({"id": "a1", "action": "member.added"})+ assert out["event_type"] == "anthropic.member.added"+ assert out["severity"] == "high"+++def test_emitted_event_type_matches_llm_detection_shape():+ # The llm-* detection rules match on event_type endswith .api_key.created+ # etc. — assert the emitted dotted form supports that.+ c = LlmUsageConnector(provider="openai", api_key="k")+ out = c.normalize({"id": "x", "type": "api_key.created", "key_scope": "admin"})+ assert out["event_type"].endswith(".api_key.created")diff --git a/services/fusion/app/data/detection_ruleset.json b/services/fusion/app/data/detection_ruleset.jsonindex a8ff5c1d2..ea83583ff 100644--- a/services/fusion/app/data/detection_ruleset.json+++ b/services/fusion/app/data/detection_ruleset.json@@ -1,5 +1,5 @@{- "count": 817,+ "count": 825,"rules": [{"category": "application",@@ -1268,6 +1268,130 @@"severity": "high","slug": "app-graphql-mutation-anonymous"},+ {+ "category": "application",+ "id": "det-application-071",+ "match_when": {+ "event_type_endswith": ".api_key.created"+ },+ "mitre": [+ "T1098"+ ],+ "name": "LLM Provider API Key Created",+ "product": "openai",+ "service": "audit",+ "severity": "medium",+ "slug": "llm-api-key-created"+ },+ {+ "category": "application",+ "id": "det-application-072",+ "match_when": {+ "event_type_endswith": ".api_key.created",+ "key_scope": "admin"+ },+ "mitre": [+ "T1098"+ ],+ "name": "LLM Provider Admin API Key Created",+ "product": "openai",+ "service": "audit",+ "severity": "high",+ "slug": "llm-admin-key-created"+ },+ {+ "category": "application",+ "id": "det-application-073",+ "match_when": {+ "event_type_endswith": ".member.added",+ "role": "owner"+ },+ "mitre": [+ "T1098.003"+ ],+ "name": "LLM Provider Owner Role Granted",+ "product": "openai",+ "service": "audit",+ "severity": "high",+ "slug": "llm-member-added-owner"+ },+ {+ "category": "application",+ "id": "det-application-074",+ "match_when": {+ "action": "disabled",+ "event_type_contains": "logging"+ },+ "mitre": [+ "T1562.008"+ ],+ "name": "LLM Provider Audit Logging Disabled",+ "product": "openai",+ "service": "audit",+ "severity": "critical",+ "slug": "llm-logging-disabled"+ },+ {+ "category": "application",+ "id": "det-application-075",+ "match_when": {+ "action": "disabled",+ "event_type_contains": "mfa"+ },+ "mitre": [+ "T1556"+ ],+ "name": "LLM Provider MFA Requirement Disabled",+ "product": "openai",+ "service": "audit",+ "severity": "high",+ "slug": "llm-mfa-disabled"+ },+ {+ "category": "application",+ "id": "det-application-076",+ "match_when": {+ "event_type": "anthropic.workspace.created"+ },+ "mitre": [+ "T1098"+ ],+ "name": "Anthropic Workspace Created",+ "product": "anthropic",+ "service": "audit",+ "severity": "low",+ "slug": "llm-anthropic-workspace-created"+ },+ {+ "category": "application",+ "id": "det-application-077",+ "match_when": {+ "event_type_endswith": ".service_account.created"+ },+ "mitre": [+ "T1136.003"+ ],+ "name": "LLM Provider Service Account Created",+ "product": "openai",+ "service": "audit",+ "severity": "medium",+ "slug": "llm-service-account-created"+ },+ {+ "category": "application",+ "id": "det-application-078",+ "match_when": {+ "event_type_endswith": ".project.archived"+ },+ "mitre": [+ "T1485"+ ],+ "name": "LLM Provider Project Deleted",+ "product": "openai",+ "service": "audit",+ "severity": "medium",+ "slug": "llm-project-deleted"+ },{"category": "cloud","id": "det-cloud-001",