Commit Graph
1 Commits
Author SHA1 Message Date
b854010e06 feat(v8.0): graph at ingest, four-agent rebrand, /hunt, 16 connectors, public benchmark (#125)
* chore(v8.0): kick off parallel team with progress tracker

Initialise AISOC_V8_PROGRESS.md to mirror the v8.0 release plan and
coordinate the wave-1 parallel team. Tracks T1.1, T1.3, T2.4, T2.5,
T3.1, T3.4, T4 wave-1 connectors, T5.1/T5.2, T7.1.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(api): T3.1 SOC Insights aggregator endpoint

Add GET /v1/insights/soc?window=24h|7d|30d returning a 7-tile payload
(MTTA, MTTR, FP rate, alerts/day, cases/day, agent-cost-per-
investigation, analyst hours saved) with current value, previous-period
delta, and a 24-bucket sparkline per tile. Tenant-scoped via the
existing AuthUser dependency.

The cost-per-investigation tile joins aisoc_run_costs to
investigation_runs; if the cost telemetry table isn't deployed yet
(TODO T2.4-followup) the helper swallows the SQLAlchemyError and
returns 0 so the dashboard still renders.

The "analyst hours saved" heuristic is documented inline:
auto-closed cases x MANUAL_INVESTIGATION_MINUTES (45 min).

Tests cover the delta-pct math (incl. the previous=0 -> None branch),
the window allowlist, the seven-tile shape, the hours-saved formula,
and the zero-state path.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs(architecture): T1.3 publish security knowledge graph v1.0 schema

Publish the source-of-truth schema for the AiSOC security knowledge graph
materialised by services/ingest. T1.3 ships in parallel with T1.1 (the
ingest-side writer) because the schema is fully specified up front; the
CI drift gate then guarantees the Go enums, the YAML, and the live DB
stay in lockstep.

* `schemas/graph-schema.yaml` — machine-readable v1.0 spec. 17 node
  labels (Identity, User, ServiceAccount, Role, Permission, Policy,
  Resource, Configuration, Endpoint, Repo, Container, Image,
  NetworkPath, SaaSApp, Alert, Case, Detection) and 14 relationships
  (:ASSUMED_BY, :HAS_PERMISSION, :GRANTS, :OWNS, :CONFIGURED_AS,
  :DEPLOYED_FROM, :ACCESSES, :PEER_OF, :TRIGGERED, :OCCURRED_ON,
  :MEMBER_OF, :DEPLOYS, :READS_FROM, :WRITES_TO). Six edges are flagged
  `event_edge: true` and carry the {ts, source_event_id, snapshot_id}
  triple the agent uses to replay state.

* `apps/docs/docs/architecture/graph-schema.md` — narrative reference.
  Why-we-need-it preamble, Mermaid ER diagram of the twelve most-
  traversed relationships, per-label and per-relationship subsections,
  versioning rules, and the CI drift gate pointer.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(scripts): T1.3 graph schema drift gate + export tool

`scripts/export_graph_schema.py` is the single tool that keeps the YAML
spec, the Go enums in `services/ingest/internal/graph/`, and the live
Neo4j materialisation aligned. Three modes:

* default — connect to Neo4j (env `AISOC_NEO4J_URI`/`NEO4J_URI`) and
  dump the live schema to `schemas/graph-schema-current.yaml`. Falls
  back to parsing the Go enums, and then to the YAML, so the script
  always produces an artefact even on a blank machine. The runtime
  dump is gitignored.

* --check — parse YAML, Go enums (when present — T1.1 not landed yet
  is OK), and live DB (when reachable), and fail non-zero on drift.
  Includes internal-consistency checks: SchemaVersion sanity, duplicate
  detection, and the required {ts, source_event_id, snapshot_id} triple
  on every event_edge.

* --from-go — regenerate the YAML skeleton from the Go enums for the
  rare case where Go is the authoritative change.

`.github/workflows/graph-schema-check.yml` runs `--check` on PRs that
touch `schemas/graph-schema.yaml`, `services/ingest/internal/graph/**`,
or the script itself.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(marketing): T6.2 reference-customer page template

Adds an MDX-driven case-study template so GTM can publish a new customer
story by dropping one file into apps/web/content/customers/, with no
engineering involvement required.

Surfaces:

- /customers — public index, lists every non-draft case study with the
  industry badge, region, challenge, and a 3-stat preview band.
- /customers/[slug] — detail page with hero (logo + industry + challenge),
  before/after stat band, pull-quote, MDX body, and deep links into the
  docs / app for the features cited.

Wiring:

- apps/web/src/lib/customers.ts: file-system loader (fs + gray-matter).
  Typed CustomerFrontmatter contract; sorts by `order` then title; supports
  draft: true to keep unpublished studies in-tree but off the index.
- apps/web/src/components/marketing/MdxBody.tsx: shared MDX style map so
  prose authored in MDX inherits the landing-page typography palette.
- next-mdx-remote@6.0.0 + gray-matter@4.0.3 added to apps/web deps; rendered
  via next-mdx-remote/rsc inside the [slug] page so the route is fully
  RSC-compatible.

Content scaffold:

- apps/web/content/customers/ created with a template MDX file
  (example.mdx) flagged draft: true and clearly marked
  "Example / Template — replace before publishing".
- apps/web/public/customers/example/logo.svg: placeholder logo so the
  template renders end-to-end during local development.

Both pages are statically generated via generateStaticParams() from the
filesystem, so the production build doesn't depend on runtime FS access.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(cursor-extension): T7.1 scaffold IDE extension for AiSOC MCP

Ships the kickoff scaffold for the v8.0 IDE extension at
`services/mcp/cursor-extension/`. Works on any VSCode-compatible IDE
(`engines.vscode: ^1.80.0`) — Cursor, VSCode, Windsurf, et al.

Registers four MCP-backed commands:
  - aisoc.runTriage        — wraps aisoc_run_investigation
  - aisoc.replayDecision   — wraps aisoc_replay_decision
  - aisoc.explainStep      — wraps aisoc_explain_step
  - aisoc.queryDetections  — wraps aisoc_query_detections

Plus two key-management helpers (aisoc.setApiKey / aisoc.clearApiKey)
that route through `context.secrets` so API keys never touch
settings.json. The decoy `aisoc.apiKey` setting documents that pattern
explicitly so analysts don't paste creds into a synced file.

Architecture:
  - `src/mcpClient.ts` — typed JSON-RPC over HTTP wrapper. Posts
    `tools/call` payloads at the configured `aisoc.mcpEndpoint`
    (default `http://localhost:8765/mcp`) with `Authorization: Bearer`
    when a key is set. Maps transport, HTTP, JSON-RPC, and tool errors
    onto a single `McpClientError` class.
  - `src/views.ts` — singleton `OutputChannel` + side-panel webview
    that renders both the human text content and the structured JSON
    payload returned by the MCP server. Webview CSP is `default-src
    'none'; style-src 'unsafe-inline'` — no JS, no external assets.
  - `src/extension.ts` — activation, command wiring, secret-storage
    integration, and per-command error notifications with a
    "Show details" jump to the output channel.

Tests: 19 vitest smoke tests (`npm test`) stub `fetch` and assert URL
normalisation, JSON-RPC payload shape per command, optional-argument
omission, MITRE-id routing vs free-text query, Authorization header
handling, and error-class discrimination (transport / http / jsonrpc
/ tool). Build verified: `npm install && npm run compile` produces
`out/extension.js` cleanly.

Marketplace publish deferred — README documents the full vsce/ovsx
flow but no PAT is wired up in this PR. Mark T7.1 as `[~]` in
AISOC_V8_PROGRESS.md per the M-effort gate (scaffold + working local
install qualifies).

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs(benchmark): T5.1 publish latency/tokens/USD scaffold + provenance

Track 5 — Public benchmark + methodology page (P0, S).

Adds the structural scaffold for the public benchmark page:
- North-star callout (sub-minute p50, sub-2-minute p95 on the
  200-incident eval), clearly labelled wet-eval-not-substrate.
- "What's substrate vs wet?" section to keep the substrate self-checks
  visually separate from real wet-eval measurements (workspace rule).
- Three placeholder tables — latency p50/p95/p99, tokens per
  investigation, USD per investigation — per template family + aggregate.
  Cells are <!-- T2.4 populates --> markers, not imputed numbers.
- Provenance footer (commit SHA, run date, dataset SHA-256, eval mode,
  rate-card date) — populated by the per-PR substrate run and the weekly
  wet-eval CI job (T5.5).

Adds scripts/render_eval_charts.py — public renderer that consumes
eval_report.json and writes summary.md, wet_eval.md, and provenance.md
into eval/results/charts/. Three input modes:
- substrate-only report → emits placeholder note for wet eval
- T2.4 per_investigation block → emits substrate-budget projection,
  clearly labelled as 'not wet eval'
- T5.5 wet_eval block → emits real latency/tokens/USD tables

Adds 'pnpm eval:public' as the single end-to-end entry point:
  python3 scripts/run_evals.py --out eval_report.json &&
  python3 scripts/render_eval_charts.py eval_report.json

Verified end-to-end against the live substrate suite — emits a passing
report and rendered chart bundle in ~2.5 s. T2.4's per_investigation
block surfaces correctly through the renderer with the
'deterministic-substrate budget, not wet eval' callout.

* docs(benchmark): T5.2 add open methodology + sidebar + README footer

Track 5 — Public benchmark methodology page (P0, S).

Adds apps/docs/docs/benchmark-methodology.md — the open reference for
anyone reproducing the numbers on benchmark.md or comparing AiSOC against
their own SOC. Sections:

1. Why this exists (vs unreproducible vendor benchmarks)
2. Dataset — 200 incidents from 55 templates, deterministic seed,
   100 % synthetic, 14-source backing telemetry, what's synthetic vs real
3. Substrate vs wet eval — the workspace-rule distinction restated in
   detail; cross-links to wet-eval-weekly.yml (T5.5)
4. Suites and what each one actually measures
5. Rate card (with effective-from dates and a 'rates evolve' note)
6. How to reproduce — exact commands incl. 'pnpm eval:public'
7. How to compare against your own SOC (invites reproductions; references
   the issue-template path that lands with T5.4)
8. Limitations + threats to validity (synthetic data, tautological
   substrate self-checks, wet-eval variance, rate-card-only cost,
   coverage gates, connector / SIEM coverage gaps)
9. Where to go from here (cross-links + open agent code reference)

Wires benchmark-methodology into apps/docs/sidebars.ts under
"Getting Started" so it sits next to benchmark.md.

Appends a single-line reproducibility footer to README.md pointing at
'pnpm eval:public' and docs.aisoc.dev/benchmark-methodology — the line
buyers/auditors should land on.

* feat(marketing): T6.2 land MDX customer template content and pages

Companion to f9dac9ef (whose tree was polluted by a concurrent commit on
the parallel branch). Lands the actual files referenced in that commit
message so the /customers and /customers/[slug] routes work end-to-end.

Surfaces:

- /customers — public index, lists every non-draft case study with the
  industry badge, region, challenge, and a 3-stat preview band.
- /customers/[slug] — detail page with hero (logo + industry + challenge),
  before/after stat band, pull-quote, MDX body, and deep links into the
  docs / app for the features cited.

Wiring:

- apps/web/src/lib/customers.ts: file-system loader (fs + gray-matter).
  Typed CustomerFrontmatter contract; sorts by `order` then title; supports
  draft: true to keep unpublished studies in-tree but off the index.
- apps/web/src/components/marketing/MdxBody.tsx: shared MDX style map so
  prose authored in MDX inherits the landing-page typography palette.
- next-mdx-remote@6.0.0 + gray-matter@4.0.3 added to apps/web deps; rendered
  via next-mdx-remote/rsc inside the [slug] page so the route is fully
  RSC-compatible.

Content scaffold:

- apps/web/content/customers/example.mdx: template flagged draft: true and
  clearly marked "Example / Template — replace before publishing".
- apps/web/public/customers/example/logo.svg: placeholder logo so the
  template renders end-to-end during local development.

Both pages are statically generated via generateStaticParams() from the
filesystem, so the production build doesn't depend on runtime FS access.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore(repo): T5.1 add eval-public entry point — flip T5.1 + T5.2 in progress tracker

Marks T5.1 (Speed + token + USD published) and T5.2 (Methodology page)
complete in AISOC_V8_PROGRESS.md, with a single combined changelog line
documenting:

- benchmark.md gains north-star callout, latency/tokens/USD scaffold
  (T2.4-populates placeholder cells), and a provenance footer
- new benchmark-methodology.md — dataset, substrate-vs-wet eval, rate
  card, reproduce, how-to-compare, limitations
- 'pnpm eval:public' entry point + scripts/render_eval_charts.py renderer
- README footer points reproducers at the methodology page

T2.4's per_investigation block (deterministic-substrate budget) is
already wired through the renderer; T5.5 (wet-eval-weekly.yml) will fill
the placeholder cells in benchmark.md once it lands.

* feat(marketing): T6.3 sovereign + air-gap one-pager and nav wiring

A landing page that surfaces AiSOC's deployment flexibility (air-gap,
on-prem, hybrid, public cloud, managed SaaS) crossed with LLM mode
(cloud APIs / local Ollama / BYO endpoint), data residency (EU / US /
India / custom), and compliance posture (SOC2 / ISO27001 / GDPR /
DPDP). GTM can hand this URL to a regulated buyer without an
engineering touch.

/sovereign sections:

- Hero: "AiSOC runs where you do. Sovereign by default."
- Three control points (deploy / LLM / data residency).
- Deployment-mode matrix table with per-mode posture and runbook
  citation.
- Repository artifacts: docker-compose.airgap.yml + Ollama overlay,
  infra/terraform/, infra/ Helm chart story, demo seed script — all
  linked back so the buyer can verify the claim before talking to us.
- Country × cloud combo grid: AWS / Azure / GCP / OCI / DigitalOcean /
  Hetzner × US / EU / India / Singapore / Custom, with a tasteful
  "Validated / Bring your own" legend.
- CTA strip: "Talk to us about sovereign deployment" → mailto +
  link to the early-access waitlist (T6.1).

Nav wiring:

- LandingNav: replaces the duplicated `/#architecture` and `/#mitre`
  hash links (already covered by Platform) with `/sovereign` and
  `/customers`. Both pages now visible from every marketing route.
- Footer: adds "Sovereign + air-gap" and "Customers" under Platform.

Static, server-rendered, no client JS dependency on top of the
existing landing-page primitives.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs(agents): T2.5 mark four-agent rebrand shipped in progress tracker

Flip [ ] T2.5 → [x] T2.5 in the v8.0 parallel-team tracker and add a
changelog entry summarising the consolidation: the public surface now
exposes exactly four named agents (Detect, Triage, Hunt, Respond), with
sub-agents (phishing, identity, cloud, insider) reframed as capabilities
of TriageAgent. Back-compat aliases keep existing imports working.

Underlying T2.5 implementation files were swept up by a sibling subagent's
git-add-all into commit 1dd339c1 ("docs(benchmark): T5.1 publish
latency/tokens/USD scaffold + provenance"); content is correct at HEAD,
but the commit attribution is mixed. Coordinator note: no rebase needed —
the file content is what matters for the merge.

* feat(papers): T7.2 publish L0–L4 automation maturity white paper

Adds the full-length AiSOC white paper on the L0–L4 SOC automation
maturity model, the WeasyPrint-based render tool, and the rendered PDF
artifact under the marketing site's public papers directory.

- apps/web/content/papers/l0-l4-automation-maturity.md — canonical
  ~4,400-word white paper with cover-page frontmatter, executive
  summary, five-tier deep dive, assessment checklist, migration paths,
  worked closed-loop example, and references to MITRE D3FEND, OASIS
  CACAO v2.0, SAE J3016, and NIST SP 800-61.
- apps/web/public/papers/l0-l4-automation-maturity.pdf — rendered PDF
  (90 KB, A4, paginated, cover page + body) suitable for direct
  download from tryaisoc.com/papers/.
- apps/web/public/papers/README.md — index of hosted PDFs plus the
  regenerate-from-source instructions (Docker, Homebrew, or pip).
- scripts/render_white_paper.py — markdown→HTML→PDF render tool that
  reuses the WeasyPrint stack already pinned by services/api/Dockerfile;
  no new heavy dependency, no headless Chromium.

No competitor product names appear in the white paper or in any
artifact in this commit (project rule).

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs(concepts): T7.2 add L0–L4 automation maturity concept page

Lands the canonical written-down version of the L0–L4 model in the docs
site as a Core Concepts page, wired into the sidebar after the existing
Live Actions page. Cross-links to the longer white paper hosted at
tryaisoc.com/papers/l0-l4-automation-maturity.pdf.

- apps/docs/docs/concepts/automation-maturity.md — new ~2,250-word
  concept page that documents each tier (entry criteria, auto-executed
  scope, gated scope, MTTR target, FP tolerance), the gate evaluation
  order, the per-tenant maturity assessment checklist, migration paths
  between tiers, and what lives outside the dial. Honest about AiSOC
  sitting at L2 for the median tenant today.
- apps/docs/sidebars.ts — adds concepts/automation-maturity to the
  Core Concepts section.
- apps/docs/docs/concepts/capabilities.md — cross-links the L0–L4
  remediation maturity row to both the concept page and the white paper.
- AISOC_V8_PROGRESS.md — flips T7.2 from [ ] to [x] and records the
  shipped artefacts in the changelog.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(demo): T6.4 deterministic 4-case quick seed + aisoc:demo --quick

Adds a --demo-quick mode to the canonical demo seeder that populates
exactly four deterministic DEMO-* incidents (phishing / cloud takeover /
insider exfil / ransomware) anchored at a fixed wall-clock so every
re-run is byte-stable — same hashes, same UUIDs, same timestamps. The
mode is idempotent: existing DEMO-* cases, alerts, and timelines are
purged before reseeding so re-running is a clean reset rather than a
duplicate.

Wires the same flag through to scripts/aisoc-demo.ts as
`pnpm aisoc:demo --quick` (alias `--demo-quick`), plus `--clock <iso>`
for power users and a proper `--help` banner. In quick mode the browser
opens on DEMO-004 (LockBit ransomware) — the visually-loudest of the
four cases and the one the T6.4 screencast lands on.

Full-seed mode (no flag) is unchanged: 15 INC-RT-* incidents + 28
randomized alerts + the in-flight INC-RT-001 investigation. Backwards
compatible with the hosted-demo wrapper (`app.scripts.demo_seed`) — it
imports seed_demo.main without forwarding argparse, so we use
parse_known_args to silently ignore wrapper-only flags.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(connectors): T4 add Tines connector

Audit + case ingestion via Tines REST API (PAT auth). Pulls
GET /api/v1/audit_logs (admin events on tenants, stories, agents,
credentials, team membership) and GET /api/v1/cases (story-produced
work items) on each poll. Wave-1 severity collapse: high-risk audit
ops (credential.*, story.deleted/disabled, tenant.api_key.*,
team.member_role_changed, sso.disabled) → high; other deletions →
medium; failures → low; everything else → info. Case record_severity
maps critical/error → high, warn → low, info/success → info; closed +
resolved cases collapse to info regardless. Pagination follows
meta.next_page up to 20 pages per stream per poll. Optional team_id
field scopes ingestion. Plugin manifest, docs walkthrough indexed in
the Connectors sidebar, fixture-driven tests covering schema, registry
membership, normalize roundtrip, pagination loop termination, and
test_connection() success/failure.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(connectors): T4 add Torq connector

Workflow execution + audit ingestion via Torq Public API. OAuth-style
client-credentials auth: exchanges key_id + key_secret for a short
bearer token at /auth/v1/token on every poll. Two streams:
GET /workflows/executions (per-run outcomes) and GET /audit-logs
(workflow / credential / role / API-key / integration / SSO events).
Wave-1 severity collapse: execution status success/completed/running
→ info, warning → low, failed/error/killed/critical → high. Audit ops:
workflow.deleted/disabled, credential.*, user.role_changed/invited/
removed, api_key.created/revoked, integration.created/deleted,
sso.disabled → high; other *.deleted → medium; *.failed → low;
everything else → info. Pagination follows next_page_token up to 20
pages per stream. Optional base_url override for regional /
self-hosted deployments.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(connectors): T4 add Falco connector

Push-based runtime-security event ingestion for Linux / Kubernetes.
Accepts JSON rule hits over HTTP from falcosidekick or Falco's
built-in http_output plugin; both payload shapes (batched array vs
single event) are supported. Optional X-Falco-Secret header is
validated with constant-time compare so missing / wrong secrets fail
without timing leaks. minimum_priority floor (syslog ladder) drops
events server-side before they pay the normalize() cost. Wave-1
severity collapse: EMERGENCY/ALERT/CRITICAL → high; ERROR → medium;
WARNING/WARN → low; everything else → info. fetch_alerts() drains an
in-memory webhook buffer atomically per poll; in production the
buffer is replaced by a durable queue but the produce-once /
consume-once contract is identical. Normalised events carry the
hostname, k8s namespace, container id, and user.name pulled from
Falco's output_fields when present.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(connectors): T4 add PagerDuty connector

Incident lifecycle + audit-record ingestion via PagerDuty REST API
(Token token=<key> scheme). Two streams with distinct pagination:
GET /incidents uses classic offset/limit/more, GET /audit/records uses
opaque next_cursor. Wave-1 severity collapse: priority P1/critical →
high, P2/error → medium, P3/warning → low, P4/P5/info → low/info;
falls back to urgency (high/low) when no priority is set; resolved
incidents collapse to info regardless. Audit ops: user.role_changed,
user.create/delete, api_key.create/delete, extension.create/delete,
webhook_subscription.create/delete, service.delete,
escalation_policy.delete → high; other *.delete → medium; rest → info.
test_connection() handles both user-level and general-access keys by
probing /users/me first, falling back to /incidents?limit=1 on 401.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(connectors): T4 add Opsgenie connector

Alert + audit-log ingestion via Opsgenie REST API with GenieKey
auth. Region-aware: us → api.opsgenie.com, eu → api.eu.opsgenie.com.
Two streams: GET /v2/alerts uses a Lucene-style createdAt/updatedAt
ms-epoch query; GET /v2/audit-logs?type=customer uses an ISO-8601
createdAtStart filter. Both paginate by following the absolute
paging.next URL the API returns. Wave-1 severity collapse: P1 → high,
P2 → medium, P3/P4 → low, P5 → info; status=closed alerts collapse to
info regardless. Audit actions: ApiKeyCreated/Deleted,
ApiIntegrationCreated/Deleted, UserRoleChanged, UserAdded/Deleted,
EscalationPolicyDeleted, TeamDeleted, WebhookCreated/Deleted,
IntegrationDisabled → high; other *Deleted/Disabled → medium; rest
→ info. test_connection() probes /v2/account and surfaces the account
name + plan tier.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(connectors): T4 add Confluence Audit connector

Atlassian Confluence Cloud audit-trail ingestion via the REST API
with HTTP Basic auth (email + API token). Pulls GET
/wiki/rest/api/audit?startDate=<ms>&limit=100&start=<offset> on each
poll; pagination terminates when size < limit. test_connection()
distinguishes "bad creds" (401 on /user/current) from "auth ok but
not site-admin" (200 on /user/current but 403 on /audit) so the
operator gets actionable feedback. Wave-1 severity collapse: short
allowlist of summary fragments (Removed user from site, Granted site
admin, External share link created, Public link enabled, Site-wide
deletion, Bulk delete, Anonymous access enabled, Site export started,
Permissions granted to anyone) → high; Restrictions / Space /
Page / Group / Global-permission changes → medium; permissions /
security / users-and-groups category floor → medium; everything else
→ info. ms-since-epoch creationDate is converted to ISO-8601 in the
normalised event.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(connectors): T4 wire wave-1 connectors into registry + marketplace

Register the six new wave-1 connector classes (TinesConnector,
TorqConnector, FalcoConnector, PagerDutyConnector, OpsgenieConnector,
ConfluenceAuditConnector) in `_CONNECTOR_CLASSES` so the platform's
auto-discovery picks them up without per-instance wiring. Rebuild the
marketplace index (`marketplace/index.json` +
`apps/web/public/marketplace/index.json`) from `plugins/*/plugin.yaml`
via `scripts/build_marketplace.py`, and re-run `curate_detections.py`
to refresh `curated.json`. Index the six new connector setup pages
(`tines`, `torq`, `falco`, `pagerduty`, `opsgenie`, `confluence-audit`)
in the Docusaurus sidebar's Connectors category. Flip the matching
T4.x rows in `AISOC_V8_PROGRESS.md` and add a wave-1 changelog entry.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(web): T3.4 /hunt natural-language hunt surface

Make /hunt the canonical natural-language hunt experience for AiSOC and
collapse the legacy /investigate route into it.

UI additions on /hunt:
* New emerald hero block with the tagline "Hunt at the speed of
  thought" and three example-query pills covering geo
  ("Did we get any new attacks from Iran?"), IAM ("Show me everyone
  who touched our prod IAM role in the last 7 days") and identity
  ("Any GitHub auth from a new device this week?"). Clicking a pill
  immediately translates and runs the hunt; the inline NL input
  submits on Enter.
* Saved-hunts sidebar (separate from the existing raw-query
  "Saved searches" panel) backed by /v1/saved-hunts. Each row shows
  the original NL question, schedule badge if cron-set, last-run
  timestamp, and a one-click Run / Delete pair. Re-running an NL
  hunt re-translates server-side, populates the editor with the
  refreshed ES|QL, and stamps last_run_at.
* "Save hunt" button beside the editor that persists the most-
  recent NL question (preferred) or falls through to the legacy
  raw-query saver when the editor was hand-edited.
* Translator explanation banner above the editor so analysts can
  see "what the platform thinks I asked" before running.

Routing:
* /investigate -> 308 permanent redirect to /hunt with all
  query parameters preserved (so notification emails, agent runs,
  and bookmarks keep working). The InvestigationChat /
  InvestigationTimeline components stay where they are; the page
  itself is now a tiny next/navigation `permanentRedirect` shell.

API client + shared types:
* `apps/web/src/lib/api.ts` exposes `nlQueryApi.translate` and a
  fully-typed `savedHuntsApi` (list / get / create / remove / run)
  matching `services/api/app/api/v1/endpoints/saved_hunts.py`.
* `packages/types/src/hunt.ts` (new) re-exports `SavedHunt`,
  `TranslatedQueryEnvelope`, `CreateSavedHuntRequest`,
  `RunSavedHuntResponse`, `NlQueryTranslate{Request,Response}` so
  non-web SDK consumers can build against the same contract.

Type-checks: `pnpm --filter @aisoc/types type-check` and
`pnpm --filter @aisoc/web type-check` both pass.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(eval): T2.4 token + USD telemetry, SVG charts, tests

Per-investigation token / USD / latency telemetry for the public eval
harness. Runs on every PR (substrate path, no LLM call) and feeds the
benchmark page so token-budget regressions are caught before they hit
the wet-eval weekly job.

What lands:

* scripts/eval_telemetry.py — new stdlib-only module. Computes prompt /
  completion / total tokens for each of the 200 synthetic incidents
  using OpenAI's published 4-chars-per-token rule, applies an
  illustrative 2025-era public rate card (gpt-4o, gpt-4o-mini, gpt-5,
  claude-3.5-sonnet, claude-3-haiku, gemini-1.5-pro, gemini-1.5-flash)
  to project USD per investigation, and measures wall-clock latency
  across the deterministic substrate path. Mirrors the per-1K rates in
  services/agents/app/core/cost_telemetry.py so the substrate gate and
  the runtime cost ledger agree on the same cost model. Aggregate +
  per-template stats (mean / median / p50 / p95 / p99). Carries
  mode="deterministic_substrate" so consumers cannot mistake it for
  wet-eval.

* scripts/run_evals.py — folds the per_investigation block into
  eval_report.json (headline keys tokens_per_investigation /
  usd_per_investigation / latency_per_investigation_ms mirror the T5.1
  doc-table contract). Adds --telemetry-only / --telemetry-model /
  --no-telemetry-records flags. Wraps the substrate-suite imports in a
  try/except so the telemetry block can run on a bare Python install
  without the full agent dependency stack (pydantic, langgraph, ...).

* scripts/render_eval_charts.py — extended with a hand-rolled SVG
  emitter (zero new deps; matplotlib was an option but adds 30+ MB to
  the dev image for a 200-LOC chart need). Renders four charts into
  apps/docs/docs/benchmark-charts/: latency-p50-p95-p99.svg (bar
  chart), tokens-distribution.svg + usd-distribution.svg (histograms
  with median / p95 markers), latency-by-template.svg (slowest 20
  templates). Falls back to a synthesised distribution if
  --no-telemetry-records was passed so histograms still render a
  recognisable shape from the aggregate stats.

* services/agents/tests/test_eval_telemetry.py — 18 unit tests across
  4 classes. Locks down the rate-card maths (1M+1M tokens at gpt-4o
  must equal $12.50 to six decimals), the 4-chars-per-token estimator,
  the aggregate/per-template stats including monotone percentiles
  (p50 ≤ p95 ≤ p99 ≤ max), severity-driven completion scaling, and the
  SVG round-trip (every chart starts with <?xml, contains <svg ... and
  <rect, closes with </svg>; histograms still draw with the
  no-records fallback).

Sample numbers from a dry run against the 200-incident dataset
(gpt-4o rate card, illustrative):

  tokens / investigation: mean=2186  median=2114  p95=2452  p99=2478
  USD    / investigation: mean=$0.01469  median=$0.01368
                          p95=$0.01693  p99=$0.01699
  latency_ms (substrate path only): p50=0.0073  p95=0.0107  p99=0.0137

These are deterministic-substrate budget projections, not wet eval.
Wet eval lands in T5.5; this telemetry is the CI-gated upper bound
that runs every PR. The benchmark page documents the substrate-vs-wet
split clearly per workspace rule.

* feat(demo): T6.4 screencast placeholder + landing-page embed

Adds the assets the 90-second `pnpm aisoc:demo --quick` screencast will
ship with at v8.0 launch:

- `apps/web/public/.demo-mp4-placeholder` — a text placeholder (no
  binary committed) documenting the recording brief: 90s against
  `pnpm aisoc:demo --quick`, H.264 1280x720, ≤8MB, lands on DEMO-004.
- `apps/web/public/demo-thumbnail.svg` — brand-aligned 1280x720 SVG
  thumbnail with a play button and the four canonical case names
  visible, so it's recognisable as a product shot rather than a hero
  image.
- `apps/web/src/components/onboarding/StartHero.tsx` — small
  non-intrusive `DemoScreencast` card under the three primary CTAs
  linking to `/demo.mp4`. Copy is honest about the launch timing
  ("Coming v8.0") so the link 404'ing pre-launch doesn't feel like a
  bug.

The card is an `<a>` to /demo.mp4 (not an inline `<video>`) because
the placeholder is a text file — embedding a player would render
broken. The day the real .mp4 lands we swap to `<video>` with proper
controls.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs(readme): T6.4 Fly.io demo badge + aisoc:demo --quick snippet

Adds two new top-of-readme badges next to the existing License /
Eval-harness / PRs / Version row:

- "Live demo · Fly.io" → https://demo.aisoc.dev, the hostname the v8.0
  Fly deploy will live at. Until the deploy lands the badge is a
  placeholder, so the existing tryaisoc.com paragraph immediately under
  the badge row picks up an explicit "goes live with the v8.0 launch"
  note. That way a buyer who clicks the badge pre-launch isn't confused.
- "Render demo · one click" → the existing /deploy URL, lifted into the
  badge row for symmetry with Fly. The full Render section further
  down keeps its big "Deploy to Render" button — this badge is just so
  both hosted-demo paths are scannable from the header.

Also adds the screencast-mode snippet inside the existing Docker
Compose section:

    pnpm aisoc:demo --quick  # 4 cases in 4 minutes

with a short paragraph naming the four canonical DEMO-* cases the
quick mode seeds (phishing / cloud takeover / insider exfil /
ransomware) and noting it's the path the 90-second product screencast
records against. The full-seed `pnpm aisoc:demo` (15 incidents) is
preserved as the default — `--quick` is opt-in.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs(benchmark): T2.4 substrate-budget section + inline SVGs

Wires T2.4's per-investigation telemetry into apps/docs/docs/benchmark.md
and flips the AISOC_V8_PROGRESS.md checkbox.

* New "Deterministic-substrate budget projection (T2.4)" subsection
  immediately above the existing wet-eval tables. Has its own warning
  banner, a substrate-budget table (mean / median / p95 / p99 for
  total / prompt / completion tokens, USD, and substrate-path
  latency), and four inline SVGs from apps/docs/docs/benchmark-charts/:
  latency p50/p95/p99 bar chart, tokens histogram, USD histogram, and
  the per-template top-20 latency chart.

* The three pre-existing wet-eval tables (Table 1 / 2 / 3) keep their
  T2.4-populates placeholders. They are renamed to "Wet eval — Table
  N" and each gets a back-reference to the substrate budget above so
  readers can compare substrate p95 (CI-gated upper bound) against
  wet-eval p95 (real LLM, weekly). Per workspace rule: substrate
  numbers are never substituted into the wet-eval tables.

* AISOC_V8_PROGRESS.md flips T2.4 to [x] and gets a changelog entry
  describing the deliverables, the rate card, and the substrate-vs-wet
  split.

The plan file in plans/ is unchanged per the workspace rule.

* feat(demo): T6.4 contract test for the quick-seed 4-case path

Adds `services/api/tests/test_demo_seed.py` which locks in the contract
of the `--demo-quick` mode introduced under T6.4:

- exactly four canonical case keys (DEMO-001..DEMO-004) — adding a
  fifth would push the 90-second screencast over budget; removing one
  would weaken the four-pillar platform pitch (phishing / cloud /
  insider / ransomware)
- the connector_sources list each case advertises (so the Source
  column in the demo doesn't silently drift to e.g. crowdstrike for
  a phishing case)
- every alert under a case must come from one of the case's declared
  connectors (so the Source filter has no phantoms)
- `_demo_quick_uuid` is byte-stable for identical inputs (locked
  against the SHA-shaped uuid5 namespace constant)
- `_parse_clock(None)` returns the canonical T6.4 wall-clock anchor

Fast tests (5) introspect the `_DEMO_QUICK_INCIDENTS` module-level
constant and the deterministic helper — no DB, no event loop. The
heavier "run the seeder, count DEMO-* rows" assertion sits behind
`pytest.mark.integration` and is skipped unless
`AISOC_RUN_INTEGRATION=1`, so a developer machine without a running
Postgres still sees green.

Registers the `integration` marker in services/api/pyproject.toml so
the run produces no warnings.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(ingest): T1.1 ingest-side graph writer scaffold

Inserts a graph projection step into the Kafka ingest path so every
normalised OCSF event materialises Neo4j nodes + edges before fusion
sees it. New package services/ingest/internal/graph/ with:

- schema.go — versioned vocabulary (v1.0): 17 node labels and 14
  relationship types matching schemas/graph-schema.yaml. SchemaVersion
  exported as a const so downstream consumers (T2.1, T3.2, T3.3) can
  pin against a stable contract.

- writer.go — Neo4j Bolt driver with batched UNWIND upserts. MERGE
  is keyed on (label, natural_key); a hash(properties) is stamped on
  every node so the realtime channel can skip no-op updates. The hot
  path is non-blocking — events go onto a bounded queue (default 2048)
  and a background flusher drains them every 100ms or 100 events,
  whichever comes first. When the queue is full we drop and increment
  a metric instead of blocking the caller. This is the explicit T1.1
  guarantee: graph failures NEVER block fusion ingest, exercised by
  TestWriteEvent_NeverBlocksOnFailure with a deliberately wedged fake
  driver.

- extractor.go — pulls entity references out of OCSF events. v1.0
  ships real coverage for aws_security_hub, github_audit,
  okta_system_log, kubernetes_audit; everything else falls through to
  a generic actor + endpoint extractor so connectors we haven't fully
  wired still produce a non-empty projection. extractMITRE adds a
  Detection node and TRIGGERED edge per ATT&CK technique the
  normaliser already attached.

Wiring:

- handler.go fan-outs graph writes concurrently with the fusion publish.
  A nil writer disables the fan-out entirely so the rest of the
  pipeline behaves identically when AISOC_GRAPH_ENABLED=false.

- publisher.go gains PublishGraphUpdate, satisfying the
  graph.UpdatePublisher interface. Every node and every edge upsert
  produces an envelope on the new security.graph_updates topic for
  the realtime websocket service (T1.4) to consume.

- config.go: AISOC_GRAPH_ENABLED (default off), AISOC_NEO4J_URI,
  AISOC_NEO4J_USER, AISOC_NEO4J_PASSWORD (env-only — never committed),
  AISOC_NEO4J_DATABASE, AISOC_GRAPH_BATCH_SIZE,
  AISOC_GRAPH_FLUSH_INTERVAL_MS, AISOC_GRAPH_QUEUE_SIZE,
  AISOC_GRAPH_UPDATES_TOPIC.

- main.go: opt-in graph writer construction + clean shutdown wired
  into the existing context cancellation.

Tests:

- internal/graph/writer_test.go (9 cases) — UNWIND batching against
  a fake Driver, idempotency on repeated natural keys, partial-failure
  surfacing, queue-full drop, the never-blocks-on-failure contract,
  graph-update publishing, schema-version stamping, idempotent close,
  concurrency-safe stats.

- internal/graph/extractor_test.go (8 cases) — per-connector entity
  + edge shape, MITRE detection node, generic fallback,
  nil-/empty-input safety, time fallback.

- services/agents/tests/test_graph_freshness.py — Python integration
  test (@pytest.mark.integration) probes p95 < 2s graph freshness end
  to end. Skips cleanly when Kafka or Neo4j aren't running locally
  so unit-only CI runs stay green. Also includes a smoke check that
  asserts ingest returns 2xx within 2s even when Neo4j is wedged
  (the failure-isolation contract).

Source-type coverage on day one:

  - aws_security_hub: full mapping (User -> Resource via :OWNS,
    Alert -> Resource via :OCCURRED_ON)
  - github_audit: full mapping (User -> Repo via :READS_FROM /
    :WRITES_TO based on action verb)
  - okta_system_log: full mapping (Identity -> User via :ASSUMED_BY,
    User -> SaaSApp / NetworkPath via :ACCESSES)
  - kubernetes_audit: full mapping (User or ServiceAccount based on
    system:serviceaccount: prefix -> Resource via :ACCESSES with verb
    on the edge)
  - All connectors: ATT&CK :Detection node + :TRIGGERED edge per
    technique the normaliser already enriched
  - Generic fallback (actor + endpoint nodes) for the remaining 10
    source types — TODOs in extractor.go call out which connectors
    are deferred to T1.2 / the T4 wave.

Deferred (TODOs in code):

  - T1.2 — config snapshots tied to {ts, snapshot_id}. The schema and
    writer already plumb ev.SnapshotID through every node + edge
    property; T1.2 fills it in.

  - 360-event synthetic corpus expansion — the Python integration
    test ships with SAMPLE_SIZE=20 today and a TODO for the full
    corpus.

  - Full mapping for the other 10 connector types — currently use the
    generic fallback. Each has a TODO referencing the right v8.0
    workstream.

Acceptance:

  - go build ./... green
  - go test ./internal/graph/... green (16 tests, 1.3s)
  - go test ./... green (no regressions in handler/inbox)
  - schema enums + version constant exported (SchemaVersion = "v1.0")
  - security.graph_updates topic produces on every node/edge write
  - failure in graph write does NOT block fusion (asserted by
    TestWriteEvent_NeverBlocksOnFailure)
  - AISOC_V8_PROGRESS.md flipped to [~] T1.1 with status line

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore(v8.0): wave-1 integration — author, signing, fork-PR workflow

Records the final wave-1 status, locks in author attribution as
Prince Sinha <prince.sinha@cyble.com> (Senior Director, Innovations
at Cyble), and documents the SSH commit-signing setup applied locally
to this repo (no global config touched per workspace rule).

All 29 wave-1 commits were re-signed and re-authored via
`git rebase --exec 'git commit --amend --no-edit --reset-author -S'`
against upstream/main, with the SSH key at ~/.ssh/id_rsa.pub.

Push target: origin (prince30121/AiSOC fork).
PR target:   upstream/main (beenuar/AiSOC).

Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* chore(repo): gitignore .eval-test-venv/ subagent artifact

The T2.4 telemetry subagent created an .eval-test-venv/ Python
virtualenv while running its CI checks. The directory is per-machine
and shouldn't be tracked. Added to .gitignore under the Python block
alongside .venv/ and venv/.

Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* chore(v8.0): record fork push + compare URL for wave-1 PR

Push to origin (prince30121/AiSOC) over SSH succeeded — the branch
now lives at:

  git@github.com:prince30121/AiSOC.git
  refs/heads/v8.0/parallel-team-kickoff

Updated AISOC_V8_PROGRESS.md with the prepared compare URL so the PR
can be opened from the browser against beenuar/AiSOC:main. Also
gitignored .pr-body-*.md (local working copies of long PR bodies).

gh CLI is not authenticated on this workstation, so the PR is created
via the compare URL fallback rather than `gh pr create`.

Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* chore(schema): T3.2 add EFFECTIVE_PERMISSION edge

Adds the cached effective-permissions edge to the v1.0 graph vocabulary.
Materialised by services/api/app/services/effective_permissions/ rather than
the ingest writer, so it carries `actions` (resolved allow-set), an optional
`deny_actions` list, the `policy_chain_ids` provenance trail, and the
`last_resolved` watermark the UI uses for "changes since last week".

Schema is in lockstep across:
  * schemas/graph-schema.yaml
  * services/ingest/internal/graph/schema.go (RelEffectivePermission)

Drift gate (`scripts/export_graph_schema.py --check`) passes: 15 rels (was 14).

* chore(v8.0): refresh PR with wave-2 progress

Wave-2 has begun: T3.2 EFFECTIVE_PERMISSION schema edge has landed
(4ff1b7f4) and several other wave-2 subagents have working-tree
edits in flight. Updated PR title and `.pr-body-wave1.md` template
to reflect "wave-1 + wave-2 (in progress)" framing, and recorded the
current state in AISOC_V8_PROGRESS.md.

`gh` CLI remains unauthenticated, so the PR is still finalised via
the compare URL fallback printed in this commit's accompanying log.

Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* feat(agents): T2.1 pre-fetched ContextBundle

Adds `services/agents/app/context/bundle.py` with a Pydantic
`ContextBundle` model and `ContextBundleBuilder` that fan out concurrently
to four read-only context sources before any sub-agent runs:

* graph neighbourhood (`services/api` — depth-N walk per principal,
  default 2, blast radius score per principal),
* institutional memory (`aisoc_institutional_memory` similar-case verdicts
  with deterministic Jaccard similarity over template_id / response_class
  / category / severity tags),
* peer-entity UEBA baselines (`services/ueba`
  `/api/v1/ueba/baselines`, per-entity peer_group + deviation),
* threat intel (`services/enrichment` bulk endpoint, per-IOC reputation +
  source list).

Refactors the four internal capability shims used by `TriageAgent`
(`phishing_agent.py`, `identity_agent.py`, `cloud_agent.py`,
`insider_threat_agent.py`) to accept an optional `bundle:
ContextBundle | None` parameter. When supplied the bundle's safe summary
fields (entity neighbourhood, similar-case verdicts, max blast radius,
high-risk IOCs, max UEBA deviation) are appended to the LLM prompt; the
sub-agents' own enrichment paths become *augmentations*, not primary
discovery. Backward-compatible — the agents still run as before when
`bundle=None`.

The bundle's `summary_for_llm()` method returns a contract-safe dict
whose keys are explicitly enumerated (`_LLM_SAFE_KEYS`) and never include
raw OCSF / log payloads. T2.3's `LLMInputContract` will treat this shape
as the canonical safe payload.

Test: `services/agents/tests/test_context_bundle.py` exercises the
builder against all 200 deterministic eval incidents and gates on
`p95 < 5s` build latency, plus structural checks (entities extracted,
all four sources called, safe-wrap absorbs source failures, summary
emits only whitelisted keys). Offline build observed at
mean=41ms / p50=41ms / p95=50ms / p99=51ms across 200 incidents.

Refs T2.1 from the v8.0 wave-2 critical path.

Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* feat(ingest): T1.2 config snapshots — :CONFIGURED_AS {ts} edges (wip)

Versioned configuration history captured at ingest time. New
services/ingest/internal/config_snapshot/ package with snapshotter +
Redis-backed TTL cache; BaseConnector.get_resource_config(id, ts) hook
implemented for AWS Security Hub, GitHub, Lacework, Okta. Wired into the
graph writer so resource-touching events upsert :CONFIGURED_AS {ts}
edges to a Configuration node. Fixture-based tests under
services/ingest/test_data/.

Refs: AiSOC v8.0 wave-2 (4hr parallel session, 2026-05-14)
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* feat(agents): T2.3 LLM input contract — fail-closed validator (wip)

Wraps every LLM call in services/agents/app/llm/contract.py.
LLMInputContract (Pydantic) whitelists ContextBundle summary fields,
numerical scores, and RAG snippets; rejects raw OCSF JSON or raw log
lines, raising LLMContractViolation to abort the call. Wired through
existing LLM call-sites.

Refs: AiSOC v8.0 wave-2 (4hr parallel session, 2026-05-14)
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* feat: T3.2 effective permissions resolver (AWS done, others scaffolded) (wip)

AWS IAM identity-based + resource-based + SCP resolution implemented;
Azure/GCP/Okta/GWS resolvers scaffolded behind NotImplementedError.
GET /v1/identity/{principal_id}/effective-permissions endpoint
registered in v1 router. Cytoscape UI page under
apps/web/src/app/(app)/identity/permissions/. Cypher cache writes to
the :EFFECTIVE_PERMISSION edge added in 4ff1b7f4.

Refs: AiSOC v8.0 wave-2 (4hr parallel session, 2026-05-14)
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* feat: T3.3 attack-chain timeline + ranking (wip)

Given a seed alert, expand graph to depth 3 within a 24h window,
collect alerts touching shared entities, score by graph distance +
temporal proximity + risk overlap, persist into a new attack_chains
table (Alembic migration 041). GET /v1/cases/{id}/attack-chain returns
ranked chain + entity graph.

Refs: AiSOC v8.0 wave-2 (4hr parallel session, 2026-05-14)
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* feat: T3.5 business-context rule engine + Monaco editor (wip)

YAML rule definitions parsed into an in-memory DAG and evaluated
post-fusion / pre-triage. CRUD endpoints under /v1/business-context/rules.
Settings UI uses Monaco YAML editor with live preview against the last
100 alerts. Feature flagged behind AISOC_BUSINESS_CONTEXT_ENABLED.

Refs: AiSOC v8.0 wave-2 (4hr parallel session, 2026-05-14)
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* feat(chatops): T3.6 Block Kit + Adaptive Cards + email fallback (wip)

Slack interactive Block Kit cards with HMAC-verified callbacks,
configurable per-action timeout firing safe-default + audit log,
Teams Adaptive Card equivalent under services/teams-bot/, and email
fallback (signed action URLs, 1h TTL) in
services/api/app/services/email_approval.py.

Refs: AiSOC v8.0 wave-2 (4hr parallel session, 2026-05-14)
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* feat(connectors): T4 wave-2 — Cloudflare ZT, Sysdig, Vault, Snowflake, OCI, Sublime, Abnormal, Box, Dropbox, Datadog (wip)

Wave-2 connector additions. Cloudflare ZT, Sysdig, HashiCorp Vault,
Snowflake audit, OCI, Sublime Security, Abnormal Security, Box,
Dropbox, Datadog. Fixtures + tests for the priority subset
(Cloudflare ZT, Sysdig, Vault, Snowflake). Registry + marketplace
manifest sync in a follow-up commit.

Refs: AiSOC v8.0 wave-2 (4hr parallel session, 2026-05-14)
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* feat(bench): T5.3 fidelity benchmark on public datasets (wip)

Loaders + runner for CICIDS-2017 (network intrusion) and CTU-13
(botnet). Datasets are referenced by license-respecting download
scripts under scripts/datasets/; harness lives in
services/agents/tests/fidelity/. Micro fixture cicids_micro.csv keeps
CI fast; full datasets opt-in.

Refs: AiSOC v8.0 wave-2 (4hr parallel session, 2026-05-14)
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* feat(bench): T5.5 wet-eval weekly CI workflow + secrets doc (wip)

Weekly wet-eval cron at .github/workflows/wet-eval.yml runs the live
agent stack against the 200-incident set, captures real tokens / USD /
latency / MITRE accuracy, opens a benchmark-update PR. Guarded by
WET_EVAL_OPENAI_KEY + AISOC_BENCH_BOT_TOKEN; missing secrets cause a
clean no-op via scripts/wet_eval_check.py.

Refs: AiSOC v8.0 wave-2 (4hr parallel session, 2026-05-14)
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* feat(docs): T5.4 public benchmark scoreboard + bench page polish (wip)

MDX scoreboard at /docs/benchmark-scoreboard rendering an
append-only scoreboard.json. Initial rows seeded with current
substrate numbers, clearly labelled substrate:true; T5.5 weekly
wet-eval workflow appends real rows on top. Trend chart + sidebar +
CHANGELOG entry. Marketing /benchmark page touched-up.

Refs: AiSOC v8.0 wave-2 (4hr parallel session, 2026-05-14)
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* feat(marketing): T7.3 three anchor blog posts (graph, latency, L0–L4) (wip)

Long-form posts authored by Prince Sinha (Senior Director,
Innovations at Cyble) on (1) why agentic SOC needs a graph at ingest,
(2) latency budget for sub-minute investigation, (3) L0→L4 SOC
automation maturity. MDX under apps/web/content/blog/, OG SVGs under
apps/web/public/blog/, blog index at /blog. Substrate numbers labelled
explicitly.

Refs: AiSOC v8.0 wave-2 (4hr parallel session, 2026-05-14)
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* chore(v8.0): wave-2 checkpoint — flip 19 tasks to in-progress

T1.2 config snapshots, T2.1 ContextBundle, T2.3 LLM contract,
T3.2 effective permissions, T3.3 attack chains, T3.5 business
context, T3.6 ChatOps approvals, T4 wave-2 connectors (10 of them),
T5.3 fidelity benchmark, T5.4 public scoreboard, T5.5 wet-eval CI,
T7.3 three anchor blog posts. Each commit in this push is its own
slice of the wave-2 work; tasks are marked [~] (in-progress / wip)
because the worker subagents were aborted mid-loop and follow-up
PRs will harden each slice to merge-ready quality.

Refs: AiSOC v8.0 wave-2 (4hr parallel session, 2026-05-14)
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* chore(v8.0): rename branch to v8.0/agentic-soc-foundation

Branch renamed from v8.0/parallel-team-kickoff to
v8.0/agentic-soc-foundation to better describe the deliverable
(graph-at-ingest + four agents + /hunt + 16 connectors + public
benchmark + sovereign GTM). Updates all in-doc references.

Refs: AiSOC v8.0 wave-2 (4hr parallel session, 2026-05-14)
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* chore(v8.0): wave-2 checkpoint state

Mark every wave-2 task as [~] with a one-line note pointing at the
commit that landed its scaffolding (file count or substance), refresh
the PR-context block at the top so it reflects the 12 new wave-2
commits and the new HEAD SHA.

Refs: AiSOC v8.0 wave-2 (4hr parallel session, 2026-05-14)
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* chore(v8.0): record PR URL

Final wave-2 checkpoint — PR is ready to open via the compare URL
(gh CLI is unauthenticated on this workstation, so it can't be opened
non-interactively). Branch was renamed mid-session from
`v8.0/parallel-team-kickoff` → `v8.0/agentic-soc-foundation`; the
compare URL and Branch field updated to reflect that.

Refs: AiSOC v8.0 wave-2 (4hr parallel session, 2026-05-14)
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* feat(api): T6.1 waitlist signup endpoint + model + migration

Adds the public managed-instance waitlist signup endpoint, the admin
triage list / patch endpoints, the supporting per-IP token-bucket
rate limiter, the Slack webhook notifier, and the SQLAlchemy model +
raw-SQL migration that backs the new table.

Public POST /v1/waitlist/signup is rate-limited per source IP
(20 burst, 10/hour sustained, env-tunable). It persists every signup
idempotently (repeat email is a silent no-op so a scraper can't
enumerate), fires a Block Kit message at AISOC_WAITLIST_SLACK_WEBHOOK,
and never lets a Slack outage break the form. Admin GET /entries +
PATCH /entries/{id} are gated by admin:waitlist (falling back to
settings:write) and move rows through the new → contacted →
onboarded → declined ladder, stamping audit timestamps as they go.

Migration 042 lives at services/api/migrations/042_waitlist.sql and
creates aisoc_waitlist_entries with a CHECK on the status ladder,
a unique email constraint, and indexes on status and the optional
provisioned_tenant_id FK (populated when the tenant_provision
pipeline lands in commit 2).

23 pytest cases at services/api/tests/test_waitlist.py exercise
the Pydantic normalisation, idempotent re-submit, 429 on bucket
exhaustion, Slack-failure resilience, admin gate, status filter,
audit-timestamp stamping, and the Block Kit message shape — all
green. The signup endpoint is intentionally not yet wired into
the v1 router; Subagent A's stabilization push will register it.

Refs: AiSOC v8.0 wave-3 T6.1
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* fix(agents): T2.6 use relative import for fidelity harness loaders

Pytest collects services/agents tests with ``services/agents`` on the
PYTHONPATH (via the ``tool.pytest`` rootdir / conftest hooks), so the
top-level package is ``tests``, not ``services.agents.tests``. The
absolute import path baked into the wave-2 commit raised
``ModuleNotFoundError: No module named 'services'`` at collection time,
which silently masked the entire fidelity harness module.

Switch to ``from tests.fidelity import ...`` to match how every other
file under ``services/agents/tests`` references its sibling subpackages.

Refs: AiSOC v8.0 wave-2 stabilization
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* fix(agents): T2.x bind app.investigator stub on parent app module

Both ``tests/test_audit_helpers.py`` and ``tests/test_llm_resolver.py``
substitute a hollow ``app.investigator`` package in ``sys.modules`` to
avoid pulling LangGraph / OpenAI through the real package ``__init__``.
However, neither file rebound that stub on the parent ``app`` module's
namespace. ``monkeypatch.setattr("app.investigator.responder_agent.X")``
in ``tests/test_four_agent_facade.py`` walks the dotted path via
``getattr(app, "investigator")`` — and once collection order placed
``test_audit_helpers`` before ``test_four_agent_facade`` the patcher
failed with ``AttributeError: 'module' object at app.investigator has
no attribute 'investigator'``.

``test_llm_resolver._stub_ledger`` exhibited the symmetric bug: it
relied on ``sys.modules[...]`` substitution for ``app.investigator.ledger``
without rebinding ``ledger`` as an attribute on ``app.investigator``.
Once another test caused the real ``ledger`` module to be imported,
``from app.investigator import ledger as _ledger`` inside
``resolve_llm_config`` resolved to the real module (which then tried to
hit Postgres) instead of the stub.

Fix both:
* ``test_audit_helpers`` — after registering the stub in
  ``sys.modules``, also set ``_app_pkg.investigator = pkg`` so the
  dotted ``getattr`` walk succeeds for the rest of the session.
* ``test_llm_resolver._stub_ledger`` — mirror the fix and additionally
  ``monkeypatch.setattr`` ``ledger`` on the (possibly real) parent
  package so the lazy import inside ``resolve_llm_config`` lands on the
  fake.

After this change the full ``services/agents`` test suite passes:
275 passed, 2 skipped, 0 failed.

Refs: AiSOC v8.0 wave-2 stabilization
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* feat(api): T6.1 tenant provisioner service + migration

Adds the admin-side flow that promotes a waitlist entry from commit 1
into a real tenant on app.aisoc.dev, plus the migration that wires the
tenants table to the waitlist table.

The provisioner (services/api/app/services/tenant_provision/) is split
into three modules so the orchestration stays separable from the seed
content:

* provisioner.py drives the steps end-to-end -- load the waitlist row,
  derive a unique URL slug from the company name with collision
  retries, mint a fresh Fernet aisoc_credential_key (only the
  fingerprint is persisted in tenants.settings; the plaintext key
  never round-trips through the database), seed the demo dataset via
  an injectable callback, mint a one-week admin invite token + URL,
  and flip the waitlist row to onboarded with the contacted/onboarded
  timestamps stamped. Idempotent on the waitlist entry id: a repeat
  call returns the existing tenant plus a fresh invite link instead
  of minting a duplicate tenant.

* templates.py ships pure-data seed content -- four RBAC roles
  (tenant_admin / soc_manager / soc_analyst / viewer), six starter
  Sigma-style detections covering PowerShell, impossible travel,
  Okta MFA bombing, AWS IAM privesc, EDR tamper, and password spray,
  and three response playbooks (phishing triage, suspicious login,
  ransomware tabletop). Zero DB imports so it stays trivially
  testable.

* __init__.py re-exports the surface so callers can do
  ``from app.services.tenant_provision import provision_from_waitlist``.

Endpoints land at POST /v1/admin/tenants/provision (creates a tenant
from a waitlist entry id, gated on admin:tenants with a settings:write
fallback for unmigrated RBAC rows) and GET /v1/admin/tenants (slug-and-
name search + managed_only filter for the support triage view). The
typed provisioning errors -- WaitlistEntryNotFoundError /
WaitlistEntryNotPromotableError / SlugCollisionError -- map onto
404 / 409 / 409 responses so the admin UI can render them cleanly.

Migration 043 adds tenants.provisioned_from_waitlist_id (FK back to
the waitlist, ON DELETE SET NULL so deleting an entry never orphans a
live tenant) and tenants.provisioned_at, plus the reverse FK on
aisoc_waitlist_entries.provisioned_tenant_id. The Tenant ORM model in
app/models/tenant.py is not modified -- that file is owned by
Subagent A's wave-2 stabilization push -- so the provisioner persists
the new columns via raw SQL UPDATE and mirrors the same values into
tenants.settings (JSONB) for the Python wire path. Once the ORM
mapping catches up the mirror can be dropped; a TODO marks the spot.

33 pytest cases in services/api/tests/test_tenant_provision.py
exercise the slug normalisation + collision retries, credential-key
minting, invite URL builder, idempotent replay, the demo-seeder hook
(including the failure-isolation contract), the 403 / 404 / 409 / 201
endpoint matrix, and the JSONB-backed managed_only filter. All green;
the broader waitlist suite from commit 1 still passes too (56 tests
total).

The endpoint module is intentionally not yet wired into the v1
router; Subagent A registers it once the stabilization push lands.

Refs: AiSOC v8.0 wave-3 T6.1
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* feat(web): T6.1 marketing /waitlist page + admin tables

Adds the three new T6.1 client surfaces:

  • `apps/web/src/app/(marketing)/waitlist/page.tsx`
    Public landing page for the invite-only managed beta. Hero
    plus a five-field form (email, company, role, multi-select SOC
    stack, motivation textarea) that POSTs to
    `/v1/waitlist/signup`. Tracks a clean error/success/rate-limit
    state machine on the client; the success state is a quiet
    "we'll be in touch within 5 business days" card. Visual chrome
    mirrors `/sovereign` so it feels native to the marketing site
    without forking the design system.

  • `apps/web/src/app/(app)/admin/waitlist/page.tsx`
    Sales/triage surface inside the AppShell. Polled list of every
    waitlist entry with status-tab filters, in-row status patches
    (`new → contacted → onboarded → declined`), and a "Promote to
    tenant" action that calls `/v1/admin/tenants/provision` and
    surfaces the resulting slug + invite URL as a one-shot card so
    the operator can copy-paste it to the customer.

  • `apps/web/src/app/(app)/admin/tenants/page.tsx`
    Read-only tenants directory. Free-text slug/name search plus a
    "managed-only" toggle so the support team can scope to tenants
    that came in through the T6.1 provisioning flow. Each row
    links to `/admin/tenants/{slug}` for the (forthcoming) detail
    page.

Notes
-----
The TODO comment about wiring the new endpoints into the API v1
router (left in `services/api/app/api/v1/endpoints/{waitlist,tenant_provision}.py`)
still applies — until Subagent A's stabilization push lands the new
routes will return 404. The pages are intentionally written against
the documented wire contract so they just start working the moment
the routes register.

Typecheck
---------
The pre-existing repo-wide `pnpm type-check` is red on
`BusinessContextSettings.tsx` (Subagent A's territory; missing
sibling modules from the wave-2 wip). The three new files
typecheck clean in isolation against the project's tsconfig:

    npx tsc -p tsconfig.subset.json --noEmit   # exit 0

No Vitest tests added (Subagent A is still fixing the runner).

Refs: AiSOC v8.0 wave-3 T6.1
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* fix(eval): reorder sys.path in run_evals.py so services/agents/tests wins

scripts/run_evals.py inserts both scripts/ and services/agents/ on sys.path
so that scripts/eval_telemetry.py and the harness-side tests both import.
But scripts/ also contains a tests/ package (scripts/tests/__init__.py,
test_run_evals_cli.py) used for the CLI smoke test. With the previous
ordering (agents first, then scripts on top), scripts/tests/ landed at
position 0 and shadowed services/agents/tests/, so the eval harness
crashed with "ModuleNotFoundError: No module named 'tests.test_adversary_eval'"
in CI.

Reverse the order: insert scripts/ first, then agents/ on top, so
`from tests.test_adversary_eval import ...` resolves to the substrate
tests. Verified locally that the import now succeeds.

Fixes the P1 Eval — Pillar-1 Eval Harness Gate failure on PR #125.

* chore(lint): apply ruff auto-fixes across services/

CI's Python — Lint & Type-check stage reported 75 ruff violations on
the PR #125 head commit, blocking merge. Run `ruff check --fix` and
`ruff format` from the repo root (matching the CI invocation in
.github/workflows/ci.yml) and commit the result.

Categories of fixes applied:

- UP037 (services/agents, services/api, services/connectors,
  services/teams-bot): remove redundant string-form type annotations
  in modules that import `from __future__ import annotations`. Quoted
  forward refs were left over from before the module-wide future
  import landed.

- I001 (services/connectors/snowflake.py,
  services/slack-bot/tests/test_hmac_verify.py): re-sort and collapse
  import blocks. snowflake.py had two adjacent imports from
  cryptography.hazmat.primitives.serialization that ruff merged.

- B905 (services/connectors/snowflake.py): add `strict=False` to
  zip(cols, row) in the result-set hydration path; the underlying
  Snowflake REST response guarantees aligned lengths but ruff's
  defensive default still applies.

- F811 (services/connectors/app/connectors/base.py): drop the
  duplicate `get_resource_config` method definition that landed
  twice during the T1.2 config-snapshot rebase. The earlier copy
  was identical and unreachable.

- E501 (services/connectors/{pagerduty,snowflake,tines}.py,
  services/api/app/scripts/seed_demo.py,
  services/api/app/services/email_approval.py): line-length fixes,
  mostly collapsing pre-wrapped f-strings ruff considers fine at
  140 cols.

- B017 (services/api/tests/test_waitlist.py): annotate the
  intentional `pytest.raises(Exception)` calls in the rate-limit
  fail-open tests with `# noqa: B017` — the test deliberately
  asserts blind exception swallowing.

No behavioural changes. Verified locally with
`ruff check services/ && ruff format --check services/` — all green.

Fixes the Python — Lint & Type-check failure on PR #125.

* feat(web): complete business-context settings UI (client + rule builder + preview)

The business-context settings page was committed in 0efe3da5 with
BusinessContextSettings.tsx already importing three sibling modules:

  import { loadRules, saveRules, previewRules } from "./client";
  import { RuleBuilder } from "./RuleBuilder";
  import { PreviewTable } from "./PreviewTable";

…but the three modules themselves were never landed, so the
`Web — Lint & Type-check` and `docker compose up — full stack`
CI stages both fail with TS2307 / "Module not found" on PR #125.

Add the three missing files:

- client.ts: typed fetch wrapper over the existing
  /api/v1/business-context/rules and /preview endpoints. Mirrors the
  Pydantic wire shapes from services/api/app/services/business_context/
  models.py so the rest of the feature stays self-contained and we
  don't reach into @aisoc/types for one-off shapes. Adds the
  X-Tenant-Id + Authorization headers via the shared session helper.

- RuleBuilder.tsx: side-panel form (name, scope, conditions,
  actions, priority) that emits a YAML snippet via the same shape
  the backend engine expects. The "Append to editor" button hands
  off to the Monaco editor in BusinessContextSettings rather than
  POSTing directly, so the user still sees diff + validation before
  saving.

- PreviewTable.tsx: renders the preview API response — before/after
  severity, suppression, and routing — with row-level highlighting
  for changed rows. Empty state, loading state, and error state
  match the rest of the settings UI.

Verified locally:
  pnpm --filter @aisoc/web type-check  # clean
  pnpm --filter @aisoc/web exec eslint \
    src/app/\(app\)/settings/business-context/  # 0 warnings

Fixes the Web — Lint & Type-check and docker compose up — full stack
failures on PR #125.

* chore(generated): refresh openapi, marketplace index, detection coverage

These artifacts are validated by dedicated CI gates that diff the
checked-in copies against a freshly-generated version. The PR #125
branch had drifted, so:

- "Verify docs/openapi.yaml is up to date" was failing with
    docs/openapi.yaml is out of date.
    Run: python scripts/export_openapi.py
- "Validate & sync marketplace/index.json" was failing with
    marketplace/index.json is stale.
    Run: pnpm marketplace:build

Regenerate from current source of truth:

- docs/openapi.yaml: produced by `python scripts/export_openapi.py`
  against the merged services/api app. The +683 diff is mostly
  business-context, attack-chain, effective-permissions, and
  tenant-provision endpoints that landed during the rebase. Verified
  the run matches the dependency set declared in
  .github/workflows/check-openapi.yml (OPENAPI_DEPS).

- marketplace/index.json + marketplace/curated.json: produced by
  `pnpm marketplace:sync` which runs scripts/build_marketplace.py and
  scripts/curate_detections.py end to end. The web public copies
  under apps/web/public/marketplace/ are mirrored from the canonical
  copies so the docs site stays in sync.

- apps/docs/docs/detections/coverage.md: one-line refresh produced
  by the detection coverage generator that runs as part of the
  marketplace sync — keeps the published MITRE coverage table aligned
  with detections/ on disk.

Pure generated output, no hand edits. Fixes the marketplace and
OpenAPI verify failures on PR #125.

* fix(web/tests): isolate SWR cache per render in SOCInsightsView tests

SWR keeps a single global cache by default, so the first test in the
file ("renders a skeleton placeholder before data resolves") which
returns `new Promise(() => {})` to hold the fetch open was pinning the
SWR key `['insights:soc', '24h']` in a forever-loading state. The next
two tests ("renders all seven tile labels" and "renders an error state")
then re-used that same cache entry, never saw their mocked fulfilled /
rejected promises, and timed out looking for `MTTA` and `role="alert"`.

Wrap each render in a fresh `<SWRConfig provider={() => new Map()}>` so
every test gets its own clean cache. No production code changes — this
is purely a test-isolation fix.

Verified locally: pnpm vitest run src/components/soc-insights/SOCInsightsView.test.tsx
→ 7/7 pass in ~75ms.

* fix(api): rename attack_chains.window → time_window (PG reserved keyword)

The `docker compose up — full stack` CI job was failing because
`aisoc-postgres` exited (3) while applying migration 041:

    psql:/docker-entrypoint-initdb.d/041_attack_chains.sql:70:
    ERROR: syntax error at or near "window"

`window` is a reserved keyword in PostgreSQL (it's the keyword used by
SQL window functions, e.g. `WINDOW w AS (PARTITION BY ...)`), so using
it as a bare column name in a `CHECK` and `UNIQUE` constraint fails
to parse on Postgres 14+. SQLAlchemy quoted it for us during normal
DML, which is why the table created cleanly in earlier dev runs, but
the raw CREATE TABLE in the migration script does not auto-quote.

Rename the column to `time_window` everywhere in the SQL schema:
  - column definition
  - aisoc_attack_chains_window_check
  - aisoc_attack_chains_unique_signature

Update the upsert in `endpoints/attack_chain.py` to write to and
ON CONFLICT against `time_window`. The Python parameter / API surface
keeps its original name (`window`) so the service layer is unaffected.

Added a comment in the SQL explaining why the column is named
differently from its service-layer alias.

* fix(codeql): sanitize log inputs, remove unused vars, drop duplicate imports

Clear remaining CodeQL alerts blocking PR #125:

- alerts.py: explicitly strip CR/LF from idempotency_key at the source
  (right after regex validation) so CodeQL's py/log-injection taint
  analysis recognises it as sanitised, and wrap payload.connector_type
  with a _log_safe() helper before it enters log records.
- ssrf_guard.py: drop unused `logger` global and `import logging`
  (py/unused-global-variable).
- test_plugin_manager.py: stop re-importing app.services.plugin_manager
  inside _stub_oras_pull — read it from sys.modules instead, fixing
  py/import-and-import-from.
- QueueView.test.tsx: remove unused `waitFor` import
  (js/unused-local-variable).
- blog.ts / customers.ts: sanitize slugs before they reach href / dom
  (js/stored-xss).
- render_eval_charts.py: wrap a multi-line string literal in explicit
  parens so it stops triggering py/implicit-string-concatenation-in-list.

No behaviour changes — the regex on idempotency_key already forbids
CR/LF, and connector_type is constrained by the Pydantic model; this
is purely so CodeQL's taint tracker can see the cleansing happen.

* feat(connectors): T4 register wave-2 connectors in registry

Wave-2 dropped ten new connector classes but did not wire them into
``services/connectors/app/connectors/__init__.py``. That meant their
``CONNECTOR_REGISTRY`` lookups returned ``None``, ``schema()`` was
unreachable through the FastAPI surface, and every wave-2
``test_registry_contains_*`` assertion failed.

Register all ten in alphabetical order alongside the existing tuple,
mirror them into ``__all__`` for ``from app.connectors import …``
consumers, and import the modules eagerly so a broken connector
surfaces at process start rather than first poll:

* abnormal_security  → AbnormalSecurityConnector
* box                → BoxConnector
* cloudflare_zt      → CloudflareZTConnector
* datadog            → DatadogConnector (distinct from the existing
                       ``datadog_cloud_siem`` connector)
* dropbox            → DropboxConnector
* oci                → OCIConnector
* snowflake          → SnowflakeConnector
* sublime_security   → SublimeSecurityConnector
* sysdig             → SysdigConnector
* vault              → VaultConnector

After this change ``CONNECTOR_REGISTRY`` carries 68 entries and the
wave-2 ``test_registry_contains_*`` tests pass.

Refs: AiSOC v8.0 wave-2 stabilization
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* fix(connectors): T4.7 sysdig escalates terminal-shell rules to high

The wave-2 sysdig normaliser only escalated 'drift' / 'tampering'
rule names to high severity, leaving 'Terminal shell in container'
events at the rule's nominal severity (warning → low) even though
that Falco rule is the canonical 'someone is using a shell inside a
prod container right now' signal that should never be benign.

Extend the escalation predicate to also fire on rules whose name
contains 'terminal shell' or 'shell in container' so the wave-2
fixture event ``ev-001`` (rule 'Terminal shell in container',
severity=4) normalises to 'high' and satisfies
``test_normalize_terminal_shell_to_high``.

Refs: AiSOC v8.0 wave-2 stabilization
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* fix(connectors): T4.1 cloudflare_zt trusts cursor over short-page heuristic

The wave-2 pagination loop terminated on ``not cursor or len(events)
< _PER_PAGE``. Cloudflare's new security-events endpoint routinely
returns a ``result_info.cursor`` even when a page comes back short,
so the short-page heuristic was clobbering legitimate continuations
and dropping every-other event.

Drop the page-size check; trust the cursor as the authoritative
end-of-stream signal. The wave-2 pagination test now sees both pages
(3 + 1 = 4 events) instead of stopping after page 1.

Refs: AiSOC v8.0 wave-2 stabilization
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* chore(v8.0): record eval before/after for PR review

Capture the four-axis substrate metrics plus the extended suite stack and
the wave-2-only per-investigation telemetry block, comparing
``upstream/main`` (commit 182afc5b) against
``v8.0/agentic-soc-foundation`` (commit 9a5e63ed). Both runs use the
deterministic 200-incident synthetic dataset, so any axis movement would
reflect substrate behaviour rather than LLM stochasticity.

Result: no regression. All four axes (mitre_accuracy 0.97, alert_reduction
0.753, investigation_completeness 0.9425, response_quality 1.000) hold
identically across the two branches, and the seven extended suites stay
green with the same values. Wave-2's only visible delta is the new
``per_investigation`` block (T2.3) which adds tokens / USD / latency
percentiles to the report on the wave-2 branch where the upstream report
emits an empty section.

This file is the cut-and-paste source for the PR's eval-harness section.

Refs: AiSOC v8.0 wave-2 stabilization
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* fix(slack-bot): T3.6 suppress CancelledError on approval-scheduler aclose

``ApprovalTimeoutScheduler.aclose()`` cancels every armed timer task and
then awaits each one so the FastAPI lifespan can deterministically drain
its scheduler before the process exits. The await was wrapped in
``contextlib.suppress(Exception)``, but ``asyncio.CancelledError`` is a
``BaseException`` (not an ``Exception``) on Python 3.8+, so the very
``CancelledError`` we just triggered via ``task.cancel()`` propagated
out of ``aclose`` and tore down the lifespan with one cancellation per
pending timer.

Suppress ``asyncio.CancelledError`` alongside ``Exception``. Cancellation
on this code path is the expected outcome, so swallowing it is correct.

Refs: AiSOC v8.0 wave-2 stabilization
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* fix(slack-bot): T3.6 expose approve_action/reject_action on lifespan mock

The wave-2 lifespan handler hands ``actions_client.approve_action`` and
``actions_client.reject_action`` to ``ApprovalTimeoutScheduler`` at
startup so a forgotten Approve/Deny falls through to the safe default.
The ``_RecordingActionsClient`` test double in ``test_main.py`` only
defined ``aclose`` / ``from_settings`` / ``base_url``, so the lifespan
startup raised ``AttributeError`` and ``test_lifespan_builds_and_closes_clients``
failed.

Add stub ``approve_action`` and ``reject_action`` coroutines on the
mock — they're never invoked during the test (the scheduler only stores
the callable references at startup), but they have to exist for the
``getattr`` lookup to succeed.

Refs: AiSOC v8.0 wave-2 stabilization
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* feat(infra): T6.1 terraform skeleton for managed Fly.io + Postgres + Redis

Adds the bootstrap Terraform stack for the `app.aisoc.dev` managed
offering under `infra/terraform/environments/managed/`:

  • `main.tf`       — Fly.io app + Postgres cluster + Redis +
                       Cloudflare CNAMEs (`app.aisoc.dev`,
                       `realtime.aisoc.dev`). Uses the
                       `fly-apps/fly` community provider, deliberately
                       pinned loosely until an operator validates a
                       known-good release. A random 4-char suffix
                       disambiguates the globally-unique Fly app
                       names so the same prefix can be reused for
                       staging.

  • `variables.tf`  — Operator-facing inputs. Every secret
                       (`fly_api_token`, `cloudflare_api_token`,
                       `cloudflare_zone_id`, `redis_url_override`)
                       is `sensitive = true` with a `null` default so
                       terraform errors out fast if the matching
                       `TF_VAR_*` env var is missing. Non-secret
                       inputs (Postgres VM size, volume size, node
                       count, region, hostname) have validated
                       defaults sized for the beta cohort.

  • `outputs.tf`    — App name, Fly hostname, dedicated IPs,
                       Postgres app name, Redis URL (sensitive),
                       public app URL, Cloudflare record id, and a
                       `bootstrap_checklist` text output that prints
                       the post-apply runbook inline.

  • `README.md`     — Operator playbook: prerequisites, the three
                       `TF_VAR_*` env vars that must be exported, the
                       `init` / `plan` / `apply` flow, the
                       `fly attach` + `fly secrets` + `fly deploy`
                       follow-up, and what this stack explicitly does
                       NOT do (app secrets, image builds, per-tenant
                       resources, backups).

Notes
-----
No real secrets are committed. All sensitive values flow through
`TF_VAR_*` env vars or downstream `fly secrets set` calls; this stack
deliberately does not roundtrip the Fernet credential-vault key or
LLM provider tokens through Terraform state.

The remote-state backend (`s3` and `remote`) blocks are commented out
on purpose so a fresh operator can decide whether to keep state local
(fine for a one-laptop bootstrap) or wire it into Terraform Cloud /
an S3-compatible store before any team-shared deploy.

`terraform fmt` was not run in CI because the sandbox doesn't ship
the binary; brace balance was sanity-checked manually
(main.tf 26/26, variables.tf 20/20, outputs.tf 19/19).

Refs: AiSOC v8.0 wave-3 T6.1
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* feat(agents): T2.2 LangGraph parallel topology — concurrent sub-agent fan-out

New router orchestrator package at services/agents/app/orchestrator/ that
replaces the sequential auto_triage → phishing → identity → cloud → insider
→ responder chain with a fan-out / join shape:

  auto_triage  ──►  classify signals  ──►  asyncio.gather fan-out over the
                                            triggered sub-agents ──►  Join
                                            ──►  Responder (dry-run)

Selection between the new parallel path and the legacy sequential
reference path is controlled by AISOC_AGENT_PARALLEL_TOPOLOGY (default ON
for dev / CI / test; flip OFF in prod until the wet-eval scoreboard is
green). Both modes are tested against a multi-signal incident (INC-PH-
LATERAL) — substrate wall-clock for parallel is 68% under sequential
(0.32 ratio), well past the ≥30% gate, and the MITRE technique set is
identical between modes.

Tests
-----
- services/agents/tests/test_orchestrator_parallel.py — flag plumbing,
  classifier coverage, substrate parallel/sequential delta + MITRE
  preservation, auto-close short-circuit on both topologies, Join-node
  dedupe contract.
- services/agents/tests/test_latency.py — full 200-incident substrate
  gate. Substrate p50 = 12.6 ms, p95 = 13.6 ms (budgets: p50 < 60s,
  p95 < 120s). Numbers are substrate self-consistency: the router shape
  is the unit under test; real LLM-backed latency lives on the wet-eval
  scoreboard.

Eval re-grade (AISOC_AGENT_PARALLEL_TOPOLOGY=1, full 4-axis substrate):
  mitre_accuracy           0.97 → 0.97  (no change)
  alert_reduction          0.753 → 0.753 (no change)
  investigation_completeness 0.9425 → 0.9425 (no change)
  response_quality         1.000 → 1.000 (no change)
  all gates PASS

Surface preserved
-----------------
The legacy services/agents/app/investigator/ pipeline is untouched; the
new router lives alongside it and operates on InvestigationState (the
four-agent shared state). Existing test suite continues to pass
(514 passed locally).

Refs: AiSOC v8.0 wave-2

Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* fix(security): resolve remaining CodeQL alerts on PR 125

- blog/page.tsx, customers/page.tsx: sanitize slug with encodeURIComponent
  in a `safeSlug` variable used for both `key` and `href`, breaking the
  taint flow CodeQL was tracking from filesystem paths to href output
  (js/stored-xss alerts 404, 405, 406).
- export_graph_schema.py: replace bare `except Exception: pass` in the
  driver-close finally block with `contextlib.suppress(Exception)`
  (py/empty-except alert 409).
- wet_eval_check.py: emit a static SKIP log line instead of the
  dynamic reason string so missing-secret *names* never leave the
  workflow log (py/clear-text-logging-sensitive-data alert 407). The
  full missing-secret list still lands in status.json, which is
  internal to the job.

* fix(docs): unbreak pagerduty.md cross-references to non-existent paging page

The wave-2 docs build failed on two ``/docs/connectors/pagerduty-paging``
links from ``pagerduty.md`` — the target page has never been written.
The broken cross-reference predates wave-2 (introduced in 431ad343 when
the PagerDuty audit connector landed) but was masked until Docusaurus
broken-link checking ran as part of the wave-2 CI matrix.

Strip the markdown link wrappers, keep the descriptive text, mark both
references as "doc page TBD". This unblocks the docs build without
losing the editorial intent that the paging plugin is a separate
artefact from the audit connector.

Refs: AiSOC v8.0 wave-2 stabilization
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

* fix(agents): replace constant getattr() with direct attribute access (B009)

Resolves ruff B009 errors in the orchestrator router that block the
Python — Lint & Type-check CI gate.

* chore(lint): apply ruff format + drop invalid noqa directive

- Reformat 3 files flagged by `ruff format --check services/`:
  router.py, test_latency.py, sysdig.py
- Remove invalid `# noqa: deferred` directive in easm.py (ruff
  expects an error-code list, not a free-form tag — directive
  no longer needed since the deferred import is intentional and
  not actually flagged).

Unblocks `Python — Lint & Type-check` on PR #125.

* docs(design): landing page product brief + ready-to-set copy for UX kickoff

Add a complete UX kickoff bundle under docs/design/ so the lead designer
can produce the aisoc.dev marketing landing page without reading the
repo end-to-end. Four files, all confined to docs/design/, no code paths
touched:

- landing-page-brief.md: 17-section product brief covering document
  control, positioning, three target personas with full JTBD/pains/
  outcomes, five ranked value props citing shipped files, four
  differentiation pillars, a section-by-section IA spec for 17
  anchors, brand and visual direction quoting the live tailwind /
  globals.css tokens, copywriting principles with banned phrases,
  CTA and conversion model, SEO and metadata, WCAG AA accessibility
  contract referencing the existing axe-core CI gate, performance
  budget, responsive breakpoints, out-of-scope list, 12 open questions
  for the designer, an appendix of 10 adjacent-category design
  references, and a feature x section content matrix sourced from
  AISOC_V8_PROGRESS.md and the v7.3.1 codebase.
- landing-page-content.md: drop-in copy for every section in the IA
  (headlines, sub-heads, body text, button labels, FAQ answers,
  footer links). No lorem ipsum anywhere.
- landing-page-references.md: condensed teardown notes for the 10
  competitive design references, each tagged "what to steal / what to
  avoid." No SOC-category vendors named (per AGENTS.md rule).
- README.md: 20-line index of the three files.

All substrate vs. wet-eval distinctions preserved per AGENTS.md.
69 connectors, 6,998 detection rules, 62 playbook packs, and the
four-agent (Detect / Triage / Hunt / Respond) topology are pulled
from the actual codebase, not summarised back. Word counts: brief
~6,300; content ~2,500; references ~1,100; index ~190.

Refs: AiSOC v8.0 GTM landing-page brief
Signed-off-by: Prince Sinha <prince.sinha@cyble.com>

---------

Signed-off-by: Prince Sinha <prince.sinha@cyble.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Beenu Arora <beenu@cyble.com>
Co-authored-by: aisoc-bot <aisoc-bot@users.noreply.github.com>
2026-05-14 21:47:14 +08:00