mirror of
https://github.com/beenuar/AiSOC.git
synced 2026-11-24 08:35:46 +08:00
chore: internal planning labels live in PR titles only — behaviour text everywhere else, plus the program index (#2015)
## What
WS workstream ids (`WS4.1`, `WS7.2`, …) and brief-internal rule numbers
("rule 14") had leaked into surfaces a reader actually ships or
publishes — and nothing in the tree defined them, because they come from
an uncommitted program brief. A reader of the published OpenAPI spec,
the changelog or a module docstring hit an opaque label.
Every citation is replaced by the behaviour it referred to, and a
neutral program index now exists at
**`docs/roadmap/capability-program.md`**: a WS1–WS8 table in neutral
language ("benchmarked against a reference managed agentic-security
service"), each row linked to its merged PRs (Phase 0
[#1997](https://github.com/beenuar/AiSOC/pull/1997); WS1.1
[#1998](https://github.com/beenuar/AiSOC/pull/1998); WS7.1–7.4
[#1999](https://github.com/beenuar/AiSOC/pull/1999)–[#2002](https://github.com/beenuar/AiSOC/pull/2002);
WS4.1/4.2/4.4
[#2003](https://github.com/beenuar/AiSOC/pull/2003)–[#2005](https://github.com/beenuar/AiSOC/pull/2005)),
with in-flight workstreams marked as such.
Comments/docstrings/prose only — zero behaviour change. No test file or
symbol is renamed.
## Labels removed, per surface
| Surface | Labeled lines rewritten |
|---|---|
| `docs/openapi.yaml` (regenerated, not hand-edited) | 3 (WS4.1, WS7.4,
WS4.4) |
| `.github/workflows/integration.yml` step comments | 3 |
| `CHANGELOG.md` — Unreleased section only | 10 |
| Code, tests, scripts, migrations (`--` comments),
`docs/architecture/SYSTEM_DESIGN.md` | 85 WS lines + 4 "rule 14" lines |
"rule 14" **does exist on main** (4 sites: `case_resolution.py`,
`models/case_resolution.py`, migration 166's `--` comment,
`test_case_resolution_contract.py`) and each is rewritten as the
behaviour it names ("new enforcement is opt-in"). Rule references that
*are* defined in-tree were deliberately left: `docs/cve-patch-policy.md
rule 5`, `event_warehouse/registry.py`'s self-numbered selection rules,
and the detection title "GCP Firewall Rule 0.0.0.0/0".
Two WS namespaces turned out to be live: the gap-closure program's, and
an **older integrations program** (connectors' "WS8: bidirectional
ticketing", `base.py`'s "WS4" push capabilities, oauth/wizard "WS5").
Both are scrubbed to behaviour text; the index covers the current
program only and says so.
## Spec is regenerated, not hand-edited
The three spec hits were traced to their source docstrings (`alerts.py`
DLP-finding route, `cases.py` attention-feed route,
`business_context.py` `ManagedRulesOut` model), the docstrings
rewritten, and the spec regenerated via `scripts/export_openapi.py`. The
resulting spec diff is **exactly those three description strings** —
nothing else moved — and `scripts/export_openapi.py --check` passes
(exit 0, "docs/openapi.yaml is up to date").
The vendored twin
`services/api/app/_vendor/action_contracts/capability_contracts.py` was
regenerated through `scripts/sync_vendored_action_contracts.py` from the
actions-side edit, byte-identical.
## Gates and tests (all run pipelessly, exit codes echoed)
| Check | Result |
|---|---|
| `scripts/export_openapi.py --check` | exit 0 |
| `scripts/check_competitor_names.py` | exit 0 (15,612 files scanned;
the new index passes) |
| `scripts/check_claim_gate_matrix.py` | exit 0 (410 rows — untouched,
no tally change) |
| `scripts/readme_gates.py` | exit 0 |
| `scripts/check_mypy_baseline.py` | exit 0 ("no tree got worse") |
| `ruff format --check` + `ruff check` on all 50 touched `.py` files |
exit 0 / exit 0 |
| API test subset (14 files covering every touched api module) | 303
passed |
| Actions subset (`test_sync_detection_rule_vendor_arms`,
`test_live_action_builtins`) | 21 passed |
| Connectors subset (`test_m365_audit_dlp_toggle`,
`test_push_capabilities`) | 38 passed |
| Agents subset (`test_business_context_managed_rules`,
`test_deep_investigation`) | 47 passed, 3 pre-existing skips |
## Deliberately left in place
- **Migration `035_case_external_refs.sql:106`** — `COMMENT ON TABLE …
IS 'WS8: …'` is *executed DDL* in an applied migration, not a code
comment; rewriting it would change what a fresh install runs versus an
upgraded one. Left as the one WS string in the tree outside the index; a
future migration can retitle the table comment if wanted.
- `WIN-WS42` in two agents tests — a fixture hostname, not a label.
- A base64 integrity hash in `services/realtime/package-lock.json` that
coincidentally contains `Ws41`.
## For the close-out sweep
- **Labels arriving with in-flight PRs get a follow-up sweep at program
close-out.** Open PRs #2006–#2012 and #2014 (other lanes) will merge
more labeled text; their branches were deliberately not touched.
- `apps/web` carries "VelvetEdge spec rule 2/3/7/10" comments citing the
UI program's spec, which is also not committed anywhere — same defect
class, different program namespace, outside this PR's surfaces. Recorded
here for the close-out sweep.
## Convention (stated in the index's footer as well)
Workstream ids and rule numbers live in **PR titles only** — never in
code, specs, workflows or the changelog. Those surfaces describe the
behaviour; `docs/roadmap/capability-program.md` is the one place ids are
defined.
Co-authored-by: Beenu Arora <beenu@cyble.com>
This commit is contained in:
co-authored by
Beenu Arora
parent
922b0c641e
commit
71d10b0764
@@ -1097,7 +1097,7 @@ jobs:
|
||||
! grep -qE 'skipped' /tmp/rootcause.log \
|
||||
|| { echo "::error::the root-cause live suite skipped a test; its DSNs must both be set"; exit 1; }
|
||||
|
||||
# WS7.1. The case root-cause record's Postgres truths: one record per
|
||||
# The case root-cause record's Postgres truths: one record per
|
||||
# case is the ON CONFLICT (tenant_id, case_id) constraint's behaviour
|
||||
# (a second upsert replaces, never duplicates); citations resolve
|
||||
# against investigation_events' real UNIQUE (run_id, seq) rows; the
|
||||
@@ -1120,7 +1120,7 @@ jobs:
|
||||
! grep -qE 'skipped' /tmp/case-rootcause.log \
|
||||
|| { echo "::error::the case root-cause live suite skipped a test; its DSNs must both be set"; exit 1; }
|
||||
|
||||
# WS7.2. The resolution contract's Postgres truths: the opt-in default
|
||||
# The resolution contract's Postgres truths: the opt-in default
|
||||
# is the real absent-row state, the one-per-tenant policy and
|
||||
# one-per-case facts upserts are unique-constraint behaviour, the
|
||||
# derived entity count is JSONB arithmetic over the real schema, and
|
||||
@@ -1139,7 +1139,7 @@ jobs:
|
||||
|| { echo "::error::the case resolution live suite did not report any passing test"; exit 1; }
|
||||
! grep -qE 'skipped' /tmp/case-resolution.log \
|
||||
|| { echo "::error::the case resolution live suite skipped a test; its DSNs must both be set"; exit 1; }
|
||||
# WS4.4. The insider watchlist's Postgres truths: expiry exclusion is
|
||||
# The insider watchlist's Postgres truths: expiry exclusion is
|
||||
# the rebuild SELECT's own WHERE clause (a stub always gets it right by
|
||||
# construction); the console save and the watchlist upsert own one
|
||||
# column each of the same row and must not clobber the other; the
|
||||
|
||||
+27
-14
@@ -25,8 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Added
|
||||
|
||||
- **A DLP alert normalizes into one finding, whatever vendor raised it**
|
||||
(WS4.1 of the gap-closure program). Netskope's DLP alerts, Purview DLP and
|
||||
- **A DLP alert normalizes into one finding, whatever vendor raised it.**
|
||||
Netskope's DLP alerts, Purview DLP and
|
||||
insider-risk alerts riding Defender's `alerts_v2`, and the M365 audit
|
||||
trail's `DlpRuleMatch` events each arrived as their vendor shaped them,
|
||||
readable only through `raw_event`. `app/services/dlp_finding.py` derives
|
||||
@@ -45,8 +45,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
corrupts one enforcement mapping and watches two fail.
|
||||
|
||||
### Added
|
||||
- **The insider watchlist is a control, not a checkbox** (WS4.4 of the
|
||||
gap-closure program). `user_risk_profiles.is_watchlisted` existed since
|
||||
- **The insider watchlist is a control, not a checkbox.**
|
||||
`user_risk_profiles.is_watchlisted` existed since
|
||||
migration 014 and the console wrote it — and nothing consumed it: no
|
||||
elevation, no expiry, no review. Now (migration 168): a watchlist row is
|
||||
**never indefinite** (reason + future expiry required; a sweep worker
|
||||
@@ -70,7 +70,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
WHERE; the two upserts own one column each; RLS under the NOBYPASSRLS
|
||||
role; the HR door end to end).
|
||||
- **The M365 audit connector's `DLP.All` stream is a real per-instance
|
||||
switch** (WS4.2 of the gap-closure program). The module docstring had
|
||||
switch.** The module docstring had
|
||||
promised "DLP can be re-enabled per-instance later via `connector_config`"
|
||||
while `_DEFAULT_CONTENT_TYPES` was hard-coded and the constructor accepted
|
||||
no such setting — the aspirational-comment family. The schema now declares
|
||||
@@ -110,13 +110,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
arms 168 → 172.
|
||||
|
||||
- **Every open case has an accountable owner and a next-action clock**
|
||||
(WS7.4, completing WS7 of the gap-closure program). An owner is a person
|
||||
(completing the resolution-not-escalation workstream). An owner is a person
|
||||
(`assigned_to_id`) or an agent run (`owner_agent_run_id`, migration 167):
|
||||
launching an investigation claims an unowned case for the run — and never
|
||||
steals one a person already holds, pinned by a negative control that
|
||||
removes the two predicates and watches the test fail. `next_action_due_at`
|
||||
is PATCHable (null clears it), and `GET /cases/attention` feeds the
|
||||
operations dashboard — and WS8.1's shift handoff next — with open cases
|
||||
operations dashboard — and the shift handoff next — with open cases
|
||||
that are unowned or overdue, each row naming its `owner_kind` and carrying
|
||||
`overdue_seconds` as null until the due time passes, because "not due
|
||||
yet" and "due exactly now" are different facts and a confident zero would
|
||||
@@ -124,8 +124,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Added
|
||||
|
||||
- **Five investigator strategies for the reference-service surfaces**
|
||||
(WS7.3 of the gap-closure program): `ai-agent-misuse` (the confused-deputy
|
||||
- **Five investigator strategies for the reference-service surfaces**:
|
||||
`ai-agent-misuse` (the confused-deputy
|
||||
chase — session timeline, the agent identity's grants and calls, egress
|
||||
matched to tool calls), `data-handling` (business-context triage of DLP
|
||||
hits: the user's own history for this data class and destination, role
|
||||
@@ -144,7 +144,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Added
|
||||
|
||||
- **A case reaches `resolved` only through the tenant's resolution
|
||||
contract** (WS7.2 of the gap-closure program). `resolved` was a free
|
||||
contract.** `resolved` was a free
|
||||
transition: the PATCH gate checked only the status ladder, the war-room
|
||||
chat decision and the inbound Jira/ServiceNow mirror checked nothing, and
|
||||
the hourly sweep then auto-closed whatever arrived. One shared checker
|
||||
@@ -157,7 +157,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
contract. The contract: containment verified by a named probe/action
|
||||
reference or waived with a reason; eradication and recovery recorded;
|
||||
root cause **determined or undetermined** (a hypothesis is an unverified
|
||||
lead and is refused in those words — WS7.1's statuses doing their job);
|
||||
lead and is refused in those words — the root-cause record's statuses
|
||||
doing their job);
|
||||
at least one affected entity, derived from the case's own observable
|
||||
graph and its alerts' affected-* arrays, never self-attested; customer
|
||||
notified with channel and time together. **Off by default per tenant**
|
||||
@@ -177,8 +178,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Added
|
||||
|
||||
- **A case's root cause is an evidence-backed record, not a prose field**
|
||||
(WS7.1 of the gap-closure program). The only root-cause artifact was
|
||||
- **A case's root cause is an evidence-backed record, not a prose field.**
|
||||
The only root-cause artifact was
|
||||
`root_cause_hypothesis`, a free string on the forensic agent's run state,
|
||||
rendered as-is — a reader could not tell "we walked the chain back to the
|
||||
09:02 delivery, here is the ledger entry" apart from "the model wrote a
|
||||
@@ -240,7 +241,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
and timers into the process for its lifetime.
|
||||
|
||||
- **`sync_detection_rule` reaches the vendor it names, verifies by
|
||||
read-back, and rolls back for real** (WS1.1 of the gap-closure program).
|
||||
read-back, and rolls back for real.**
|
||||
The Splunk adapter described creating a Splunk saved search while
|
||||
delegating to an executor that only ever built an Elastic client — with
|
||||
Splunk credentials the call could only simulate, and
|
||||
@@ -261,6 +262,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
servers (11 cases); the negative control reverts the Splunk arm and the
|
||||
reach test fails with zero Splunk requests.
|
||||
|
||||
### Changed
|
||||
|
||||
- **Internal planning labels no longer appear outside pull-request titles.**
|
||||
Code comments, docstrings, the published OpenAPI spec, workflow step
|
||||
comments and this changelog cited workstream ids and brief-internal rule
|
||||
numbers that nothing in the tree defined, so a reader of the published
|
||||
spec or these notes hit an opaque label. Each citation is replaced by the
|
||||
behaviour it referred to, the spec is regenerated from the corrected
|
||||
docstrings, and `docs/roadmap/capability-program.md` now indexes the
|
||||
program's workstreams against their merged pull requests — the one place
|
||||
such ids are defined.
|
||||
|
||||
## [23.6.1] - 2026-11-22
|
||||
|
||||
### Security
|
||||
|
||||
@@ -340,7 +340,7 @@ Tokens are minted via `POST /v1/inbox/tokens`, stored hashed (never plaintext),
|
||||
|
||||
A scoped, tenant-isolated query surface over the OpenSearch `events-*` indices. Every query is rewritten to inject `tenant_id` as a top-level filter before reaching OpenSearch — defense in depth on top of the existing index-level RBAC. Query timeouts and result-size caps are enforced per-tenant.
|
||||
|
||||
### 12.4 Case Fan-out and Bidirectional ITSM (WS8)
|
||||
### 12.4 Case Fan-out and Bidirectional ITSM
|
||||
|
||||
AiSOC is the **source of truth** for case state. ITSM systems (Jira, ServiceNow) are projections — analysts working in their familiar ticket UI still see correct context, but the canonical state lives in AiSOC.
|
||||
|
||||
|
||||
+3
-4
@@ -1012,7 +1012,7 @@ paths:
|
||||
description: 'One vocabulary over Netskope, Purview-via-Defender and the M365
|
||||
audit
|
||||
|
||||
trail (WS4.1): policy, rule, data classes, file, channel, destination and
|
||||
trail: policy, rule, data classes, file, channel, destination and
|
||||
|
||||
its class, what the DLP product itself did, user and device.
|
||||
|
||||
@@ -1504,8 +1504,7 @@ paths:
|
||||
tags:
|
||||
- cases
|
||||
summary: Open cases that are unowned or past their next-action time
|
||||
description: 'The operations dashboard''s attention feed (WS7.4), and what the
|
||||
shift
|
||||
description: 'The operations dashboard''s attention feed, and what the shift
|
||||
|
||||
handoff consumes. ``owner_kind`` is person / agent_run / none;
|
||||
|
||||
@@ -34685,7 +34684,7 @@ components:
|
||||
required:
|
||||
- managed_yaml
|
||||
title: ManagedRulesOut
|
||||
description: 'The machine-owned half of the rule set, read-only (WS4.4).
|
||||
description: 'The machine-owned half of the rule set, read-only.
|
||||
|
||||
|
||||
`managed_yaml` is regenerated whole by the insider watchlist and applied
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
# Capability program index
|
||||
|
||||
A capability-gap closure program, benchmarked against a reference managed
|
||||
agentic-security service, runs against this repository from a v23.6.1
|
||||
baseline. Work ships as one pull request per workstream; the workstream ids
|
||||
those pull-request titles carry (`WS1` … `WS8`, with dotted sub-items like
|
||||
`WS4.1`) are defined **here and only here** — no other file in the tree
|
||||
should need them.
|
||||
|
||||
| Id | Workstream | Shipped so far |
|
||||
|----|------------|----------------|
|
||||
| WS1 | SIEM detection engineering on the customer's SIEM | WS1.1 — `sync_detection_rule` reaches the vendor it names, verifies by read-back and rolls back ([#1998](https://github.com/beenuar/AiSOC/pull/1998)) |
|
||||
| WS2 | Long-term lake: archive, rehydration, portability, legal holds | in flight at the time of writing ([#2007](https://github.com/beenuar/AiSOC/pull/2007)) |
|
||||
| WS3 | Phishing pipeline | in flight at the time of writing ([#2011](https://github.com/beenuar/AiSOC/pull/2011)) |
|
||||
| WS4 | DLP and insider risk | WS4.1 — the normalized DLP finding, one vocabulary over three vendors ([#2003](https://github.com/beenuar/AiSOC/pull/2003)) · WS4.2 — the M365 audit `DLP.All` per-instance switch ([#2004](https://github.com/beenuar/AiSOC/pull/2004)) · WS4.4 — the insider watchlist as a real control: expiry, elevation, departure review, the HR door ([#2005](https://github.com/beenuar/AiSOC/pull/2005)) · WS4.5 in flight ([#2006](https://github.com/beenuar/AiSOC/pull/2006)) |
|
||||
| WS5 | AI-security runtime | in flight at the time of writing ([#2009](https://github.com/beenuar/AiSOC/pull/2009)) |
|
||||
| WS6 | Hunting campaigns | in flight at the time of writing ([#2010](https://github.com/beenuar/AiSOC/pull/2010)) |
|
||||
| WS7 | Resolution, not escalation | WS7.1 — the evidence-backed case root-cause record ([#1999](https://github.com/beenuar/AiSOC/pull/1999)) · WS7.2 — the resolution contract gating `resolved` ([#2000](https://github.com/beenuar/AiSOC/pull/2000)) · WS7.3 — five investigator strategies for the reference-service surfaces ([#2001](https://github.com/beenuar/AiSOC/pull/2001)) · WS7.4 — case ownership and the attention feed ([#2002](https://github.com/beenuar/AiSOC/pull/2002)) |
|
||||
| WS8 | Team/provider operating model | in flight at the time of writing ([#2008](https://github.com/beenuar/AiSOC/pull/2008)) |
|
||||
|
||||
Phase 0 — the baseline gap verification plus the neutral-reference gate
|
||||
entry — merged as [#1997](https://github.com/beenuar/AiSOC/pull/1997).
|
||||
Further WS1 sub-items are in flight as
|
||||
[#2014](https://github.com/beenuar/AiSOC/pull/2014). Rows marked in flight
|
||||
get their shipped descriptions here when their pull requests merge.
|
||||
|
||||
An earlier, unrelated program used the same `WS<n>` shorthand for the
|
||||
two-way SIEM/ITSM integration work (bidirectional ticketing, push
|
||||
capabilities, the connect wizard); those comments have likewise been
|
||||
rewritten to describe the behaviour, and nothing maps that retired
|
||||
namespace to this table.
|
||||
|
||||
## Convention
|
||||
|
||||
Workstream ids and the program brief's rule numbers live in **pull-request
|
||||
titles only** — never in code comments, docstrings, the published OpenAPI
|
||||
spec, workflow files or the changelog. Those surfaces describe the
|
||||
behaviour itself; this index is the one place that maps an id to what
|
||||
shipped. Labels arriving with in-flight pull requests get a follow-up sweep
|
||||
at program close-out.
|
||||
@@ -783,13 +783,13 @@ RATCHET: dict[str, str] = {
|
||||
"closes: it was credited by `RETURNING id, tenant_id`, a clause that constrains nothing"
|
||||
),
|
||||
"services/api/app/services/insider_watchlist.py::<module>::user_risk_profiles": (
|
||||
"the watchlist-expiry sweep (WS4.4): flips every tenant's expired rows in one statement, "
|
||||
"the watchlist-expiry sweep: flips every tenant's expired rows in one statement, "
|
||||
"bounded by `watchlist_expires_at <= :now` — the same shape and the same reason as "
|
||||
"approval_expiry's UPDATE two entries above. Its RETURNING tenant_id drives the per-tenant "
|
||||
"managed-rule rebuild and constrains nothing"
|
||||
),
|
||||
"services/api/app/services/insider_watchlist.py::<module>::insider_watchlist_policies": (
|
||||
"the HR-door sweep's tenant enumeration (WS4.4): SELECT the tenants whose policy row "
|
||||
"the HR-door sweep's tenant enumeration: SELECT the tenants whose policy row "
|
||||
"opted in (`hr_sync_enabled = TRUE`), after which each tenant's workforce rows are read "
|
||||
"under that tenant's own id — the same enumeration-then-scoped-work shape as "
|
||||
"fusion sessions.py's DISTINCT tenant_id entry"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate marketplace plugin.yaml manifests for the WS3 P0 connector batch.
|
||||
"""Generate marketplace plugin.yaml manifests for the P0 connector batch.
|
||||
|
||||
Walks each P0 connector's `schema()` and emits a `plugins/<dash-id>/plugin.yaml`
|
||||
that mirrors the live schema fields. Idempotent — re-running overwrites
|
||||
|
||||
@@ -558,7 +558,7 @@ class SplunkCreateNotable(_LegacyExecutorAdapter):
|
||||
class SplunkSyncDetectionRule(_LegacyExecutorAdapter):
|
||||
# This adapter described creating a Splunk saved search while delegating
|
||||
# to an executor that only ever built an Elastic client — with Splunk
|
||||
# credentials the call could only simulate (WS1.1). It now delegates to
|
||||
# credentials the call could only simulate. It now delegates to
|
||||
# the Splunk arm, which captures the prior definition, verifies the
|
||||
# write by read-back, and restores or deletes on rollback.
|
||||
vendor_id = "splunk"
|
||||
|
||||
@@ -614,7 +614,7 @@ CAPABILITY_CONTRACTS: dict[str, CapabilityContract] = {
|
||||
# compare it with the normalized intended content — existence alone
|
||||
# would be the wrong check, because this verb's failure mode is a
|
||||
# rule that saved with *different* content. A mismatch fails the
|
||||
# action naming the differing fields (WS1.1; the clients gained the
|
||||
# action naming the differing fields (the clients gained the
|
||||
# read half: get_saved_search / get_detection_rule).
|
||||
has_verification_probe=True,
|
||||
note=(
|
||||
|
||||
@@ -709,7 +709,7 @@ _DEFAULT_PROBES: dict[ActionType, Probe] = {
|
||||
ActionType.RESTORE_EMAIL: _probe_restore_email,
|
||||
ActionType.BLOCK_SENDER: _probe_block_sender,
|
||||
ActionType.UNBLOCK_SENDER: _probe_unblock_sender,
|
||||
# WS1.1: the write is verified by content read-back, not by existence —
|
||||
# The rule write is verified by content read-back, not by existence —
|
||||
# a tampered or partially-applied save must fail verification.
|
||||
ActionType.SYNC_DETECTION_RULE: _probe_sync_detection_rule,
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ def test_register_builtin_executors_returns_full_count() -> None:
|
||||
# exposure and nothing could act on it. Plus 2 from wave-2 8.2:
|
||||
# ExtraHop's two read-only NDR verbs, `lookup_network_flows` and
|
||||
# `lookup_network_device`.
|
||||
# Plus 1 from WS1.1: the Elastic `sync_detection_rule` arm, registered
|
||||
# Plus 1: the Elastic `sync_detection_rule` arm, registered
|
||||
# when the Splunk adapter stopped borrowing the Elastic executor.
|
||||
# Plus 4 from WS4.5: `revoke_file_share` across Google Drive,
|
||||
# OneDrive/SharePoint (Graph), Box and Dropbox.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""`sync_detection_rule` reaches the vendor it names, verifies, and rolls back.
|
||||
|
||||
What was wrong (WS1.1 of the gap-closure program)
|
||||
-------------------------------------------------
|
||||
What was wrong
|
||||
--------------
|
||||
`SplunkSyncDetectionRule` in `live_actions/builtins.py` described creating a
|
||||
Splunk saved search, but delegated to `SyncDetectionRuleExecutor`, which only
|
||||
ever built an **Elastic** client from `elastic_url` — with Splunk credentials
|
||||
|
||||
@@ -20,7 +20,7 @@ Encoding that as data rather than prose has three consequences that matter:
|
||||
is a reviewable change rather than a prompt edit nobody can diff.
|
||||
|
||||
Fifteen strategies here, covering the kill chains the corpus actually fires
|
||||
on plus the reference-service surfaces (WS7.3): AI-agent misuse, data
|
||||
on plus the reference-service surfaces: AI-agent misuse, data
|
||||
handling against business context, BEC payment fraud, SaaS OAuth abuse and
|
||||
cloud exposure.
|
||||
The registry is designed for many more; each is ~20 lines and needs its own
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""The managed rule document applies on the live triage path (WS4.4).
|
||||
"""The managed rule document applies on the live triage path.
|
||||
|
||||
Two implementations of one grammar
|
||||
----------------------------------
|
||||
|
||||
@@ -86,7 +86,7 @@ class TestStrategySelection:
|
||||
("large upload to an external host", ["T1041"], "data-exfiltration"),
|
||||
("user added to domain admins", ["T1098"], "privilege-escalation"),
|
||||
("new scheduled task created", ["T1053"], "persistence-established"),
|
||||
# WS7.3: the five reference-service strategies.
|
||||
# The five reference-service strategies.
|
||||
("prompt injection attempt against the support copilot", [], "ai-agent-misuse"),
|
||||
("dlp flagged a sensitivity-labelled file shared externally", ["T1213"], "data-handling"),
|
||||
("vendor invoice redirected to a new bank account", ["T1534"], "bec-payment-fraud"),
|
||||
|
||||
@@ -614,7 +614,7 @@ CAPABILITY_CONTRACTS: dict[str, CapabilityContract] = {
|
||||
# compare it with the normalized intended content — existence alone
|
||||
# would be the wrong check, because this verb's failure mode is a
|
||||
# rule that saved with *different* content. A mismatch fails the
|
||||
# action naming the differing fields (WS1.1; the clients gained the
|
||||
# action naming the differing fields (the clients gained the
|
||||
# read half: get_saved_search / get_detection_rule).
|
||||
has_verification_probe=True,
|
||||
note=(
|
||||
|
||||
@@ -320,9 +320,9 @@ async def list_agent_tools(
|
||||
description=declared_descriptions[cap],
|
||||
# input_schema left as the empty-object default for
|
||||
# now. Per-capability argument schemas land with the
|
||||
# subsequent workstreams that flesh out concrete
|
||||
# call surfaces (e.g. WS5 for self-healing actions,
|
||||
# WS8 for ITSM push verbs). Doing it here would
|
||||
# work that fleshes out concrete call surfaces
|
||||
# (e.g. self-healing actions and the ITSM push
|
||||
# verbs). Doing it here would
|
||||
# require touching every connector class twice —
|
||||
# once now for the surface, once later for the
|
||||
# logic — and the agent layer is already happy
|
||||
|
||||
@@ -1052,7 +1052,7 @@ async def get_alert_dlp_finding(
|
||||
current_user: Annotated[AuthUser, Depends(require_permission("alerts:read"))],
|
||||
) -> dict[str, Any]:
|
||||
"""One vocabulary over Netskope, Purview-via-Defender and the M365 audit
|
||||
trail (WS4.1): policy, rule, data classes, file, channel, destination and
|
||||
trail: policy, rule, data classes, file, channel, destination and
|
||||
its class, what the DLP product itself did, user and device.
|
||||
|
||||
``finding: null`` is the honest answer for an alert that is not a DLP
|
||||
|
||||
@@ -448,7 +448,7 @@ async def _fetch_sample_alerts(
|
||||
|
||||
|
||||
class ManagedRulesOut(BaseModel):
|
||||
"""The machine-owned half of the rule set, read-only (WS4.4).
|
||||
"""The machine-owned half of the rule set, read-only.
|
||||
|
||||
`managed_yaml` is regenerated whole by the insider watchlist and applied
|
||||
by the triage worker beside the authored rules. It is exposed so an
|
||||
|
||||
@@ -241,7 +241,7 @@ class UpdateCaseRequest(BaseModel):
|
||||
compliance_frameworks: list[str] | None = None
|
||||
tags: dict[str, str] | None = None
|
||||
sla_due_at: datetime | None = None
|
||||
#: WS7.4: the next-action clock (null clears it) and the agent-run
|
||||
#: The next-action clock (null clears it) and the agent-run
|
||||
#: owner (null releases it). A person owner stays `assignee`.
|
||||
next_action_due_at: datetime | None = None
|
||||
owner_agent_run_id: uuid.UUID | None = None
|
||||
@@ -681,7 +681,7 @@ async def get_cases_attention(
|
||||
db: DBSession,
|
||||
user: Annotated[AuthUser, Depends(require_permission("cases:read"))],
|
||||
) -> dict[str, Any]:
|
||||
"""The operations dashboard's attention feed (WS7.4), and what the shift
|
||||
"""The operations dashboard's attention feed, and what the shift
|
||||
handoff consumes. ``owner_kind`` is person / agent_run / none;
|
||||
``overdue_seconds`` is null until the due time has passed — null, never
|
||||
a confident zero, because "not due yet" and "due exactly now" are
|
||||
@@ -737,7 +737,7 @@ async def get_cases_attention(
|
||||
|
||||
|
||||
async def _claim_case_for_run(db: DBSession, *, tenant_id: uuid.UUID, case_id: uuid.UUID, run_id: uuid.UUID) -> None:
|
||||
"""Claim an UNOWNED case for an investigation run (WS7.4).
|
||||
"""Claim an UNOWNED case for an investigation run.
|
||||
|
||||
Both ownership columns are in the predicate: an agent must never steal
|
||||
a case a person already holds, and a second run must not displace the
|
||||
@@ -925,7 +925,7 @@ async def reopen_case(
|
||||
|
||||
|
||||
async def _enforce_resolution_contract(*, db: DBSession, user: Any, existing: Any, target_status: str) -> None:
|
||||
"""The WS7.2 gate: `resolved` must satisfy the tenant's contract.
|
||||
"""The resolution-contract gate: `resolved` must satisfy the tenant's contract.
|
||||
|
||||
One shared checker (`case_resolution.resolution_gaps`) — the war-room
|
||||
decision and the inbound ITSM mirror consult the same one, so there is
|
||||
@@ -975,7 +975,7 @@ async def update_case(
|
||||
"backwards moves require POST /cases/{id}/reopen."
|
||||
),
|
||||
)
|
||||
# WS7.2: the ladder says the move is shaped right; the resolution
|
||||
# The ladder says the move is shaped right; the resolution
|
||||
# contract says `resolved` is earned. Same checker as the war-room
|
||||
# decision and the ITSM mirror.
|
||||
await _enforce_resolution_contract(db=db, user=user, existing=existing, target_status=_normalize_status(body.status))
|
||||
@@ -1937,7 +1937,7 @@ async def case_investigate(
|
||||
raise HTTPException(status_code=resp.status_code, detail=resp.text)
|
||||
launch = resp.json()
|
||||
|
||||
# WS7.4: the run becomes the case's owner when nobody holds it — a case
|
||||
# The run becomes the case's owner when nobody holds it — a case
|
||||
# under agent investigation has an accountable party, and the attention
|
||||
# feed stops listing it as unowned. Claim-if-unowned only: an agent
|
||||
# never steals a case a person already holds. Never blocks the launch.
|
||||
@@ -2467,7 +2467,7 @@ async def case_auto_summary(
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Resolution contract (WS7.2): facts, gaps, policy, summary
|
||||
# Resolution contract: facts, gaps, policy, summary
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -2548,7 +2548,7 @@ async def get_case_resolution_summary(
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Root cause (WS7.1): the evidence-backed record, not a prose field
|
||||
# Root cause: the evidence-backed record, not a prose field
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@@ -501,7 +501,7 @@ async def resolve_contract_target(
|
||||
case_id: Any,
|
||||
vendor_status: str,
|
||||
) -> tuple[str, str | None]:
|
||||
"""What an inbound vendor `resolved`/`closed` may actually set (WS7.2).
|
||||
"""What an inbound vendor `resolved`/`closed` may actually set.
|
||||
|
||||
A vendor webhook cannot be answered with a 422, so a vendor-side
|
||||
resolution that fails the tenant's resolution contract lands as
|
||||
@@ -847,7 +847,7 @@ async def inbound_itsm_webhook(
|
||||
# system comment.
|
||||
actor_label = f"itsm-webhook ({vendor})"
|
||||
try:
|
||||
# WS7.2: a vendor-side resolve/close that fails the tenant's
|
||||
# A vendor-side resolve/close that fails the tenant's
|
||||
# resolution contract is demoted to `contained` with the gaps in
|
||||
# the system note — a webhook cannot be 422'd, but it must not be
|
||||
# the door that skips the contract either.
|
||||
|
||||
@@ -1182,7 +1182,7 @@ async def export_evidence_bundle(
|
||||
)
|
||||
artifacts = (await db.execute(select(InvestigationArtifact).where(InvestigationArtifact.run_id == run_id))).scalars().all()
|
||||
|
||||
# WS7.2: when the run is tied to a case that carries resolution facts or
|
||||
# When the run is tied to a case that carries resolution facts or
|
||||
# a root-cause record, the customer-facing summary rides in the bundle.
|
||||
resolution_summary = None
|
||||
try:
|
||||
|
||||
@@ -507,7 +507,7 @@ class Settings(BaseSettings):
|
||||
)
|
||||
APPROVAL_EXPIRY_INTERVAL_SECONDS: int = 300 # 5m
|
||||
|
||||
# WS4.4 — insider-watchlist sweep: expiry hygiene (all tenants) + the
|
||||
# Insider-watchlist sweep: expiry hygiene (all tenants) + the
|
||||
# HR door (only tenants whose policy row opted in). On by default for
|
||||
# the same reason approval expiry is: a recorded deadline that nothing
|
||||
# enforces is a promise the product breaks silently.
|
||||
|
||||
@@ -556,7 +556,7 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
|
||||
"Set APPROVAL_EXPIRY_ENABLED=true to sweep them"
|
||||
)
|
||||
|
||||
# WS4.4 — insider-watchlist sweep. Expiry hygiene for every tenant
|
||||
# Insider-watchlist sweep. Expiry hygiene for every tenant
|
||||
# (a watchlist row promised to end; silence would break that promise),
|
||||
# plus the HR door for tenants whose policy row opted in.
|
||||
insider_watchlist_task: asyncio.Task | None = None
|
||||
|
||||
@@ -39,7 +39,7 @@ class Case(Base):
|
||||
|
||||
# Assignment. An owner is a person (assigned_to_id) OR an agent run
|
||||
# (owner_agent_run_id): investigation launch claims an unowned case for
|
||||
# the run and never steals one a person holds (WS7.4).
|
||||
# the run and never steals one a person holds.
|
||||
assigned_to_id: Mapped[uuid.UUID | None] = mapped_column(UUID(as_uuid=True), nullable=True)
|
||||
owner_agent_run_id: Mapped[uuid.UUID | None] = mapped_column(UUID(as_uuid=True), nullable=True)
|
||||
#: The next-action clock the attention feed and shift handoff read.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""ORM mirrors of migration 166's resolution-contract tables (WS7.2).
|
||||
"""ORM mirrors of migration 166's resolution-contract tables.
|
||||
|
||||
The SQL migration is the load-bearing definition (`make upgrade` / fresh
|
||||
install apply the chain); these models keep the parity picture complete and
|
||||
@@ -24,7 +24,7 @@ class CaseResolutionPolicy(Base):
|
||||
id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
tenant_id: Mapped[uuid.UUID] = mapped_column(ForeignKey("tenants.id"), nullable=False)
|
||||
#: Off by default: no row, or enforce=false, means the contract does not
|
||||
#: gate `resolved` for this tenant (rule 14 — enforcement is opt-in).
|
||||
#: gate `resolved` for this tenant (new enforcement is opt-in).
|
||||
enforce: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||
require_containment: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True)
|
||||
require_eradication_recovery: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""ORM mirrors of migration 165's root-cause tables (WS7.1).
|
||||
"""ORM mirrors of migration 165's root-cause tables.
|
||||
|
||||
The api service applies the SQL chain (``make upgrade`` / fresh install), so
|
||||
the migration is the load-bearing definition; these models keep the ORM
|
||||
|
||||
@@ -32,7 +32,7 @@ class UserRiskProfile(Base):
|
||||
watchlist_reason: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
watchlisted_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
watchlisted_by: Mapped[uuid.UUID | None] = mapped_column(ForeignKey("users.id", ondelete="SET NULL"), nullable=True)
|
||||
# WS4.4 (migration 168): a watchlist row is never indefinite, and it
|
||||
# Migration 168: a watchlist row is never indefinite, and it
|
||||
# records which door listed it ('manual' | 'hr_sync').
|
||||
watchlist_expires_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
watchlist_source: Mapped[str] = mapped_column(String(20), default="manual")
|
||||
@@ -79,7 +79,7 @@ class InsiderPeerGroup(Base):
|
||||
|
||||
|
||||
class InsiderWatchlistPolicy(Base):
|
||||
"""Per-tenant insider-watchlist policy (WS4.4, migration 168).
|
||||
"""Per-tenant insider-watchlist policy (migration 168).
|
||||
|
||||
One row per tenant; an absent row means every automation is off. The
|
||||
HR door (`hr_sync_enabled`) watches `workforce_members` for departing
|
||||
|
||||
@@ -169,7 +169,7 @@ class ActionItem(BaseModel):
|
||||
|
||||
|
||||
class RootCauseSection(BaseModel):
|
||||
"""The root-cause record rendered for the retrospective (WS7.1).
|
||||
"""The root-cause record rendered for the retrospective.
|
||||
|
||||
``label`` is the load-bearing field: a hypothesis **says it is a
|
||||
hypothesis**, a determined cause says what established it, and a missing
|
||||
@@ -950,7 +950,7 @@ async def build_case_postmortem(
|
||||
tasks = await _fetch_tasks(db, case_id, tenant_id)
|
||||
inputs = PostmortemInputs(case=case, comments=comments, tasks=tasks)
|
||||
postmortem = build_postmortem_from_rows(inputs, now=now)
|
||||
# WS7.1: the evidence-backed record, rendered with its status named —
|
||||
# The evidence-backed root-cause record, rendered with its status named —
|
||||
# or an honest absence. Never synthesized from the agent's prose.
|
||||
record = await case_root_cause.fetch_record(db, tenant_id=tenant_id, case_id=case_id)
|
||||
postmortem.root_cause = build_root_cause_section(record)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""The resolution contract: what `resolved` has to mean (WS7.2).
|
||||
"""The resolution contract: what `resolved` has to mean.
|
||||
|
||||
`resolved` was a free transition — the PATCH gate checked only the status
|
||||
ladder, the war-room chat decision and the inbound ITSM mirror checked
|
||||
@@ -13,14 +13,14 @@ The contract, when a tenant's policy enforces it:
|
||||
* **containment** — verified by a named probe/action reference, or waived
|
||||
with a written reason;
|
||||
* **eradication and recovery** — both recorded;
|
||||
* **root cause** — the WS7.1 record exists with status ``determined`` or
|
||||
* **root cause** — the case root-cause record exists with status ``determined`` or
|
||||
``undetermined`` (whose missing-telemetry reason its own contract already
|
||||
requires). A ``hypothesis`` does not satisfy: that status exists precisely
|
||||
to say "nothing verified this";
|
||||
* **affected entities** — at least one recorded on the case or its alerts;
|
||||
* **customer notified** — channel and time.
|
||||
|
||||
**Off by default, per tenant** (rule 14: new enforcement is opt-in). No
|
||||
**Off by default, per tenant** — new enforcement is opt-in. No
|
||||
policy row, or ``enforce = false``, means no gaps — a deployment keeps its
|
||||
workflow until the tenant turns the contract on. When the policy row cannot
|
||||
be read at decision time the transition is refused naming the read failure:
|
||||
@@ -320,8 +320,8 @@ async def fetch_root_cause_status(db: AsyncSession, tenant_id: uuid.UUID, case_i
|
||||
async def resolution_gaps(db: AsyncSession, tenant_id: uuid.UUID, case_id: uuid.UUID) -> list[str]:
|
||||
"""The shared checker every `resolved` writer consults.
|
||||
|
||||
Loads the tenant policy, the case facts, the WS7.1 root-cause status and
|
||||
the derived entity count, and hands them to :func:`compute_gaps`. No
|
||||
Loads the tenant policy, the case facts, the root-cause record's status
|
||||
and the derived entity count, and hands them to :func:`compute_gaps`. No
|
||||
policy row means no enforcement (opt-in); a policy read that *fails*
|
||||
propagates — refusing on an unreadable policy is the caller's job, and
|
||||
waving the transition through is the one wrong answer.
|
||||
@@ -344,8 +344,8 @@ def build_resolution_summary(
|
||||
"""The customer-facing summary, from persisted rows only.
|
||||
|
||||
Renders what is recorded and says plainly what is not — never invents a
|
||||
step, and labels a hypothesis as a hypothesis (the WS7.1 rule carried
|
||||
into prose).
|
||||
step, and labels a hypothesis as a hypothesis (the root-cause record's
|
||||
own discipline carried into prose).
|
||||
"""
|
||||
lines: list[str] = [f"# Resolution summary — {case_title}", ""]
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""The evidence-backed root-cause record (WS7.1 of the gap-closure program).
|
||||
"""The evidence-backed root-cause record.
|
||||
|
||||
One record per case, with a status that separates what an investigation
|
||||
*established* from what a model *suggested*:
|
||||
|
||||
@@ -35,8 +35,8 @@ Status ladder
|
||||
The 2x multiplier matches the plan's posture of "tolerate one missed
|
||||
poll cycle before paging the operator". Operators can tune cadence
|
||||
overrides per-instance via ``connector_config.expected_cadence_seconds``
|
||||
(WS5 follow-up); the override path lands in the resolver below so the
|
||||
default table stays the floor.
|
||||
(a planned wizard follow-up); the override path lands in the resolver
|
||||
below so the default table stays the floor.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -138,7 +138,7 @@ def expected_cadence_seconds(
|
||||
|
||||
Operators can override the default per-instance via
|
||||
``connector_config.expected_cadence_seconds`` once that knob is
|
||||
surfaced in the wizard (WS5 follow-up). Until then the override is
|
||||
surfaced in the wizard (a planned follow-up). Until then the override is
|
||||
``None`` and we always return the table value. Negative or zero
|
||||
overrides are silently rejected — they would force the SLO into
|
||||
permanent red and almost certainly mean a typo.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""The normalized DLP finding: one vocabulary over three vendors (WS4.1).
|
||||
"""The normalized DLP finding: one vocabulary over three vendors.
|
||||
|
||||
Netskope's DLP alert feed, Purview DLP and insider-risk alerts riding
|
||||
Defender's ``alerts_v2``, and the M365 audit trail's ``DlpRuleMatch`` events
|
||||
|
||||
@@ -93,8 +93,8 @@ __all__ = [
|
||||
|
||||
#: This format's own version, independent of OCSF's. Bumped when the
|
||||
#: payload shape changes in a way a reader must notice.
|
||||
# 1.1: optional `resolution` section (WS7.2) — the customer-facing summary
|
||||
# built from the persisted resolution facts and the WS7.1 root-cause record,
|
||||
# 1.1: optional `resolution` section — the customer-facing summary built
|
||||
# from the persisted resolution facts and the case root-cause record,
|
||||
# present only when the run's case carries them.
|
||||
BUNDLE_SCHEMA_VERSION = "1.1"
|
||||
|
||||
@@ -346,7 +346,7 @@ def build_bundle(
|
||||
),
|
||||
}
|
||||
if resolution_summary is not None:
|
||||
# WS7.2: present only when the run's case carries resolution facts /
|
||||
# Present only when the run's case carries resolution facts /
|
||||
# a root-cause record — an absent section is the honest state, never
|
||||
# an empty scaffold pretending something was recorded.
|
||||
payload["resolution"] = {"summary_markdown": resolution_summary}
|
||||
|
||||
@@ -9,7 +9,7 @@ flag: no alert was elevated, nothing expired, and no review of the user's
|
||||
recent activity happened. A watchlist nothing reads is a checkbox, not a
|
||||
control.
|
||||
|
||||
The three halves this module adds (WS4.4):
|
||||
The three halves this module adds:
|
||||
|
||||
* **Expiry.** A watchlist row is never indefinite: watchlisting requires
|
||||
`expires_at` in the future, and an expired row stops elevating — first
|
||||
|
||||
@@ -393,7 +393,7 @@ async def apply_channel_decision(
|
||||
)
|
||||
changed["severity"] = "critical"
|
||||
elif decision == "resolve":
|
||||
# WS7.2: the chat button consults the same resolution contract the
|
||||
# The chat button consults the same resolution contract the
|
||||
# PATCH gate enforces — a channel must not be the door that skips
|
||||
# it. On gaps the decision becomes a refusal note; no status write.
|
||||
gaps = await case_resolution.resolution_gaps(db, tenant_id, uuid.UUID(str(case_id)))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Insider-watchlist sweep: expiry hygiene plus the HR door (WS4.4).
|
||||
"""Insider-watchlist sweep: expiry hygiene plus the HR door.
|
||||
|
||||
Two jobs on one tick, deliberately asymmetric about defaults:
|
||||
|
||||
|
||||
@@ -110,8 +110,9 @@ def _resolve_token_url(app_credential: OAuthAppCredential, hints: Mapping[str, A
|
||||
def _parse_expires_at(value: Any) -> datetime | None:
|
||||
"""Best-effort parse of an ``expires_at`` field stored in auth_config.
|
||||
|
||||
The hosted callback writes ISO-8601 with ``+00:00``; older rows
|
||||
(pre-WS5) might be missing or malformed. Anything we can't parse is
|
||||
The hosted callback writes ISO-8601 with ``+00:00``; rows written
|
||||
before the hosted callback landed might be missing or malformed.
|
||||
Anything we can't parse is
|
||||
treated as "expired" so the worker attempts a refresh on next tick.
|
||||
"""
|
||||
if not isinstance(value, str) or not value:
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
-- 165: the evidence-backed root-cause record (WS7.1 of the gap-closure
|
||||
-- program).
|
||||
-- 165: the evidence-backed root-cause record.
|
||||
--
|
||||
-- The only root-cause artifact before this was `root_cause_hypothesis`, a
|
||||
-- free string on the forensic agent's run state — no case-level record, no
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
-- 166: the resolution contract (WS7.2 of the gap-closure program).
|
||||
-- 166: the resolution contract.
|
||||
--
|
||||
-- `resolved` was a free transition: the PATCH gate checked only the status
|
||||
-- ladder, and the war-room decision and the inbound ITSM mirror checked
|
||||
-- nothing. These two tables carry the per-tenant policy (off by default —
|
||||
-- no row means no enforcement; rule 14, enforcement is opt-in) and the
|
||||
-- no row means no enforcement; new enforcement is opt-in) and the
|
||||
-- per-case facts the shared checker (`app/services/case_resolution.py`)
|
||||
-- reads: containment verified-with-reference or waived-with-reason,
|
||||
-- eradication and recovery steps, and the customer notification (channel
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
-- 167: case ownership and the next-action clock (WS7.4 of the gap-closure
|
||||
-- program).
|
||||
-- 167: case ownership and the next-action clock.
|
||||
--
|
||||
-- A case could sit open with nobody — person or agent — responsible and no
|
||||
-- time by which anything was due, and nothing surfaced that state. An owner
|
||||
@@ -7,7 +6,7 @@
|
||||
-- an agent run (`owner_agent_run_id`, new): launching an investigation
|
||||
-- claims an unowned case for the run, and never steals one a person holds.
|
||||
-- `next_action_due_at` is the clock the attention feed and the shift
|
||||
-- handoff (WS8.1) read.
|
||||
-- handoff read.
|
||||
|
||||
ALTER TABLE aisoc_cases ADD COLUMN IF NOT EXISTS next_action_due_at TIMESTAMPTZ;
|
||||
ALTER TABLE aisoc_cases ADD COLUMN IF NOT EXISTS owner_agent_run_id UUID;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- WS4.4 — the insider watchlist becomes a control instead of a checkbox.
|
||||
-- 168: the insider watchlist becomes a control instead of a checkbox.
|
||||
--
|
||||
-- `user_risk_profiles.is_watchlisted` has existed since migration 014 and the
|
||||
-- console wrote it — and that was the whole feature. Nothing consumed the
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Every open case has an owner and a next action, or it surfaces (WS7.4).
|
||||
"""Every open case has an owner and a next action, or it surfaces.
|
||||
|
||||
What was wrong
|
||||
--------------
|
||||
@@ -20,7 +20,7 @@ What this asserts
|
||||
never steals a case a person already owns.
|
||||
|
||||
The attention feed is what the operations dashboard renders and what the
|
||||
WS8.1 shift handoff will consume.
|
||||
shift handoff will consume.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""A case reaches `resolved` only through the resolution contract (WS7.2).
|
||||
"""A case reaches `resolved` only through the resolution contract.
|
||||
|
||||
What was wrong
|
||||
--------------
|
||||
@@ -17,11 +17,12 @@ What this asserts
|
||||
verified by a named probe/action reference or waived with a reason;
|
||||
eradication and recovery steps recorded; root cause **determined or
|
||||
undetermined-with-reason** (a hypothesis does not satisfy — that is the
|
||||
point of WS7.1's statuses); at least one affected entity recorded; the
|
||||
point of the root-cause record's statuses); at least one affected entity
|
||||
recorded; the
|
||||
customer notified with channel and time.
|
||||
* **Per-tenant policy, off by default**: no policy row (or `enforce=false`)
|
||||
means no gaps — existing deployments keep their workflow until a tenant
|
||||
turns the contract on. Rule 14: new enforcement is opt-in.
|
||||
turns the contract on. New enforcement is opt-in.
|
||||
* The PATCH route refuses `… → resolved` with a 422 that lists every unmet
|
||||
requirement by name (the console surfaces `detail` verbatim in a toast).
|
||||
* The war-room "resolve" decision consults the same checker and, on gaps,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""A case's root cause is an evidence-backed record, not a prose field.
|
||||
|
||||
What was wrong (WS7.1 of the gap-closure program)
|
||||
-------------------------------------------------
|
||||
What was wrong
|
||||
--------------
|
||||
The only root-cause artifact anywhere was ``root_cause_hypothesis`` — a free
|
||||
string on the forensic agent's run state, rendered into the report and the
|
||||
console as-is. There was no case-level record, no status distinguishing a
|
||||
|
||||
@@ -58,9 +58,9 @@ WRITE_HANDLERS = [
|
||||
# Reopening is a write, and a privileged one: it moves a case out of a
|
||||
# terminal state, which the forward-only PATCH deliberately cannot do.
|
||||
"reopen_case",
|
||||
# WS7.1: writing the root-cause record is case writing.
|
||||
# Writing the root-cause record is case writing.
|
||||
"put_case_root_cause",
|
||||
# WS7.2: recording resolution facts is case writing.
|
||||
# Recording resolution facts is case writing.
|
||||
"put_case_resolution",
|
||||
]
|
||||
|
||||
@@ -69,7 +69,7 @@ WRITE_HANDLERS = [
|
||||
#: whole-surface count covers WRITE_HANDLERS plus this map, so a new write
|
||||
#: route still cannot arrive unaccounted.
|
||||
ADMIN_WRITE_HANDLERS: dict[str, str] = {
|
||||
# WS7.2: whether `resolved` is gated is an admin decision, not an
|
||||
# Whether `resolved` is gated is an admin decision, not an
|
||||
# analyst act — an analyst records facts, an admin turns the contract on.
|
||||
"put_resolution_policy": "settings:write",
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""A DLP alert normalizes into one finding, whatever vendor raised it (WS4.1).
|
||||
"""A DLP alert normalizes into one finding, whatever vendor raised it.
|
||||
|
||||
What was wrong
|
||||
--------------
|
||||
|
||||
@@ -702,7 +702,7 @@ def _build_db_for_endpoint(
|
||||
r.fetchone = MagicMock(return_value=ref_row)
|
||||
results.append(r)
|
||||
# last_used_at update + any subsequent statements. Writes never call
|
||||
# .fetchone(); the one read in this tail is WS7.2's resolution-policy
|
||||
# .fetchone(); the one read in this tail is the resolution-policy
|
||||
# fetch, whose honest no-policy state is fetchone() -> None — a bare
|
||||
# MagicMock there would read as a truthy policy row made of mocks and
|
||||
# drag the contract into suites that model a tenant who never opted in.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""The insider watchlist is a control, not a checkbox (WS4.4).
|
||||
"""The insider watchlist is a control, not a checkbox.
|
||||
|
||||
What was wrong
|
||||
--------------
|
||||
|
||||
@@ -119,7 +119,7 @@ def _db(*, current_status: str = "investigating", case_found: bool = True) -> Ma
|
||||
result.fetchone.return_value = connector
|
||||
return result
|
||||
if "case_resolution_policies" in text:
|
||||
# WS7.2: no policy row — the resolution contract is opt-in, and
|
||||
# No policy row — the resolution contract is opt-in, and
|
||||
# these suites model a tenant that has not opted in, which is
|
||||
# exactly the fetchone()-returns-None state production has.
|
||||
result.fetchone.return_value = None
|
||||
|
||||
@@ -173,7 +173,7 @@ class FederatedQueryRequest(BaseModel):
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# WS8: bidirectional ITSM push.
|
||||
# Bidirectional ITSM push.
|
||||
# ---------------------------------------------------------------------------
|
||||
#
|
||||
# These two payloads carry the AiSOC case (already serialized to a dict by
|
||||
|
||||
@@ -1199,7 +1199,7 @@ class BaseConnector(ABC):
|
||||
# about the case (e.g. inbound webhook flow).
|
||||
#
|
||||
# Both methods are *gated* by ``Capability.PUSH_CASE`` /
|
||||
# ``Capability.PUSH_STATUS`` from WS4. Connectors that don't declare those
|
||||
# ``Capability.PUSH_STATUS``. Connectors that don't declare those
|
||||
# capabilities raise ``NotImplementedError`` from the defaults so the
|
||||
# actions worker fails closed instead of silently skipping a case fan-out.
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ _PRIORITY_SEVERITY = {
|
||||
"Lowest": "info",
|
||||
}
|
||||
|
||||
# WS8: AiSOC severity → Jira priority. We invert ``_PRIORITY_SEVERITY``
|
||||
# AiSOC severity → Jira priority. We invert ``_PRIORITY_SEVERITY``
|
||||
# so the round-trip is lossless.
|
||||
_SEVERITY_TO_PRIORITY = {
|
||||
"critical": "Highest",
|
||||
@@ -39,7 +39,7 @@ _SEVERITY_TO_PRIORITY = {
|
||||
"info": "Lowest",
|
||||
}
|
||||
|
||||
# WS8: AiSOC status → Jira status name. The values on the right match
|
||||
# AiSOC status → Jira status name. The values on the right match
|
||||
# the default Jira workflow ("To Do" / "In Progress" / "Done"). Customers
|
||||
# with custom workflows can override via ``connector_config.status_map``
|
||||
# in the future; for now we ship the defaults so the happy path Just Works.
|
||||
@@ -97,7 +97,7 @@ class JiraConnector(BaseConnector):
|
||||
|
||||
@classmethod
|
||||
def capabilities(cls) -> tuple[Capability, ...]:
|
||||
# WS8: bidirectional ticketing landed; Jira can now mint issues
|
||||
# Bidirectional ticketing: Jira can mint issues
|
||||
# from AiSOC cases (PUSH_CASE) and project status transitions
|
||||
# onto them (PUSH_STATUS) in addition to pulling alerts.
|
||||
return (Capability.PULL_ALERTS, Capability.PUSH_CASE, Capability.PUSH_STATUS)
|
||||
@@ -178,7 +178,7 @@ class JiraConnector(BaseConnector):
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# WS8: bidirectional ticket sync.
|
||||
# Bidirectional ticket sync.
|
||||
# ------------------------------------------------------------------
|
||||
#
|
||||
# Jira's REST API is well-documented but has a few gotchas the
|
||||
|
||||
@@ -39,7 +39,7 @@ _IMPACT_SEVERITY = {
|
||||
"3": "low",
|
||||
}
|
||||
|
||||
# WS8: AiSOC severity → ServiceNow ``impact`` numeric code. ServiceNow's
|
||||
# AiSOC severity → ServiceNow ``impact`` numeric code. ServiceNow's
|
||||
# ``impact`` field is 3-tier (1=High / 2=Medium / 3=Low), so we set
|
||||
# impact=1 + urgency=1 together — ServiceNow's calculated ``priority``
|
||||
# matrix turns ``impact=1 + urgency=1`` into priority 1 ("Critical"),
|
||||
@@ -67,7 +67,7 @@ _SEVERITY_TO_URGENCY = {
|
||||
"info": "3",
|
||||
}
|
||||
|
||||
# WS8: AiSOC status → ServiceNow ``state`` numeric code. The default
|
||||
# AiSOC status → ServiceNow ``state`` numeric code. The default
|
||||
# ServiceNow incident state field is a numeric choice list:
|
||||
# 1=New, 2=In Progress, 3=On Hold, 6=Resolved, 7=Closed, 8=Canceled.
|
||||
# We map AiSOC's lifecycle onto that vocabulary. Customers with custom
|
||||
@@ -110,7 +110,7 @@ class ServiceNowConnector(BaseConnector):
|
||||
|
||||
@classmethod
|
||||
def capabilities(cls) -> tuple[Capability, ...]:
|
||||
# WS8: bidirectional ticketing landed; ServiceNow can now mint
|
||||
# Bidirectional ticketing: ServiceNow can mint
|
||||
# incidents from AiSOC cases (PUSH_CASE) and project status
|
||||
# transitions onto them (PUSH_STATUS) in addition to pulling
|
||||
# incidents.
|
||||
@@ -191,7 +191,7 @@ class ServiceNowConnector(BaseConnector):
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# WS8: bidirectional ticket sync.
|
||||
# Bidirectional ticket sync.
|
||||
# ------------------------------------------------------------------
|
||||
#
|
||||
# ServiceNow's Table API is uniform across record types — POST to
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""The M365 audit DLP.All switch is real, per instance (WS4.2).
|
||||
"""The M365 audit DLP.All switch is real, per instance.
|
||||
|
||||
What was wrong
|
||||
--------------
|
||||
|
||||
@@ -691,7 +691,7 @@ def test_jira_capabilities_advertise_push() -> None:
|
||||
caps = JiraConnector.capabilities()
|
||||
assert Capability.PUSH_CASE in caps
|
||||
assert Capability.PUSH_STATUS in caps
|
||||
assert Capability.PULL_ALERTS in caps # pre-WS8 capability still intact
|
||||
assert Capability.PULL_ALERTS in caps # the original pull capability still intact
|
||||
|
||||
|
||||
def test_servicenow_capabilities_advertise_push() -> None:
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
"""The resolution contract's Postgres truths, against real Postgres (WS7.2).
|
||||
"""The resolution contract's Postgres truths, against real Postgres.
|
||||
|
||||
Why this has to be live
|
||||
-----------------------
|
||||
* ``resolution_gaps`` is a composition of four real reads (policy row, facts
|
||||
row, the WS7.1 root-cause record, and the derived entity count over the
|
||||
row, the case root-cause record, and the derived entity count over the
|
||||
case's observable graph and its alerts' affected-* arrays) — the entity
|
||||
count in particular is JSONB arithmetic a stub always gets right by
|
||||
construction.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""The root-cause record's Postgres truths, against real Postgres (WS7.1).
|
||||
"""The root-cause record's Postgres truths, against real Postgres.
|
||||
|
||||
Why this has to be live
|
||||
-----------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""The insider watchlist's Postgres truths, against real Postgres (WS4.4).
|
||||
"""The insider watchlist's Postgres truths, against real Postgres.
|
||||
|
||||
Why this has to be live
|
||||
-----------------------
|
||||
|
||||
Reference in New Issue
Block a user