fix(vex): a CVE a scan no longer finds is not stated fixed (#994)

A complete scan that no longer finds a CVE used to state VEX `fixed`
(Weg A), and the exports read `resolved_at` without a statement as
`fixed` (Weg B). A CVE can disappear without a fix, so neither holds.

- resolve_gone only sets resolved_at; it states nothing.
- CveAlert::statement() ignores the `fixed` scans inferred that way
  (by_scan, fixed, no reason given); a Yocto recipe's statement gives its
  reason and still counts. status_of, is_resolved_by_vex, the exports,
  the CVE groups and the ENISA drafts all read through it.
- status_of: no statement means under_investigation, gone or not.
- ENISA: the final report is dated only by a person's `fixed`; an
  exploited CVE that is merely gone reads "no longer found", not fixed.
- The CVE list (API and MCP) leaves the inferred statements out, so the
  dashboard no longer shows them.
- scripts/vex-994-cleanup.js counts the stored ones and removes them only
  with apply=true; dry run by default, counts only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-11-27 20:18:29 +01:00
1 parent f5848f7bad
commit 63eebef021
16 files changed
+380 -130

No files matched your search

+24 -12
View File
@@ -1,7 +1,7 @@
//! #498: a CVE alert's VEX status follows the scans. Gone after a complete
//! lookup, an unassessed or affected alert is `fixed` by the scan, a
//! person's `not_affected` stays; reported again, the scan's `fixed` is
//! withdrawn. A stored alert gets its component's purl on a later scan. An
//! lookup, an alert is resolved and keeps its statement or lack of one: a
//! scan never states `fixed` for a CVE it no longer finds (#994). Reported
//! again, a `fixed` scans inferred that way before is withdrawn. A stored alert gets its component's purl on a later scan. An
//! alert `not_affected` or `fixed` raises no notification until the
//! statement is withdrawn.
//! Runs against a live Mongo (`TEST_MONGODB_URI`) and skips
@@ -100,15 +100,12 @@ async fn vex_status_follows_the_scans_but_never_overrides_a_person() {
.await
.unwrap();
// Assert: three resolved; the unassessed and the affected one are fixed
// by the scan, the person's not_affected stays.
// Assert: three resolved, and no statement made: the unassessed one has
// none, the person's not_affected and affected stay (#994).
assert_eq!(resolved, 3);
let one = stored(&db, "CVE-1").await;
assert!(one.resolved_at.is_some());
assert_eq!(
one.vex.as_ref().map(|v| (v.status, v.by_scan)),
Some((VexStatus::Fixed, true))
);
assert!(one.vex.is_none(), "{:?}", one.vex);
let two = stored(&db, "CVE-2").await;
assert!(two.resolved_at.is_some());
assert_eq!(
@@ -117,12 +114,27 @@ async fn vex_status_follows_the_scans_but_never_overrides_a_person() {
);
assert_eq!(
stored(&db, "CVE-3").await.vex.map(|v| v.status),
Some(VexStatus::Fixed)
Some(VexStatus::Affected)
);
assert!(stored(&db, "CVE-4").await.resolved_at.is_none());
// Reported again: open, and the scan's `fixed` is withdrawn; the
// person's statement is kept.
// Reported again: open, and the `fixed` a scan inferred before #994 is
// withdrawn; the person's statement is kept.
let inferred = VexAssessment {
justification: None,
action_statement: None,
by: "pruefwerk-scan".into(),
by_name: None,
by_scan: true,
..by_person(VexStatus::Fixed)
};
db.cve_alerts()
.update_one(
doc! { "cve_id": "CVE-1" },
doc! { "$set": { "vex": mongodb::bson::to_bson(&inferred).unwrap() } },
)
.await
.unwrap();
upsert_reported(&db, &alert("CVE-1")).await.unwrap();
upsert_reported(&db, &alert("CVE-2")).await.unwrap();
let one = stored(&db, "CVE-1").await;