@shieldaai/security-watch 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +170 -0
- package/CONTRIBUTING.md +92 -0
- package/LICENSE +202 -0
- package/README.md +394 -2
- package/SECURITY.md +62 -0
- package/dist/assessment.d.ts +16 -0
- package/dist/assessment.js +569 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +1105 -0
- package/dist/config.d.ts +302 -0
- package/dist/config.js +381 -0
- package/dist/coverage.d.ts +4 -0
- package/dist/coverage.js +11 -0
- package/dist/cve-now.d.ts +35 -0
- package/dist/cve-now.js +1002 -0
- package/dist/cvss4.d.ts +3 -0
- package/dist/cvss4.js +39 -0
- package/dist/delivery.d.ts +58 -0
- package/dist/delivery.js +687 -0
- package/dist/ecosystems.d.ts +48 -0
- package/dist/ecosystems.js +332 -0
- package/dist/engine.d.ts +80 -0
- package/dist/engine.js +388 -0
- package/dist/everyday-words.d.ts +11 -0
- package/dist/everyday-words.js +256 -0
- package/dist/health.d.ts +24 -0
- package/dist/health.js +122 -0
- package/dist/heartbeat.d.ts +13 -0
- package/dist/heartbeat.js +74 -0
- package/dist/http.d.ts +15 -0
- package/dist/http.js +280 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +23 -0
- package/dist/inventory-evidence.d.ts +10 -0
- package/dist/inventory-evidence.js +206 -0
- package/dist/inventory.d.ts +276 -0
- package/dist/inventory.js +336 -0
- package/dist/lock.d.ts +3 -0
- package/dist/lock.js +112 -0
- package/dist/maintenance.d.ts +48 -0
- package/dist/maintenance.js +295 -0
- package/dist/matching.d.ts +29 -0
- package/dist/matching.js +537 -0
- package/dist/models.d.ts +33 -0
- package/dist/models.js +932 -0
- package/dist/operations.d.ts +17 -0
- package/dist/operations.js +117 -0
- package/dist/pilot-cases.d.ts +171 -0
- package/dist/pilot-cases.js +330 -0
- package/dist/pilot-input.d.ts +16 -0
- package/dist/pilot-input.js +125 -0
- package/dist/pilot-recall.d.ts +166 -0
- package/dist/pilot-recall.js +231 -0
- package/dist/pilot-report.d.ts +113 -0
- package/dist/pilot-report.js +279 -0
- package/dist/pilot-responses.d.ts +111 -0
- package/dist/pilot-responses.js +159 -0
- package/dist/providers.d.ts +209 -0
- package/dist/providers.js +459 -0
- package/dist/python-version.d.ts +3 -0
- package/dist/python-version.js +30 -0
- package/dist/rehearsal.d.ts +440 -0
- package/dist/rehearsal.js +372 -0
- package/dist/sbom.d.ts +13 -0
- package/dist/sbom.js +193 -0
- package/dist/setup.d.ts +113 -0
- package/dist/setup.js +100 -0
- package/dist/source-error.d.ts +38 -0
- package/dist/source-error.js +71 -0
- package/dist/sources.d.ts +3 -0
- package/dist/sources.js +1725 -0
- package/dist/store.d.ts +96 -0
- package/dist/store.js +953 -0
- package/dist/types.d.ts +404 -0
- package/dist/types.js +1 -0
- package/dist/util.d.ts +29 -0
- package/dist/util.js +94 -0
- package/dist/vendor/cvss4-reference.d.ts +2 -0
- package/dist/vendor/cvss4-reference.js +789 -0
- package/dist/vendor-sources.d.ts +24 -0
- package/dist/vendor-sources.js +56 -0
- package/dist/word-filter.d.ts +3 -0
- package/dist/word-filter.js +3291 -0
- package/docs/alert-outcome-evaluation.md +150 -0
- package/docs/compatibility.md +35 -0
- package/docs/configuration.md +666 -0
- package/docs/cvss-v4-support.md +41 -0
- package/docs/offline-advisory-preview.md +114 -0
- package/docs/offline-rehearsal.md +44 -0
- package/docs/pilot-cases.md +58 -0
- package/docs/pilot-recall.md +124 -0
- package/docs/pilot-report.md +52 -0
- package/docs/validation/alert-outcome-evaluation-2026-11-05.json +2935 -0
- package/docs/validation/cvss-v4-reference-parity-2026-11-05.json +93 -0
- package/docs/validation/rehearsal-accepted-2026-11-05.json +175 -0
- package/docs/validation/rehearsal-unknown-2026-11-05.json +175 -0
- package/docs/vendor/cvss-v4-LICENSE.txt +22 -0
- package/docs/vendor/cvss-v4-provenance.json +38 -0
- package/examples/advisories.json +17 -0
- package/examples/agent-advisories-2026.json +145 -0
- package/examples/agent-advisory-cases-2026.json +397 -0
- package/examples/common-systems.yaml +243 -0
- package/examples/libraries.example.txt +18 -0
- package/examples/libraries.example.yaml +40 -0
- package/examples/library-watch.example.yaml +27 -0
- package/examples/offline-advisory-preview.mjs +42 -0
- package/examples/rehearsal.json +75 -0
- package/examples/security-watch.example.yaml +86 -0
- package/examples/systems.example.yaml +35 -0
- package/package.json +85 -4
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# CVSS v4 source severity
|
|
2
|
+
|
|
3
|
+
Security Watch now derives **CVSS-B (base) severity** from CVSS 4.0 vectors in OSV and GitHub advisories. This closes a reproduced routing miss: an OSV-confirmed affected package with only the vector below previously had unknown severity and stayed in history under a critical-only library policy. Its base score is 9.3, so it now reaches the configured immediate notification outbox. Tests use synthetic inventory and never deliver the notification.
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
The change applies to OSV top-level and affected-package `severity` entries and GitHub `cvss.vector_string` / `cvss_severities.cvss_v4.vector_string`. Existing source severity labels and numeric scores remain independent floors: the highest supported severity wins. A low vector, invalid vector, or source-supplied threat adjustment cannot lower an explicit critical source rating. Existing CVSS 3.0/3.1 behavior is retained. New scoring is local, with no service request or runtime dependency.
|
|
10
|
+
|
|
11
|
+
## Supported semantics
|
|
12
|
+
|
|
13
|
+
The parser validates the entire supplied vector against FIRST's CVSS 4.0 metric table: exact case, fixed metric order, all eleven required base metrics, known metric names and values, and no duplicates. V4 candidates with version/type disagreement are unsupported, including OSV `CVSS_V3` paired with a 4.0 vector and `CVSS_V4` paired with a 3.x vector. Legacy untyped entries remain accepted when the vector itself identifies its version.
|
|
14
|
+
|
|
15
|
+
Valid threat, environmental and supplemental metrics are retained for inspection but removed before scoring. The calculated score is explicitly **CVSS-B**, even when the supplied vector describes CVSS-BT, CVSS-BE or CVSS-BTE. This avoids treating a publisher's deployment assumptions as observations about the operator's installation. In particular, `E:A` does not set known exploitation, and `E:U` does not lower the base severity. CVSS scoring defaults describe the score calculation; they do not establish a real-world incident or local exposure. Security Watch does not calculate contextual v4 scores.
|
|
16
|
+
|
|
17
|
+
Scores 0.1–3.9 map to low, 4.0–6.9 medium, 7.0–8.9 high and 9.0–10.0 critical. CVSS's zero/none rating stays `unknown` in Security Watch's existing severity vocabulary; the exact score 0 is retained. Neither zero nor an unsupported vector establishes that a package is unaffected. Package identity/version, withdrawal, source conflicts, inventory age and evidence freshness still determine applicability independently. A stale positive match remains historical affected evidence with a warning; stale exclusion evidence cannot establish `not_affected`.
|
|
18
|
+
|
|
19
|
+
## Inspection and bounds
|
|
20
|
+
|
|
21
|
+
Normalized `Evidence.cvss_v4` and `security-watch explain FINDING_ID` expose:
|
|
22
|
+
|
|
23
|
+
- `base_scores`: distinct validated source vectors, their exact `base_vector`, computed `score`, and `context_removed` flag.
|
|
24
|
+
- `unsupported_vectors`: number of rejected v4 candidates in that advisory, including declared-type mismatches. Rejected raw values are not copied into diagnostics.
|
|
25
|
+
- The existing `modified_at` and `fetched_at` evidence timestamps, displayed beside these diagnostics, establish source age separately from scoring.
|
|
26
|
+
|
|
27
|
+
Each vector is capped at 1,024 characters and 32 metrics. An advisory may contain at most 32 v4 candidates, counting repeats and malformed candidates across top-level and package-specific entries. Exceeding that cap rejects the advisory, reports incomplete collection and retains the prior source checkpoint. The collector does not truncate the list and silently discard a possible higher severity. Valid neighboring advisories still continue through the normal incomplete-source behavior.
|
|
28
|
+
|
|
29
|
+
This metadata is local evidence. It does not expand the model disclosure allowlist. Existing source/enrollment limits still apply: the adapter does not add product backports, reachability, supplier VEX, EPSS or historical coverage.
|
|
30
|
+
|
|
31
|
+
## Reference, licensing and validation
|
|
32
|
+
|
|
33
|
+
CVSS is owned by FIRST and used by permission. The reference implementation comes from [FIRST's calculator](https://github.com/FIRSTdotorg/cvss-v4-calculator/tree/c5b0d409ae9f57c44264c6ce5f27d89298e1d32a), pinned to commit `c5b0d409ae9f57c44264c6ce5f27d89298e1d32a`. Original source hashes and adaptations are in [the provenance manifest](vendor/cvss-v4-provenance.json). The [BSD-2-Clause license](vendor/cvss-v4-LICENSE.txt) is retained in both distributed documentation and the compiled vendored module. The project license does not replace this third-party license.
|
|
34
|
+
|
|
35
|
+
The vendored change concatenates the five calculator/data files, gives browser globals function-local declarations, adds module exports and applies formatting. Scoring equations and lookup data are unchanged. The small wrapper performs validation and explicit base projection. Tests compare fourteen independently published [FIRST examples](https://www.first.org/cvss/v4.0/examples), 512 deterministic vectors scored by the unmodified pinned browser reference, malformed vectors, optional context, boundaries, and ingestion through assessment/policy into a local outbox. Nearby fixed, withdrawn, conflicting, stale and missing-version cases exercise the existing safety rules. These are regression checks, not a representative production accuracy measurement.
|
|
36
|
+
|
|
37
|
+
The [recorded exhaustive adaptation check](validation/cvss-v4-reference-parity-2026-11-05.json) matched all 104,976 possible base vectors. To repeat it after building, put the original pinned files from the provenance manifest in a directory and run `node scripts/verify-cvss-v4.mjs /path/to/reference-files`. The script verifies every original hash before executing the reference in an isolated JavaScript context, compares every base combination and emits a JSON report with source and executed-module hashes. It makes no network requests. This parity check catches module adaptation mistakes; the separately asserted published examples remain an independent numerical check.
|
|
38
|
+
|
|
39
|
+
Validation on 5 November 2026: `npm run check` passed all 733 tests with zero skips on Node 26.12.0, formatting and the installed-package consumer. The package check carries v4 evidence through collection, assessment and policy into a local notification outbox. All 74 focused CVSS/source/assessment tests also passed on Node 24.22.1. Neither run sends a notification or invokes a model.
|
|
40
|
+
|
|
41
|
+
To update the pinned reference, review the upstream diff and license, retrieve the exact pinned files listed in the manifest, verify their hashes, apply only the documented module adaptations, regenerate the reference sample fixture from the unmodified files, and rerun the published examples, full base-vector parity and package checks. Do not regenerate expected scores from the adapted implementation. Review any changed scores against the [FIRST specification](https://www.first.org/cvss/v4.0/specification-document) before accepting them.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Preview dependency advisory monitoring without sending alerts
|
|
2
|
+
|
|
3
|
+
Security Watch compares a system inventory with advisory evidence and records
|
|
4
|
+
why a finding applies. Begin with its published fictional inventory and advisory
|
|
5
|
+
fixture, then inspect the result before configuring real monitoring.
|
|
6
|
+
|
|
7
|
+
This example uses `@shieldaai/security-watch@1.0.0`, an in-memory database,
|
|
8
|
+
no provider credentials and no notification delivery. It is a fixture check of
|
|
9
|
+
matching behavior, not an audit of real dependencies.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
Use Node.js 24.10 or newer in a new directory:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
mkdir watch-demo
|
|
17
|
+
cd watch-demo
|
|
18
|
+
npm init -y
|
|
19
|
+
npm install --ignore-scripts --save-exact @shieldaai/security-watch@1.0.0
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Run the fictional inventory
|
|
23
|
+
|
|
24
|
+
Save this as `offline-advisory-preview.mjs`:
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
import assert from 'node:assert/strict';
|
|
28
|
+
import { dirname, join } from 'node:path';
|
|
29
|
+
import { fileURLToPath } from 'node:url';
|
|
30
|
+
import { parseConfig, loadInventory, readFixture, Store, runScan } from '@shieldaai/security-watch';
|
|
31
|
+
|
|
32
|
+
// Use fictional data distributed in the installed package, not private inventory.
|
|
33
|
+
const packageRoot = dirname(dirname(fileURLToPath(import.meta.resolve('@shieldaai/security-watch'))));
|
|
34
|
+
const inventory = loadInventory(join(packageRoot, 'examples/systems.example.yaml'));
|
|
35
|
+
const now = new Date().toISOString();
|
|
36
|
+
for (const system of inventory.systems) system.updated_at = now;
|
|
37
|
+
// Simulated fresh capture times for fictional evidence; nothing was fetched.
|
|
38
|
+
const fixture = readFixture(join(packageRoot, 'examples/advisories.json')).map((event) => ({
|
|
39
|
+
...event,
|
|
40
|
+
modified_at: now,
|
|
41
|
+
fetched_at: now,
|
|
42
|
+
}));
|
|
43
|
+
const config = parseConfig({ version: 1 });
|
|
44
|
+
const store = new Store(':memory:');
|
|
45
|
+
const previousFetch = globalThis.fetch;
|
|
46
|
+
globalThis.fetch = async () => {
|
|
47
|
+
throw new Error('This fixture example must not use the network');
|
|
48
|
+
};
|
|
49
|
+
try {
|
|
50
|
+
const report = await runScan({
|
|
51
|
+
config,
|
|
52
|
+
inventory,
|
|
53
|
+
store,
|
|
54
|
+
fixture,
|
|
55
|
+
});
|
|
56
|
+
assert(report.findings.some((f) => f.applicability === 'affected'));
|
|
57
|
+
assert(report.findings.some((f) => f.applicability === 'not_affected'));
|
|
58
|
+
for (const finding of report.findings) {
|
|
59
|
+
console.log(
|
|
60
|
+
`${finding.system_id}: ${finding.applicability}; source severity: ${finding.source_severity}`,
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
console.log('All assertions passed. Fictional advisory and inventory; in-memory storage.');
|
|
64
|
+
console.log('No network, model requests, credentials or notifications.');
|
|
65
|
+
} finally {
|
|
66
|
+
store.close();
|
|
67
|
+
globalThis.fetch = previousFetch;
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
node offline-advisory-preview.mjs
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The findings include both of these lines; their order is not part of the API:
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
payments-staging: not_affected; source severity: critical
|
|
79
|
+
payments-production: affected; source severity: critical
|
|
80
|
+
All assertions passed. Fictional advisory and inventory; in-memory storage.
|
|
81
|
+
No network, model requests, credentials or notifications.
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The shipped fixture names `example-parser` and a fictional advisory. Production
|
|
85
|
+
uses version `1.2.0`, which matches the fixture's affected range; staging uses
|
|
86
|
+
`1.3.0`, which falls outside that range. The fixture's severity is separate from
|
|
87
|
+
the assessment of each inventory item. Inventory and advisory timestamps are
|
|
88
|
+
simulated as a fresh capture for these fictional records; no evidence was fetched.
|
|
89
|
+
Real monitoring retains actual source and capture times so freshness checks can
|
|
90
|
+
preserve unknown assessments. This simulated capture does not establish current
|
|
91
|
+
coverage of real advisories.
|
|
92
|
+
|
|
93
|
+
## Move to a real inventory
|
|
94
|
+
|
|
95
|
+
Follow the [setup instructions](../README.md#install-and-preview) to generate
|
|
96
|
+
configuration, then replace the example inventory with your installed package
|
|
97
|
+
versions and deployment context. Review configuration with `doctor`. Keep AI and
|
|
98
|
+
notification routes disabled for an initial review.
|
|
99
|
+
|
|
100
|
+
A live scan contacts configured advisory and feed sources. Some integrations
|
|
101
|
+
send dependency names and versions, and enabling a model sends relevant inventory
|
|
102
|
+
and evidence to that provider. A real scan with `--dry-run` can still contact
|
|
103
|
+
sources; the explicit fixture is what makes this example offline. Configure
|
|
104
|
+
Slack or email only after reviewing the findings and the
|
|
105
|
+
[privacy and coverage boundaries](../SECURITY.md).
|
|
106
|
+
|
|
107
|
+
An empty result does not prove complete advisory coverage or safe software.
|
|
108
|
+
Unsupported version forms, missing versions and deployment conditions can require
|
|
109
|
+
human evidence. The example sends no test notification and performs no patching.
|
|
110
|
+
|
|
111
|
+
See [configuration](configuration.md) and the
|
|
112
|
+
[standalone example](../examples/offline-advisory-preview.mjs). For controlling
|
|
113
|
+
agent tool calls rather than monitoring dependencies, see
|
|
114
|
+
[Agent Guard](https://github.com/ShieldaAI/agent-guard).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Rehearse policy and delivery locally
|
|
2
|
+
|
|
3
|
+
`security-watch rehearse` runs the normal scan, assessment, SQLite outbox and delivery implementation against a bounded sequence of local evidence snapshots. It uses a new private temporary database and in-process simulated Slack/email sinks. Sources and models are always disabled; it neither opens the configured live database nor loads credentials. This is preparation for a staged pilot, not a production-readiness or model-quality score.
|
|
4
|
+
|
|
5
|
+
From a checkout after `npm run build`:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
node dist/cli.js init --directory .rehearsal --yes --notifications slack
|
|
9
|
+
node dist/cli.js rehearse --config .rehearsal/security-watch.yaml --input examples/rehearsal.json --sink disabled --output rehearsal-disabled.json
|
|
10
|
+
node dist/cli.js rehearse --config .rehearsal/security-watch.yaml --input examples/rehearsal.json --sink accepted --output rehearsal-accepted.json
|
|
11
|
+
node dist/cli.js rehearse --config .rehearsal/security-watch.yaml --input examples/rehearsal.json --sink unknown --output rehearsal-unknown.json
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The packaged [example](../examples/rehearsal.json) supplies a fictional inventory in its first frame and repeats one critical advisory. The accepted run produces one simulated accepted Slack delivery; the unknown run keeps one ambiguous receipt with one attempt. Repeating an unchanged scan does not enqueue another delivery. No actual Slack or SMTP connection is made, including during the restore probe. Installed packages expose the same command as `security-watch rehearse`; locate the included example under the installed package's `examples` directory.
|
|
15
|
+
|
|
16
|
+
The default `--sink disabled` leaves jobs pending. `accepted`, `failed` and `unknown` select a fixed simulated response from both in-process transports. Existing production URL validation, policy checks, digest timing, rate limits and outbox transitions still run. The implementation supplies synthetic credentials through an explicit private map; it does not read or modify environment credentials. `--credentials-file`, `--notify`, remote sinks and arbitrary destinations are not accepted. Original configured policy channels are preserved, so a policy with no channels creates no delivery.
|
|
17
|
+
|
|
18
|
+
## Scenario contract and bounds
|
|
19
|
+
|
|
20
|
+
The JSON document is `{ "version": 1, "frames": [...] }`. Every frame has an ISO `at` timestamp and an `evidence` array of normalized evidence objects. An optional `inventory` replaces the preceding inventory snapshot for that and later frames; otherwise the initial inventory comes from configuration. Frame inventories contain materialized systems/components and cannot import a lockfile, libraries file or SBOM. The normal configured inventory loader may read its explicitly configured local imports before rehearsal starts.
|
|
21
|
+
|
|
22
|
+
Times must increase, stay on or after the Unix epoch and span at most 31 days. The clock advances only to supplied frame times. Rehearsal does not make stale evidence fresh, silently drain a future digest, or infer source completeness from fixture data. Previously retained evidence persists between frames; use an updated withdrawn record to exercise withdrawal. Cross-source collisions on the same evidence ID are rejected. Unknown fields, including model-like replies in evidence, are rejected. CVSS v4 metadata must match its validated base-vector calculation.
|
|
23
|
+
|
|
24
|
+
Limits are 8 MiB for input and report, 12 frames, 1,000 supplied evidence records in total, 20 systems and 500 component/product/system targets per frame. Each evidence description is at most 16,000 characters; package claims, versions, aliases and other strings are separately bounded. A conservative 100,000 work-unit limit accounts for retained records, package claims and explicit versions against every later frame's targets. Storage stops at 2,000 findings, 4,000 delivery records and 1,000 retained evidence records. Invalid or over-limit inputs fail with content-free errors. Input symbolic links and non-regular files are rejected.
|
|
25
|
+
|
|
26
|
+
The public API exports `readRehearsal(path)` and `runRehearsal({ config, inventory, scenario, sink })`, plus their scenario/report types. Direct API objects receive the same validation and bounds. Inputs are not mutated. No live-source or AI-shadow mode is available in this command; use the separate offline outcome evaluator for simulated model comparisons.
|
|
27
|
+
|
|
28
|
+
## Report and recovery evidence
|
|
29
|
+
|
|
30
|
+
The report exports only fixed field names, enum outcomes, counters, durations and per-run HMAC references. It omits inventory/package names, raw IDs, titles, descriptions, prompts, URLs, addresses, credentials, review notes and filesystem paths. The random HMAC key is never exported and is cleared when the run finishes, so references cannot be joined across runs or guessed by hashing a public package name. Counts, ages and outcomes can still reveal operational patterns; control distribution of the report.
|
|
31
|
+
|
|
32
|
+
Each frame links fixture ingestion to evidence, findings/revisions, policy decisions and delivery receipts. `retained: false` identifies received older evidence that did not replace the stored revision. All received references remain represented, while finding evidence links point to retained records. `scan_ms` measures only the scan; evidence ages and digest schedules use the supplied scenario clock. Final summary counts describe the last frame, not unique incidents across all frames. Source coverage, AI shadow, urgent recall, false-alert rates and analyst latency are explicitly `null`, since this rehearsal does not measure them.
|
|
33
|
+
|
|
34
|
+
After the frames, rehearsal closes/reopens the database, takes a real SQLite backup, runs the existing backup verifier, restores a separate copy, and compares evidence, findings/history, review state, controls, budgets and receipts. Opening/restoring never dispatches. With a simulated sink enabled, a separate explicit dispatcher probe checks that accepted, failed and unknown receipts are not retried. Any eligible pending work sent by this probe is counted separately in `recovery.probe_sink_calls`; it does not change the last-frame summary. Disabled delivery skips that probe. This validates fixture recovery, not a backup of the operator's production database.
|
|
35
|
+
|
|
36
|
+
The temporary database and backup contain local raw inputs while running, use private permissions, and are removed on success or failure; this is cleanup, not a secure-erasure guarantee. The exported report uses private permissions and a new output file, refusing existing files and symlinks. Omitting `--output` prints the same sanitized JSON. No findings or raw delivery bodies are printed on errors.
|
|
37
|
+
|
|
38
|
+
Before a real rollout, collect independently adjudicated labels, choose a nonproduction inventory, run a separately authorized source/model shadow period, test an approved destination, review representative workload and ambiguous receipts, and obtain analyst sign-off. Those operational gates remain open.
|
|
39
|
+
|
|
40
|
+
## Recorded validation, 5 November 2026
|
|
41
|
+
|
|
42
|
+
The complete `npm run check` passed all 746 tests with zero skips on Node 26.12.0, formatting and the clean installed-package check. The package check exercises the installed rehearsal CLI with model-enabled configuration, private canaries, a live-database marker, accepted/unknown sinks, duplicate frames and protected report output. All 72 selected rehearsal, delivery, engine and CVSS tests also passed on Node 24.22.1.
|
|
43
|
+
|
|
44
|
+
Running the example command above produced an [accepted report](validation/rehearsal-accepted-2026-11-05.json) and an [unknown-receipt report](validation/rehearsal-unknown-2026-11-05.json). Each records two frames, one finding and one simulated send. Repetition and the explicit restored dispatcher produced no additional send. Both reports record successful reopen, backup verification and restore, with zero external requests or deliveries. CI now runs the example and retains its redacted report for seven days.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Review policy decisions from a pilot backup
|
|
2
|
+
|
|
3
|
+
Use a private standalone Security Watch backup to compare the monitor’s saved decisions with independent analysts’ judgments. A case is one retained, active, non-withdrawn library, product, malware or news finding revision in the chosen window. The same finding can change several times and contribute several cases.
|
|
4
|
+
|
|
5
|
+
## Prepare the cases
|
|
6
|
+
|
|
7
|
+
Agree on the window, the expected routing criteria and one canonical reviewer handle per person before looking at results. Retain the original backup, an authoritative snapshot of the deployment inventory and the advisory evidence available during that period. Create a local lookup packet in a private directory.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
security-watch pilot-cases --backup ./backups/watch.db \
|
|
11
|
+
--from 2026-10-20 --until 2026-11-03 --output ./review/cases.json
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Windows span 1–31 completed UTC days, with an exclusive end date. The command verifies a private temporary copy of the original backup. It includes every eligible retained revision and reports the number of health, retired or withdrawn revisions excluded. Unknown migration timestamps (zero) fall outside the cohort. Empty windows are allowed. A window with over 1,000 total revisions, 32 MiB of retained finding payloads, 256 KiB for one payload or 16 KiB for one decision fails before producing a packet. Use a shorter period when needed. A missing or pruned finding cannot enter the cohort.
|
|
15
|
+
|
|
16
|
+
**Keep the packet local to authorized analysts.** Each case gives a snapshot-specific opaque case ID, recorded time and the event, system, component and source-evidence identifiers needed for research. These identifiers can reveal private infrastructure. The command requires a new private `.json` output file. It omits model conclusions, assessment prose, policy actions, delivery states, operator verdicts and credentials.
|
|
17
|
+
|
|
18
|
+
Have two people work separately from the lookup packet, the contemporaneous inventory and the original evidence. Look up the deployment and source content as of the case’s recorded time. A bare evidence ID can belong to several sources or revisions. An empty list is possible. If the analyst cannot verify the relevant historical version or context, choose `abstain`. Keep each analyst blind to the monitor’s decision and to the other analyst’s response until both submit. Keep the source material and each analyst’s rationale in the controlled review system.
|
|
19
|
+
|
|
20
|
+
## Score the feedback
|
|
21
|
+
|
|
22
|
+
Copy `packet_id` and the corresponding `case_id` from the packet. Combine the submitted labels into a private UTF-8 JSON file with mode `0600` on Unix. The following schematic shows the accepted fields.
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"version": 1,
|
|
27
|
+
"packet_id": "<packet_id>",
|
|
28
|
+
"reviews": [
|
|
29
|
+
{ "case_id": "<case_id>", "reviewer": "analyst-a", "blinded": true, "label": "urgent" },
|
|
30
|
+
{ "case_id": "<case_id>", "reviewer": "analyst-b", "blinded": true, "label": "must_review" }
|
|
31
|
+
],
|
|
32
|
+
"adjudications": [{ "case_id": "<case_id>", "adjudicator": "analyst-c", "label": "urgent" }]
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Use `urgent` for an immediate notification, `must_review` for a case that should reach a person, `benign` for one that does not warrant an immediate notification, and `abstain` when evidence is insufficient. A third person can resolve a disagreement after two distinct blinded votes. Agreement needs no adjudication. Enroll one lowercase ASCII handle per person, beginning with a letter and using letters, digits, underscores or hyphens up to 64 characters. The coordinator verifies the people behind those handles and their independence. The scorer validates their declarations, rejects repeated or conflicting identity roles per case and rejects duplicate JSON keys, including alternate escaped spellings.
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
security-watch pilot-score --backup ./backups/watch.db \
|
|
40
|
+
--from 2026-10-20 --until 2026-11-03 --input ./review/labels.json \
|
|
41
|
+
--output ./review/aggregate.json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The score uses the original backup and dates. IDs bind the exact original file bytes, window and finding revision. Copying the backup byte for byte is supported. Regenerating or modifying the backup requires a fresh packet and new feedback. Input labels are limited to 1 MiB on disk. The command checks that the input is a stable private regular file with a single link. Omit `--output` to print the aggregate JSON. Each file output publishes a complete new private file. Both commands operate locally without configuration, notifications or model requests.
|
|
45
|
+
|
|
46
|
+
## Interpret a score
|
|
47
|
+
|
|
48
|
+
`coverage` accounts for every eligible revision across `scored`, `unreviewed`, `single_review`, `unresolved_conflicts` and `abstained`. Agreement, disagreement and adjudication counts add context and overlap those totals. Each policy metric describes **only the scored revisions**, including the numerator, denominator and ratio. A zero denominator yields null.
|
|
49
|
+
|
|
50
|
+
| Metric | Numerator | Denominator |
|
|
51
|
+
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- |
|
|
52
|
+
| `urgent_immediate` | Urgent revisions whose saved policy selected immediate notification on at least one channel | Scored urgent revisions |
|
|
53
|
+
| `quiet_risk` | Urgent or must-review revisions whose policy selected neither a destination for digest/immediate delivery nor a local review | Scored urgent and must-review revisions |
|
|
54
|
+
| `unnecessary_immediate` | Benign revisions whose policy selected immediate notification on at least one channel | Scored benign revisions |
|
|
55
|
+
|
|
56
|
+
An urgent revision directed to a digest can miss immediate routing while remaining visible. Counts use the policy decision stored for that revision. Acknowledgments, suppression, retries and destination failures can affect delivery after the decision. Use the [pilot report](pilot-report.md) for retained receipt states and workload. The aggregate score includes dates and counters only. Population urgent recall and delivered false-alert rate remain null. Use [pilot-recall](pilot-recall.md) to include an independently enumerated list of urgent incidents, including events with no matching retained finding. Selective labeling, correlated revisions, retained-history gaps and a small sample all affect how the ratios can be interpreted.
|
|
57
|
+
|
|
58
|
+
The package also exports `createPilotCasePacket(backup, {from, until})` and `scorePilotCases(backup, {from, until}, feedback)`. Both return promises and use the same verified-copy and grading paths as the CLI.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Measure urgent incident recall on a frozen backup
|
|
2
|
+
|
|
3
|
+
Use `pilot-recall` to measure how often Security Watch observed an independently listed urgent incident, selected immediate notification, and received an acknowledgement from Slack or the SMTP relay before the incident’s deadline. Each rate uses every listed incident as its denominator, including incidents without a retained finding.
|
|
4
|
+
|
|
5
|
+
## Prepare the reference independently
|
|
6
|
+
|
|
7
|
+
Before consulting Security Watch findings or alerts, choose a completed UTC date window, the deployments under review, the inclusion criteria for urgent incidents and the expected response interval. Have an independent curator assemble and freeze the complete list for those criteria from incident tickets, dated vendor advisories and contemporaneous deployment inventory. Resolve duplicate events and confirm affected targets, publication or availability times and equivalent identifiers. Keep the source records, manifest and criteria privately for audit. The importer checks the curator’s declaration and relies on the coordinator to verify the curator's independence and the evidence.
|
|
8
|
+
|
|
9
|
+
Each incident represents one urgent event on one system and optional component. Use a different incident ID for each affected target. A null component matches system-level findings exactly. Include only confirmed equivalent advisory or source event IDs in `event_refs`. Security Watch gives a GHSA priority over a CVE when it groups advisory aliases, so include both when the reference establishes equivalence. CVE and GHSA IDs use the collector’s case normalization. Other IDs and deployment identifiers compare exactly. Finding titles, shared evidence IDs, model text and news mentions never supply event equivalence.
|
|
10
|
+
|
|
11
|
+
For example, save this synthetic incident reference in a private regular file.
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"version": 1,
|
|
16
|
+
"window": { "from": "2026-10-20", "until": "2026-10-21" },
|
|
17
|
+
"curator": "pilot-curator",
|
|
18
|
+
"selected_independently": true,
|
|
19
|
+
"incidents": [
|
|
20
|
+
{
|
|
21
|
+
"incident_id": "reference-001",
|
|
22
|
+
"event_refs": ["CVE-2026-99999", "GHSA-xxxx-yyyy-zzzz"],
|
|
23
|
+
"system_ref": "example-service",
|
|
24
|
+
"component_ref": "example-library",
|
|
25
|
+
"available_at": "2026-10-20T10:00:00.000Z",
|
|
26
|
+
"deadline_at": "2026-10-20T12:00:00.000Z"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Use a standalone private backup captured after the window ends. Confirm separately that it belongs to the intended pilot, the monitor was active and retention covers the period. The current schema cannot establish continuous collection, the backup capture time, or the scope of pruned history. Record these checks alongside the source list when interpreting misses.
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
security-watch pilot-recall --backup ./backups/watch.db \
|
|
36
|
+
--from 2026-10-20 --until 2026-10-21 \
|
|
37
|
+
--input ./review/urgent-incidents.json --output ./review/recall.json
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The command verifies a private temporary copy and leaves the standalone backup available for restore. Both window arguments must match the reference. Windows cover 1–31 complete UTC calendar days. Specify canonical ISO UTC instants with milliseconds. Every incident’s response interval must fit inside the window. A revision exactly at `available_at` counts as on time. A revision exactly at `deadline_at` counts as late within the window. The exclusive midnight at `until` falls outside the query. Choosing the window and deadlines before examining results avoids giving missed cases extra time.
|
|
41
|
+
|
|
42
|
+
## Read the results
|
|
43
|
+
|
|
44
|
+
`metrics.on_time_observed` counts incidents with at least one qualifying active finding revision recorded within their response interval. `metrics.on_time_immediate` adds the requirement of an in-interval saved `notify` policy decision with an enabled destination. Revisions across different aliases, times and channels earn at most one credit per incident. Multiple records for the same deployment with overlapping event references are rejected. A zero denominator produces a null rate.
|
|
45
|
+
|
|
46
|
+
| Outcome | What the backup retained for that target in the requested window |
|
|
47
|
+
| ------------------- | ------------------------------------------------------------------------------ |
|
|
48
|
+
| `on_time_immediate` | At least one immediate-policy revision in the response interval |
|
|
49
|
+
| `on_time_other` | At least one in-interval revision, with other routing throughout that interval |
|
|
50
|
+
| `prior_only` | Matching revisions only before the independently declared availability |
|
|
51
|
+
| `late_only` | Matching revisions only at or after the deadline |
|
|
52
|
+
| `prior_and_late` | Revisions on both sides of the response interval, with none inside it |
|
|
53
|
+
| `no_retained_match` | Zero qualifying revisions with the enrolled event and exact system/component |
|
|
54
|
+
|
|
55
|
+
These six counts partition the entire reference. Health, inactive and withdrawn revisions are excluded. A finding first recorded before availability can still earn timely credit from a new in-interval revision. A quiet finding with no change during that interval contributes to `prior_only` if the earlier revision is retained in the query window. A missing match can indicate an unobserved incident, an identifier mismatch, inactive monitoring or incomplete history. Consult the private source material before assigning a cause. The [retained pilot score](pilot-cases.md) measures unnecessary immediate routing on independently labeled benign cases.
|
|
56
|
+
|
|
57
|
+
### Provider acceptance
|
|
58
|
+
|
|
59
|
+
`provider_acceptance.on_time` counts each incident once when at least one matching notification receives a qualifying provider response at or after `available_at` and strictly before `deadline_at`. Both immediate alerts and digests qualify. `on_time_immediate` counts only immediate alerts. For example, a digest queued the previous evening and accepted at 10:03 for a 10:00–12:00 incident earns on-time provider credit even if the routing section has zero in-window revisions.
|
|
60
|
+
|
|
61
|
+
The worker records its local wall clock after Slack returns its expected success response or the SMTP server accepts all configured recipients. A digest batch shares the response time for its included jobs. Partial SMTP acceptance and interrupted sends have an unknown outcome. An acknowledgement records what the service accepted. A separate read receipt or operator record would be needed to measure when a person received, read or acted on a message. `unmeasured.delivered_alert_recall`, population recall and continuous monitoring remain unmeasured.
|
|
62
|
+
|
|
63
|
+
The scorer joins jobs to their exact finding revision and verifies the saved message identifies the same finding, event, system and optional component. A conflicting target stops the report. It examines every retained job for eligible revisions recorded during the study window. For earlier revisions it includes only jobs with a dated acceptance inside that window. A receipt at or after the exclusive window end still provides evidence of a late acceptance for an in-window revision. `without_retained_job` counts incidents with no job under these selection rules. A previous-day pending job, a pruned job or an earlier revision with an undated acceptance may therefore leave an incident in this group. Interpret the on-time fractions as the share of the full reference with retained confirmation. Missing evidence prevents a conclusion about what the destination actually received for the remaining incidents.
|
|
64
|
+
|
|
65
|
+
`incidents_with` counts incidents with each kind of retained evidence. One incident may appear in multiple counts when revisions or channels have different outcomes. `before_availability`, `on_time` and `at_or_after_deadline` use the provider acknowledgement clock. `accepted_time_unknown` covers accepted jobs with no timestamp or a clock reading earlier than their own revision. For schema-6 backups the scorer migrates an isolated copy and preserves every original byte. Historical accepted jobs keep their unknown time. `pending`, `sending`, `failed` and `unknown` describe the job state retained at backup time. A later retry can change that state.
|
|
66
|
+
|
|
67
|
+
`first_acceptance_after_availability` summarizes the delay in milliseconds from external availability to the first dated, retained provider acknowledgement at or after it. The count includes incidents with a late acceptance, and each qualifying incident contributes one delay. An even-sized sample averages its middle pair for the median. The 95th percentile uses nearest rank. Both timings are null for an empty sample. An on-time rate with a zero incident denominator is also null.
|
|
68
|
+
|
|
69
|
+
## Measure human acknowledgement and triage
|
|
70
|
+
|
|
71
|
+
For a human-response study, have a reviewer examine independent, timestamped ticket, pager or response records for each enrolled deployment. Agree in advance on the systems of record, the observation cutoff and what counts as human action. An **acknowledgement** is an explicit human acceptance of responsibility for the incident. **Triage** is a human assessment that records an impact determination or next action. Automated ticket creation, delivery acknowledgements and the current state of an AI review queue cannot establish either stage. A person may triage before a formal acknowledgement or arrive through another source.
|
|
72
|
+
|
|
73
|
+
Generate a private worksheet with the original incident IDs already filled and both stages marked `unreviewed`. The command requires a new output file.
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
security-watch pilot-response-template --backup ./backups/watch.db \
|
|
77
|
+
--from 2026-10-20 --until 2026-10-21 --input ./review/urgent-incidents.json \
|
|
78
|
+
--output ./review/responses.json
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Choose a reviewer separate from the reference curator. Keep the evidence and the mapping from local record handles to original records with the pilot owner. The reviewer fills in their opaque `reviewer` handle, the observation cutoff, and `reviewed_independently: true` after completing their review. The software checks the handle, declaration, timestamps and frozen evaluation ID. The pilot owner verifies who performed the review and whether the sources support each answer. For each stage use the first supported action at or after the incident’s `available_at`. Human activity before availability falls outside this measure. The common, inclusive `reviewed_through` must reach the study window’s exclusive end and cannot be in the future. Use `unresolved` for a stage where source coverage through the cutoff is insufficient.
|
|
82
|
+
|
|
83
|
+
Fill the stages separately in the private response register. For example, this row records a human acknowledgement and a completed search for triage evidence.
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"incident_id": "reference-001",
|
|
88
|
+
"acknowledgement": {
|
|
89
|
+
"status": "observed",
|
|
90
|
+
"at": "2026-10-20T10:12:30.000Z",
|
|
91
|
+
"evidence_ref": "pager-export-row-212"
|
|
92
|
+
},
|
|
93
|
+
"triage": { "status": "no_record", "at": null, "evidence_ref": "triage-ledger-search-014" }
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
| Stage status | What the reviewer supplies |
|
|
98
|
+
| ------------ | --------------------------------------------------------------------------------------------------------------------------- |
|
|
99
|
+
| `observed` | The first qualifying UTC timestamp with milliseconds and a private handle for the supporting record. |
|
|
100
|
+
| `no_record` | A null timestamp and a private handle for a completed search of the agreed sources through the cutoff. |
|
|
101
|
+
| `unresolved` | Null timestamp and handle. The reviewer examined this stage but could not establish an outcome. |
|
|
102
|
+
| `unreviewed` | Null timestamp and handle. The reviewer has yet to examine this stage. An omitted incident has this status for both stages. |
|
|
103
|
+
|
|
104
|
+
Use a local opaque handle of 1–128 letters, digits, dots, hyphens or underscores starting with a letter or digit. Keep ticket URLs, analyst identities, notes and raw messages in the private source system. A record can support both stages for one incident. For a source covering multiple incidents, identify each target-specific entry with its own handle. A search record may support multiple `no_record` answers.
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
security-watch pilot-recall --backup ./backups/watch.db \
|
|
108
|
+
--from 2026-10-20 --until 2026-10-21 --input ./review/urgent-incidents.json \
|
|
109
|
+
--responses ./review/responses.json --output ./review/human-response-score.json
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
For each stage, `on_time` gives the fraction of **all reference incidents** with confirmed action before their deadline. An action exactly at the deadline is late. `reviewed` includes unresolved cases. `resolved` counts observed actions and completed searches that found no record. The five outcome counts partition the reference. A missing record establishes what the reviewer found within the declared source scope. The `first_response_after_availability` median and 95th percentile use only observed timestamps, including late actions, and report their own sample size.
|
|
113
|
+
|
|
114
|
+
`paired_with_on_time_provider` counts timely provider and human evidence on the same incident. `both` can include human action before the provider response. `provider_only_confirmed` includes incidents where human evidence is unresolved or unreviewed. `human_only_confirmed` and `neither_confirmed` likewise describe evidence available here. These counts establish neither message readership, chronological sequence, nor the role of Security Watch in prompting action.
|
|
115
|
+
|
|
116
|
+
The `pilot_responses` report includes aggregate counts, timing summaries, window, cutoff, the original recall ID and its own evaluation ID. The latter binds the normalized register to the frozen recall score. A different backup or incident reference requires its own register. Use at most 1,000 response rows in a private file of up to 2 MiB. The programmatic entry point is `scorePilotResponses(backupPath, window, reference, register)`, with exported types `PilotResponseRegister` and `PilotResponseScore`.
|
|
117
|
+
|
|
118
|
+
## Privacy and limits
|
|
119
|
+
|
|
120
|
+
The printed report contains the window, aggregate outcomes, denominators and an opaque evaluation ID. This ID binds the normalized external reference and the exact backup and window. Reordering incidents or aliases preserves the ID. Changing input content or choosing a different backup can change it. Keep the reference file private because it contains deployment and incident lookup identifiers. Omit `--output` to print the aggregate JSON or supply a new `.json` file to create an exclusive private report. The scorer runs locally without loading inventory, model credentials or notification settings.
|
|
121
|
+
|
|
122
|
+
Use up to 1,000 listed incidents, 16 event identifiers per target, and a 1 MiB private JSON input. Use a lowercase ASCII curator handle beginning with a letter, up to 64 characters including digits, underscores and hyphens. The existing [pilot case limits](pilot-cases.md) apply to the combined set of in-window revisions and earlier revisions selected by receipt time. The scorer checks up to 2,000 in-window dated receipts and two jobs per eligible revision. Each examined job payload is limited to 512 KiB, with a 64 MiB combined limit. Oversized inputs, sparse or ambiguous references and duplicate JSON members fail without publishing partial results.
|
|
123
|
+
|
|
124
|
+
The installed package exports `scorePilotRecall(backupPath, {from, until}, reference)`, `PilotIncidentReference` and `PilotRecallScore`.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Read pilot activity from a monitor database
|
|
2
|
+
|
|
3
|
+
Run `pilot-report` after an opted-in pilot has collected data. Choose the existing database and a period of 1–31 complete UTC days. The report counts retained policy decisions, review workload and model reservations during that period. A separate snapshot shows the queue and latest stored monitor health when the report was read. The command runs locally without loading monitor configuration, inventory or credentials.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
security-watch pilot-report --database ./state/watch.db \
|
|
7
|
+
--from 2026-10-20 --until 2026-11-03 --output ./pilot-report.json
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
This example includes October 20 through November 2. Each window starts at midnight UTC on `--from` and excludes midnight on `--until`. Choose today’s UTC date as the end to include all of yesterday. Omitting `--output` prints the same aggregate JSON. File output requires a new `.json` path in an existing directory and publishes a complete private file without replacing an existing file or symbolic link.
|
|
11
|
+
|
|
12
|
+
Use `--database` for a monitor database. All queries share a single read transaction, so the report sees one consistent state while a worker is committing findings and delivery jobs. It uses SQLite’s read-only mode and runs no migrations or monitor actions. SQLite may create or update its `-wal` and `-shm` coordination files when reading a live **or stopped** WAL database. Leave those files under SQLite’s control.
|
|
13
|
+
|
|
14
|
+
Use **`--backup` for a standalone backup**. The command verifies a bounded temporary copy, reads that copy and removes it. The original remains a standalone backup suitable for subsequent verification and recovery.
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
security-watch pilot-report --backup ./backups/watch.db \
|
|
18
|
+
--from 2026-10-20 --until 2026-11-03 --output ./backup-pilot-report.json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Live databases require schema 7. For a schema 6 backup, the reader upgrades its private working copy. Earlier backups lack the full review history required for pilot reporting. Both paths require a private regular file and safe SQLite sidecars where applicable. On Unix, group and other users must have no file permissions. The backup reader rejects sidecars, links and files over 512 MiB. Report generation never loads a credentials file or contacts an advisory source, model, notification destination or heartbeat endpoint.
|
|
22
|
+
|
|
23
|
+
## Reading a report
|
|
24
|
+
|
|
25
|
+
| Field | What it measures |
|
|
26
|
+
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
27
|
+
| `activity.finding_revisions` and `distinct_findings` | Retained changes in finding state during the window and the number of distinct finding IDs that changed. An unchanged rescan adds no revision. Health findings and withdrawn or retired revisions count when retained. |
|
|
28
|
+
| `activity.decisions` and `daily` | Revision counts by the stored policy action (`notify`, `digest`, `record`). Each day also counts distinct retained evidence revisions by their first recorded fetch time. Zero rows mean the store had no retained revisions for that day. |
|
|
29
|
+
| `activity.delivery_states_for_revisions` | The state when read of each retained per-channel job tied to a finding revision from the window. A later acceptance, failure, retry or ambiguous receipt can change this count. A digest send can cover several jobs. |
|
|
30
|
+
| `activity.reviews` | Reviews opened in the window and review rows whose latest stored operator response occurred in it. The p95 is the nearest-rank duration from review creation to that latest response. It includes a sample count, excludes invalid clock intervals and is null without samples. |
|
|
31
|
+
| `activity.model_reservations` | Reserved requests, tokens and estimated cost for the selected UTC budget days. An unpriced reservation sets `reserved_usd` to null and leaves the known subtotal and unpriced count visible. Billing records are needed to establish actual spend. |
|
|
32
|
+
| `snapshot.delivery_states` | All retained jobs by their state when read, including jobs for revisions outside the window. Investigate `unknown` receipts locally before retrying. |
|
|
33
|
+
| `snapshot.reviews` | Counts of pending and under-investigation reviews and, for a monitor database, the age of the oldest open review. |
|
|
34
|
+
| `snapshot.source_coverage` and `last_scan` | Counts from the latest saved source receipts and the last scan’s available age, duration and degraded status. Freshness is recalculated against report read time for monitor databases. Missing metadata yields null. |
|
|
35
|
+
|
|
36
|
+
`snapshot.source` distinguishes a monitor database from a verified backup. A backup holds the last state saved in that copy. Its capture time and later worker activity are unknown, so the backup report leaves oldest-open age, last-scan age and source freshness null. Its retained statuses, scan duration and degraded flag can still be inspected.
|
|
37
|
+
|
|
38
|
+
Retention may have pruned history. Migrated revisions with timestamp zero are omitted from historical counts. `days_with_retained_revisions` counts days with evidence or finding revisions. Continuous monitoring requires separate historical coverage evidence. An operator may investigate a review and later dismiss it, replacing its previous response timestamp. Consequently the response metric measures the retained latest action for each review revision. The report leaves urgent recall, false-alert rate, source-to-triage p95, monitored days and actual spend explicitly unmeasured. For independently labeled routing metrics from retained revisions, use the [pilot case workflow](pilot-cases.md).
|
|
39
|
+
|
|
40
|
+
## Privacy and bounds
|
|
41
|
+
|
|
42
|
+
The report includes aggregate counts, fixed outcome names, requested dates, read time and durations. Raw source text, finding IDs, evidence IDs, names, URLs, review notes, reviewer identities, destination credentials and model prompts stay out of the report and error messages. Counts can still reveal operational volume.
|
|
43
|
+
|
|
44
|
+
The reader limits each window to 100,000 retained finding revisions and 100,000 retained evidence revisions. Current backlog and receipt queries accept at most 100,000 review rows and 100,000 notification rows across the database. It accepts at most 128 stored source receipts, 1 MiB each of coverage or last-scan metadata and 16 KiB per retained policy decision in the window. Exceeding a limit fails the report and publishes no partial totals.
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
import { readPilotReport, readPilotBackupReport } from '@shieldaai/security-watch';
|
|
48
|
+
|
|
49
|
+
const window = { from: '2026-10-20', until: '2026-11-03' };
|
|
50
|
+
const monitor = readPilotReport('./state/watch.db', window);
|
|
51
|
+
const backup = await readPilotBackupReport('./backups/watch.db', window);
|
|
52
|
+
```
|