Commit Graph
2 Commits
Author SHA1 Message Date
Beenu AroraandBeenu Arora e78f31768c Move all fourteen ruff declarations to 0.16, and stop the lint gate at services/ (#861)
* Reformat the tree under ruff 0.16, excluding the subtree nobody may edit

Mechanical. `ruff format` with no other change, so the diff can be read as
"the formatter moved" rather than reviewed line by line: 218 files, 862
insertions against 1075 deletions, almost all of it collapsing calls that
0.4.10 wrapped and 0.16 fits inside the 140-column limit.

`plans/` is excluded in `ruff.toml` rather than reformatted. It is the
archived prototype subtree that `.github/workflows/codeql.yml` already
excludes and `scripts/check_mypy_baseline.py` excludes from every coverage
direction, and the project rules forbid editing anything under it -- so
formatting it would be a diff nobody may take. 844 lint findings and ~280
unformatted files live there. They are excluded because they cannot be
fixed, which is a different statement from saying the code is clean.

* Move all fourteen ruff declarations to 0.16, and stop the lint gate at services/

The bump alone reds every open pull request: `ruff format --check` is a hard
gate on the required `Python - Lint & Type-check` job and 0.16 formats
differently from 0.4.10. The reformat is the previous commit; this one moves
the pin, fixes the findings, and answers the scope question.

Fourteen declarations now read `>=0.16.8,<0.17` -- seven manifests, three
workflows, `.devcontainer/Dockerfile`, and the three `poetry.lock` files that
resolve it (now 0.16.9, which is byte-identical to 0.16.8 on both format and
lint across this tree).

The three findings 0.16 reports on `services/` are fixed, not suppressed: two
`C420` comprehensions become `dict.fromkeys` (both values are string literals,
so the shared-value hazard does not apply) and one `UP031` percent-format
becomes an f-string in a test that counts characters. All three rewrites were
asserted equal to the originals before being kept.

Scope. `ruff check services/` left `scripts/` -- every CI gate in this
repository, the code the rest of its claims are verified by -- linted by
nothing. Lint now covers `services/ scripts/ tests/ tools/`, the trees the
root `ruff.toml` governs that nothing else lints, and `ruff format --check .`
covers everything, because formatting has no semantic content and `.` needs
no edit when a tree is added. That surfaced 17 findings outside `services/`,
each fixed at the source: two `B007` loops switched to `.values()`, a `B904`
re-raise in `security_audit.py` now chains `from exc`, two `E402` imports
that genuinely follow a `sys.path` mutation carry a reason next to the
marker, and two over-length lines were wrapped.

`E501` is ignored for the two detection-spec data modules. Both open their
rule table with `# fmt: off`, so the formatter is already opted out of that
layout deliberately, and all 199 long lines are single dict or string
literals -- 72 positive fixtures, 66 negative, 50 `match_when` clauses, 11
descriptions. Two named files, not `scripts/`.

`packages/` and `plugins/` stay outside the lint gate, and the gap is a
number rather than a shrug: 91 findings and 2. Two of the five packages are
linted by their own workflows under their own configs, and bringing the
three published SDKs under this gate means behaviour-touching fixes that
belong in a change reviewed as such.

* Make packages/aisoc-detections clean under the ruff its own workflow now installs

`python-detections.yml` lints `aisoc_detections detections tests` under the
pin this PR moved, so the package has to be clean under 0.16 too. Two
findings, both fixed at the source rather than silenced: `Callable` moves to
`collections.abc`, and a `# noqa: BLE001` that 0.16 correctly reports as
unused becomes the sentence it was standing in for -- a detection module is
third-party content, so any exception at import is the author's and becomes a
DetectionError naming the file.

---------

Co-authored-by: Beenu Arora <beenu@MacBook-Pro-3.local>
2026-09-24 19:36:59 -07:00
Beenu Arora e0cbbf0b80 Finish the plan: docs coverage, verification, injection eval, ops (#697)
* docs: generate a page for every connector, and gate the coverage

35 of 84 connectors had no documentation page, and the sidebar listed 34
entries against 96 files — so most connector documentation either did not
exist or could not be navigated to. A page nobody can reach is barely a page.

Writing 35 by hand is the obvious response and the wrong one. A hand-written
field list states what a connector needed on the day it was written and says
nothing when a field is added, renamed or made secret. The catalogue would be
documented once and wrong thereafter, which is how the 43 existing pages
reached the state below.

Pages are generated from `schema()` — the same source the setup wizard
renders from, the marketplace manifest mirrors and the API validates against.
Hand-written pages are left alone, because they are richer than a generator
can produce; they receive a generated field-reference block instead, so the
prose stays human and the field list stays derived. The sidebar is generated
too, from the same list.

The gate found real gaps while being built. Eighteen hand-written pages
omitted a required or secret field, several omitting the credential itself —
`oci` documented none of its four, including the private key. Those now carry
a complete reference.

Two bugs in my own generator, both caught by reading the output:

  Secrets are marked by `type="secret"` on most connectors and a `secret=True`
  attribute on a few. Reading only the attribute meant the generated pages
  said nothing about credential handling for exactly the fields that needed
  it.

  Keying page ownership on the "Generated by" string made every augmented
  hand-written page look generator-owned on the next run, so the generator
  offered to overwrite the prose it had just been careful to preserve.
  Ownership is now the HUMAN NOTES block, which only full pages carry.

Verified in both directions: removing a secret row from a generated page and
stripping the reference from a hand-written one each fail the gate.

* docs: the v8.0 flagship had no pages; write them, and gate the funnel contract

Four capabilities shipped in v8.0 and v7.7 with no documentation at all, and
one endpoint grew eight fields nobody wrote down.

**Securing the AI estate** was the v8.0 headline feature and had zero pages.
The new one states what it is and, more usefully, what it is not: this is not
a guardrail, it does not sit inline, and it cannot see an agent that bypasses
your gateway. It also states the two limits an operator needs before relying
on it — behavioural rules need about a week of baseline, and hashing prompts
by default bounds what an investigation can conclude. That trade is the right
default and the page says so rather than hiding it.

**Windowed detections** explains why a second engine exists (a threshold rule
needs per-entity state, which would slow every stateless rule if they shared
an evaluator), and records the bug it was born with: the matcher read fields
flat while connectors nest under `raw_event`, so any nested-field rule matched
nothing — silently, because a rule that never fires and a rule with nothing to
fire on look identical from outside.

**Groundedness and abstention** documents the thing that stops a confident,
fluent, wrong verdict from auto-closing an alert, and is explicit about what
it does not do: an agent can cite four real addresses and reach the wrong
conclusion and still score 1.0. It is a floor against fabrication, not a
correctness measure. Includes the four-way read of groundedness against
abstention rate, because a persistent zero in `ungrounded_demotions` alongside
low `scored_verdicts` means the check is barely running, not that nothing is
ungrounded — and those are easy to confuse.

**Python detection specs** documents the third authoring mode and leads with
the advice to not use it. It also records why the negative fixture is the one
that matters: roughly 600 of 825 fixtures were synthesized from the rule they
test, so replay was tautological and could never catch a rule matching a field
nothing produces.

**The funnel contract** is now gated. Eight fields — repeat suppression,
abstention, ungrounded demotions, mean groundedness — shipped undocumented,
and they are the eight that say whether the automation is working honestly. A
number nobody documents is a number nobody checks, which is how
`repeat_alerts_suppressed` reported a flat zero for an entire release. The
gate parses the endpoint's returned keys and fails when one is missing from
the page.

* fix: lead the README with a command that works, and let the demo deploy provision itself

**The hero command 404s.** The README opened with `npx aisoc triage --demo`
in the largest code block on the page. `aisoc` is not on npm — the first
thing a visitor runs is the one thing that cannot work, and the guard
explaining that sat in a parenthetical above it.

The page now leads with the sandbox, which works today from a clean machine
in under five seconds, and `npx aisoc` moves into the options table where its
row says plainly that it is not published yet and will 404. A command that
does not work is fine to list; it is not fine to lead with.

**The demo deploy reported success while the demo was down.** Both Fly
workflows checked whether the app existed and, if it did not, printed a
warning and exited 0. Nothing in the run history distinguished "there is
nothing to deploy to" from "deployed fine", and a warning inside a passing
run is a warning nobody reads — which is how the public demo stayed
unreachable for weeks with a green deploy history.

Both workflows now create the app when it is missing, and both verify the
result: a deploy returning zero is not a demo that works, since the machine
can boot, fail its first request and sit there. The web job polls for HTTP
200 and the API job polls `/health`, each failing loudly after five minutes
rather than declaring victory on an exit code.

Current state, stated rather than assumed: `aisoc-demo-web.fly.dev`,
`aisoc-demo-api.fly.dev` and `aisoc.cyble.com` all fail to connect right now,
and `FLY_API_TOKEN` is present. The next run on main will either restore the
demo or fail with the reason — which is the point. I have not verified the
live customer journey, because there is nothing live to verify yet.

* feat(actions): a declared verification probe must actually exist

The contract marked nine capabilities `has_verification_probe=True`. Three
probes were registered. Nothing compared the two, so the declaration was a
claim rather than a fact — and it is exactly the claim the whole contract
exists to make trustworthy: "this action is checked against the vendor rather
than assumed from an accepted request".

The gate now cross-checks both directions: a declared probe must be
registered, and a registered probe must be declared, because a probe the
contract does not know about is one every governance decision treats as
absent.

**Two real probes added**, both reading state the vendor already exposes:

`disable_user` reads the account's lifecycle status from Okta or, falling
back, `accountEnabled` from Entra. Both APIs return success on an accepted
request, which says nothing about whether sign-in is blocked — and for Entra,
directory replication means the two genuinely differ for a window. The test
covers RECOVERY explicitly, because it sounds remedial and still permits
sign-in.

`allow_ip` confirms a block was actually removed, via the same read-back the
block probe uses. Worth having in its own right: a rollback that silently
fails leaves a production address blocked after the incident closes, and
nobody watches for that the way they watch a containment.

**Four declarations corrected to false**, each with a stated reason rather
than a silent omission. `run_script` cannot be probed at all — the platform
cannot know what an arbitrary script was supposed to do, so no read-back can
confirm it did it, and the exit code is a different claim. `reset_password`
leaves the lifecycle status unchanged, so a probe reading it would report
VERIFIED for a reset that never happened. `block_domain`'s only executor is a
placeholder with no enforcement point. `unisolate_host`, `enable_user` and
`block_user_signin` have no ActionType, so the verifier cannot be reached for
them even though the probes exist.

A new `verification_gap` field carries those reasons. An absent probe is an
acceptable answer; silence is not, because an omission and a deliberate
decision look identical six months later.

**And one principle, stated rather than implied: unverifiable means not
autonomous.** `suspend_session`, `revoke_session` and `force_mfa` were
AUTOMATIC with no read-back. Okta removed session listing from the Management
API and "MFA re-enrolment required" is not a readable flag, so a probe would
report VERIFIED for something that never applied. They are analyst-gated now.
Cheap, self-healing and unverifiable is still unverifiable, and an
unverifiable containment reported as successful is the isolate_host failure
in miniature: the responder believes the session is gone and moves on.

The rule is scoped to MODERATE impact and above. A created ticket returns its
own id, so the response genuinely is the confirmation, and a rule that fires
on cases nobody can act on is a rule people learn to suppress.

* feat: adversarial injection eval, per-investigation cost budget, contribution model

**The injection guard caught 22% of the corpus and missed every
action-trigger payload.** That is the finding, and it is worse than the
PARTIAL row suggested: the guard handled "ignore previous instructions" in
its various phrasings and had no pattern at all for the two classes that
matter most now the agent proposes containment.

An injected string producing a real isolate or disable turns the SOC into a
denial-of-service tool pointed at its own estate. Every one of those got
through. So did every request to enumerate credentials, repeat the system
prompt, or reach across tenants.

The new corpus is 32 payloads grouped by *attacker goal* rather than by
phrasing, because phrasing is the part that changes — a guard tuned to last
year's wording is tuned to last year's corpus. Each payload carries the field
it arrives in, since a guard that scans the message and not the hostname has
a hole exactly where an attacker who controls DNS will aim.

Eight new patterns close the gaps: injected containment (requiring both a
verb and an imperative framing, so an alert describing malware that disables
Defender does not trip it), fake remediation directives, secret enumeration,
tenant override, memory poisoning, exfiltration destinations, content
addressed to the model, and role reassignment without jailbreak vocabulary.
Recall goes 0.22 → 0.85 with zero false positives.

Two floors, and the second matters more. Recall stops the guard degrading.
**Precision stops the guard being turned off** — a guard that flags a
phishing alert's own body, or a malware config an analyst needs to read, is
a guard someone disables within a week, and then the recall number describes
nothing. Five benign lookalikes are in the corpus for exactly that reason,
and a flagged benign payload must be at most low severity.

Action-trigger and exfiltration payloads are individually required rather
than averaged into recall. Obfuscation is recorded but not individually
required, because it is an arms race and a pass/fail per technique makes the
suite a liability.

**Per-investigation cost budget.** The cost governor enforces a rolling
per-tenant budget, which is the wrong granularity for a pivot chain: one
runaway investigation consuming a quarter of the day's allowance looks
identical to a hundred well-behaved ones, right up until the budget runs out
mid-afternoon and every subsequent alert goes untriaged. Spend is now
attributed per investigation by difference against the governor — the loop
does not know what it cost and the governor is the only thing that does —
and a capped run says so in its findings rather than presenting partial
evidence as complete.

**A contribution model**, because the strategy and action libraries are the
same shape as two things that already went wrong here: 6,000 detection rules
of which 833 execute, and 84 connectors of which 35 had no page. Both
recovered by making the artifact derived and the count gated. The doc states
the rules per library and, for each, the specific failure it exists to
prevent — including the four capabilities whose declared reverse was not in
the vocabulary, so the rollback path resolved to nothing while believing it
had a route back.

Matrix moves to 92 GATED / 10 PARTIAL.

* fix: detection rule ids no longer depend on list position

Ids were `det-{category}-{index}`, computed from where a spec sat in a
Python list. Inserting a rule anywhere but the end renumbered every rule
after it — inserting one at the front of `network` moved 81 ids — so
re-running the generator on a clean checkout reassigned ids and tripped the
marketplace gate. The workaround was "append new rules, never insert", which
is a rule nobody remembers and nothing enforced.

This is not cosmetic. Rule ids appear in alert rows, in repeat-suppression
priors and in customer-written exceptions. Reassigning one makes a
historical alert reference a different rule than the one that actually
fired, and makes a customer's exception silently apply to something else.

Ids now come from `detections/rule-ids.lock.json`, seeded from today's
assignment so not a single existing id moves. A new slug takes the next free
number in its category; a deleted rule's id stays burned rather than being
recycled onto something else, because a recycled id is worse than a
renumbered one.

A corrupt lock raises rather than being treated as empty — silently falling
back to an empty lock would reassign all 833 ids at once, which is the
failure this replaces.

The regression test asserts the original bug directly: insert a rule at the
front and check that zero existing ids move, against the 81 the old scheme
moved.

* style: format envelope.py after the new guard patterns

`ruff format --check services/` is the CI gate; my local run had only
checked the files I edited individually.

* fix: unblock the langchain advisory, and widen three cryptography caps

**langchain-core.** The high-severity advisory on the 0.3.x line has no
patch on that line — the fix only exists from 1.2.22 — so the `<0.4.0` pin
was the reason the alert could not be closed. That is a compounding position
to sit on while Pillar 2 invests in the tool loop, which is why the plan
called it a blocker rather than a chore.

The migration is verified for the deterministic tier: the full agents suite
runs on langchain-core 1.6.4 and langgraph 1.2.12 with 1023 tests passing,
and **MITRE accuracy is unchanged at 97.0% (194/200)** — the same figure the
published scoreboard carries. Everything landed in this plan so far — the
tool loop, deep investigation, the adversarial eval, the prompt envelope —
has been running on 1.x throughout.

Stated plainly, because the repo rule requires a re-grade: the live-LLM
tier was **not** re-graded. That needs a funded provider key and belongs to
the weekly wet-eval job. The deterministic tier is what I can verify, and it
moved by zero.

**cryptography** is floored at 50.0.0 for the high-severity advisory.
`services/agents` already allowed it; osquery-tls, mesh and connectors
capped at `<49` or `<50` and so excluded the patch. All three now match
agents at `<51`.

**black** in fusion was `^24.1.0`, which excluded the patched 26.3.1. It is
a dev-only formatter, so the cap bought nothing.

Two of the remaining high alerts have no patched version at all — `ecdsa`
(transitive through python-jose) and `image-size` — so they stay open rather
than being closed with a version bump that does not exist.

* feat: a support bundle an operator is actually allowed to send

When a deployment misbehaves the exchange is several rounds of "what does X
say" before anyone can form a hypothesis. This collects the answers in one
pass: versions, container state, API health, configuration flags, the
claim-gate summary, and redacted error lines.

The hard part is not collection. A support bundle is by construction the
most concentrated pile of configuration a deployment produces, and its whole
purpose is to leave the building — so getting redaction wrong is worse than
having no bundle.

**Redaction is allow-list, not deny-list.** Only named configuration flags
keep their values; everything else is reported as set-or-not, which is
usually the whole question ("is KAFKA_BOOTSTRAP_SERVERS configured"). A
deny-list means every secret-shaped setting added after today is exposed
until someone remembers to extend it, and nobody remembers.

Variables whose *name* matches a credential pattern are not even listed,
because the name can identify the deployment on its own —
`ACMEPROD_DB_PASSWORD` names the customer and the environment before you get
to the value.

Writing the test found a real contradiction: `OAUTH_REFRESH_WORKER_ENABLED`
is a boolean flag that matched the sensitive pattern on the substring
"AUTH". The pattern now matches underscore-delimited tokens, and where an
overlap is genuine — `AISOC_CREDENTIAL_ENVELOPE` holds a mode, never key
material, and is the first thing you need when a connector cannot decrypt —
it lives in an explicit overrides map with its reason. A contradiction
between two lists otherwise resolves silently, whichever way the code
happens to check first.

Deliberately not collected: event contents, alert bodies, prompts, model
output, anything from the lake. A bundle carrying customer telemetry is one
nobody is allowed to send, which makes it useless.

Verified by running it with a password, an API key and a customer-named
variable in the environment, and asserting none reach the output.

* docs: compliance evidence pack and an honest FIPS posture

Two pages a security reviewer asks for, both written to be useful by saying
what is *not* covered.

**The evidence pack** separates two things vendors routinely blur:
engineering and certification. SOC 2 Type II, ISO 27001 and a penetration
test are audit activities performed on an operating organisation — no
amount of code produces them, and a vendor implying otherwise is saying
something false. So the page has two tables. The first is sixteen controls
that are verifiable from this repository, each naming the workflow that
fails when the control stops holding. The second is what is not held, with
what it would take.

The framing it closes on is the honest one: if a questionnaire asks "are you
SOC 2 compliant", the answer is no. If it asks "can you evidence that
credentials are encrypted at rest, that a backup restores, and that one
tenant cannot read another's data", the answer is yes and the evidence is a
CI job you can read rather than a claim in a PDF.

**The FIPS page** opens by saying AiSOC does not ship validated cryptography
and cannot be made to by configuration. "FIPS-compliant" is used to mean
anything from "validated module" to "we use AES", and an assessor who finds
the difference late stops believing the rest of the answers.

It distinguishes approved from validated: every algorithm here except
BLAKE2b is FIPS-approved, none of the implementations is FIPS-validated, and
an approved algorithm run through an unvalidated module does not satisfy
140-3. BLAKE2b appears once, in the sandbox's deterministic reasoner, where
it protects nothing — named rather than quietly omitted. The page then lists
what validation would actually require, including the part usually left out:
a CI gate asserting FIPS mode stays on, because otherwise the posture
regresses on the first dependency bump.

It ends out of scope for v8.x and explicitly *not* on the roadmap, because
listing it as planned would be the same kind of claim the page exists to
avoid.

The evidence pack quotes the claim-gate tally, so the figures gate now
covers it too — a compliance page quoting a stale number is worse than one
quoting none. Writing that test exposed a bug in the existing test helper:
it repointed `REPO_ROOT` at a scratch tree but left the new path constant
aimed at the real one, so the gate read the live page against a scratch
matrix and every test failed for a reason unrelated to what it tested.

* ci: give the two new gates the dependencies they import

The connector-docs gate imports every connector class to read its schema,
so it needs `httpx` and `pydantic`. The id-stability test imports the
generator, which imports `yaml`, and I had placed the step before the
PyYAML install.

Both failed closed rather than skipping, which is the behaviour I want — a
gate that quietly passes when it cannot import is worse than one that
fails, and this repo has been bitten by exactly that (`security_audit.py`
treated a failed export as a warning and skipped an entire service).

* feat(web): the attack story becomes the primary investigation view

An analyst holds "what happened" in their head, not "what fields does this
row have". The rail opens on a story now — progression, evidence,
confidence, response — with the existing field sections one click away under
Details.

The constraint that shaped the whole component is that **an attack story is
the easiest thing in a SOC console to fabricate.** Given one alert with one
technique, a plausible five-stage kill chain can be drawn and it will look
more convincing than the single event it came from. So:

Stages come from ATT&CK tactics actually on the alert, ordered by kill-chain
position, and **nothing is interpolated between them**. Initial access plus
exfiltration renders two stages, not the eleven in between, because a guess
drawn as a diagram reads as a finding. A single-stage incident says "this is
a single-stage detection, not a chain" rather than quietly looking like the
start of one. An unrecognised tactic sorts last, not first — first would put
a vendor-specific label at the head of the chain and imply it started there.

An alert with no tactics says the gap is in the detection's metadata rather
than making a statement about the activity. A single evidence source says so
explicitly, because corroboration across sources is what raises confidence
and there is none. Confidence is the alert's own score with no second number
computed in the view, and it is omitted entirely rather than rendered as 0
when nothing was scored — 0 would claim every verdict was baseless when the
truth is that none was measured.

Actions stage for approval and the copy says nothing executes from the
panel.

Nineteen tests, most of them about what it must refuse to draw, including
the adversarial case: an alert with no techniques, no timeline, no entities
and no actions must produce four honest empty states rather than a plausible
story.

Two things surfaced while wiring it in. The story repeated the title the
rail shell already shows, giving two headings with the same text — noise on
screen and ambiguous to a screen reader, now suppressed when embedded. And
the summary metadata was unaddressable: source and severity legitimately
appear in both the header and the evidence list, so the header test matched
twice. It is a labelled region now, which is the right fix in the UI as well
as the test — relaxing the query to "somewhere on screen" would have stopped
testing the header at all.

* ci: install the connector-docs gate's full import closure

Guessed at httpx and pydantic; the package also needs structlog and
cryptography. Rather than guess again, I walked the imports across all 86
connector modules plus `app.federated`, and verified the four in a clean
venv — nothing in that closure reaches for a database driver or a web
framework, so the gate stays cheap.

* feat(agents): expose the triage counters, and report real metrics coverage

The auto-triage worker already counted everything worth counting — triaged,
deduplicated, deterministic versus LLM, business-context suppressions,
ungrounded demotions, dead-letters, errors — into a module dict read by
exactly one log line at shutdown. A counter nobody can scrape is a counter
nobody watches.

Two of them are the operator's early warning and neither was reachable.
`dead_lettered` rising means alerts are being dropped rather than triaged.
`deterministic` climbing while `llm` stays flat means the LLM path is
failing open to the fallback — which looks fine from outside, because alerts
still get verdicts.

Auth is copied from `services/api` deliberately: a token when `METRICS_TOKEN`
is set, and a refusal rather than an anonymous scrape outside development. An
operator should not have to learn two rules for the same surface. The test
for an *unset* environment is the one that matters — treating unset as
development is how an open endpoint ships, because nobody sets `AISOC_ENV` in
the container.

Two design notes worth keeping. The counters are published into a private
registry, not the global default, which would raise on a second import and
carries collectors from anything else linked in. And the worker's totals are
projected forward-only rather than incremented per scrape: incrementing would
multiply every counter by the scrape count and the graph would look like
traffic. A worker restart resets its dict, and the exported counter holds —
because a decrease reads as a counter reset and spikes every `rate()` over
that window.

**The plan's premise was wrong and the audit says so.** It called for
"Prometheus scrape config for the 13 unscraped services", but those services
do not expose `/metrics` at all — there is nothing to scrape, and adding
scrape jobs would have produced thirteen permanently-down targets. The audit
now reports coverage plainly: 5 of 19 services are instrumented, with the
other 14 named. Reported rather than enforced, because a worker with no HTTP
surface has nothing to scrape, and failing the build would push someone to
add an endpoint that emits nothing just to clear the gate.

* feat(actions): read-only vendor verbs, and the rollback that never existed

Twenty-nine executors could change the estate and exactly one — `search_siem`
— could ask it a question. That shapes an agent more than it looks: with no
way to read a vendor, an investigation can only reach the lake, so anything
the lake did not ingest is invisible, and the pivot chain Pillar 2 built has
nowhere to pivot to.

Four read verbs, each backed by a real client call: `get_host` and
`get_detections` on CrowdStrike, `get_host` on Defender, `get_user_activity`
on Okta. Read-only, automatic, no reversal, no probe — gating a read behind
an analyst is how an agent learns to conclude without looking. They take
`actions:investigate`, not `actions:contain`, because bundling them means
anyone who can look can also isolate.

Two rules the implementations share. **A read failure is not an empty
result** — an investigation concluding a host is clean because the API was
down is worse than one that says it could not check, so a missing host and
a failed read are different statuses and the difference reaches the caller.
And **vendor payloads are projected, not forwarded**: a CrowdStrike device
record carries around ninety fields, and handing the lot to a model is an
unbounded token cost that buries the four that matter.

**Then the gate I wrote for this found something worse.** Checking that
every declared capability has an executor turned up eleven that do not —
including `unisolate_host`. The rollback for the platform's most disruptive
action was declared as `isolate_host`'s reverse, offered in the UI, and
answered `executor_not_found` at dispatch, which reads as a misconfiguration
rather than a capability that was never built. Both clients already
supported it; nothing was missing but the executor. It is implemented for
CrowdStrike and Defender, and a test asserts `isolate_host`'s declared
reverse resolves to something real.

The other ten are a documented baseline the gate ratchets down: it fails on
any new orphan, and fails again when one of them gains an executor and is
not removed from the list, because a stale exemption is a gate that stopped
checking. They are listed in cost order — `restore_file` means a quarantined
file cannot be released through the platform that took it; `enable_user`
means an account disabled during an incident has no platform route back.

I also removed `search_hash` rather than ship it. Fleet-wide hash prevalence
is the most useful of the four reads — first-seen timestamps clustered in
one morning mean something different from a binary present for a year — but
I could not verify the vendor endpoint's shape, and a declared capability
with no working executor is the exact defect this contract exists to
prevent. The reasoning sits where the verb would have been.

* fix: relock agents after the langchain widening, and clear two CodeQL findings

**The lockfile.** Widening the langchain pins made `services/agents/poetry.lock`
stale, and `security_audit.py` failed closed rather than skipping the service
— which is the behaviour I wanted when that skip was made loud, so it working
here is the gate doing its job.

Relocking resolves langchain-core to 1.6.4, above the 1.2.22 the advisory
needs. It also picked aiohttp 3.14.1, which is *inside* the advisory range
(<= 3.14.2), so aiohttp is now floored explicitly at 3.14.3. It is a
transitive dependency, and a transitive dependency with a known fix is still
a known fix nobody applied.

**Two CodeQL findings, both leftovers from earlier fixes in this branch.**
The `SOCAgent` Protocol kept its `...` alongside the docstring that replaced
it, which is `py/ineffectual-statement`. And `_STRING_LITERAL_RE` in the
graph-schema exporter was left behind when the parser moved from string-shape
heuristics to the declared Go type — `py/unused-global-variable`.

The comment above that regex was worse than the dead code: it still described
bucketing CamelCase as a node label and UPPER_SNAKE as a relationship, which
is the heuristic that misfiled `IOC` and was the reason the parser changed. A
reader would have believed the exporter still guesses. Replaced with what it
actually does and why.

* style: format export_graph_schema.py

Left over from removing the dead regex block.
2026-09-22 14:56:56 -07:00