Replace inventory-counting risk with bounded workload scoring and separate confidence

This commit is contained in:
2026-10-30 12:34:39 -07:00
parent f65ade9fff
commit 57e716b710
26 changed files with 10351 additions and 87 deletions

View File

@@ -22,7 +22,7 @@ Report source is included in locally collected server metadata. Import removes t
## Analysis
Each finding has classification, supporting evidence, severity and points. Score is capped at 100: 0 informational, 1–29 low, 30–59 medium, 60–89 high, 90–100 critical. This is demonstration heuristic logic, not a validated production risk model. Known Linux application service names receive potential-dependency findings; other running services remain unknown rather than all being classified as application workloads. Incomplete checks and observation limits always require review.
Model v2 groups workload evidence, selects its strongest rule and takes the maximum workload score. It never sums inventory observations. `dependencies.py` classifies OS/client/unknown activity separately and correlates positive nonzero PIDs with listeners; `policy.py` validates the data-only weights/thresholds; `assessment.py` computes the audit breakdown and independent coverage/confidence. Full policy identity, evidence references and score-determining groups are serialized. Thresholds and limitations are documented in SCORING.md. No result grants retirement approval.
## Verification
@@ -49,3 +49,9 @@ OS ProductType 2/3 plus build mapping gates Server 2016/2019/2022/2025. Workstat
`models/inventory.py` now owns the shared v1 validator and field allowlists. Metadata fields are additive and old demo/Linux results remain valid. Live Windows results are projected to safe fields; raw CIM instances are never serialized. Imported errors retain recognized categorical codes and timestamps but discard arbitrary diagnostic/permission text. Imports cannot assert the trusted local source label. Registry software covers both read-only machine uninstall views; services omit PathName; tasks emit safe action basenames and selected triggers rather than Arguments/XML; certificates never access private-key properties. Reports include all check statuses, timestamps and limitations.
Fixtures for all four Server releases live in tests/fixtures/windows. Python tests cover contract/identity/array handling, partial permission results, invalid output, process cancellation/reaping, timeouts, output bounds, secret-field exclusion, imports and the unchanged GUI/history/report flow. `tests/powershell/Test-Collectors.ps1` uses the native PowerShell AST parser and synthetic function/registry objects to test the scripts without querying the host; it runs automatically where PowerShell is present. This test is skipped in the current Linux environment. **No real Windows inventory has yet been produced here; do not mark the Windows milestone complete.** Use the README's explicit real-host validation command and review private reports before recording compatibility.
## Model v2 UI/report behavior
Settings can load validated scoring JSON or restore defaults. The policy is snapshotted at job start; history keeps prior model/policy results. Summary displays evidence coverage and confidence independently of workload risk. Networking augments the table with inferred/reported direction and rationale without changing the raw rows. Dependencies excludes OS/unknown context; Risk Findings retains zero-point review context and the exact maximum-score formula. The HTML report writes a content-addressed full-inventory sidecar and links it rather than embedding raw inventory. Tests cover sidecar collision safety, escaping, preservation and reimport.
Windows shares now optionally query Get-SmbOpenFile read-only. They match full paths against share root plus ShareRelativePath, avoiding administrative drive access being mistaken for nested business-share use. Only aggregate counts/time/source are exported. Same-root administrative aliases are ambiguous. Native scripts/tests require Windows validation; the Python fixtures distinguish confirmed aggregate activity from generic SMB transport.