Compare commits

..
Author SHA1 Message Date
Sharang ParnerkarandClaude Opus 5.5 fbc1139626 fix(vex): an issue whose CVE is gone stays open, told so once (#994)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 5m27s
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 22m15s
A complete scan that no longer finds a CVE closed its tracker issue. A CVE
can disappear without a fix, so the issue now stays open and gets one
comment saying the scan no longer finds it and that a person checks and
closes it (in Prüfwerk with the VEX status "Behoben" and a reason).
TrackerIssue::gone_noted_at keeps it to one comment while the CVE stays
gone; when the CVE is found again it is cleared, so a later disappearance
is told again.

Docs (managed git, issues) say the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
2026-11-27 23:00:03 +01:00
Sharang ParnerkarandClaude Opus 5.5 ffcd555324 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
2026-11-27 23:00:03 +01:00
sharangandSharang Parnerkar ddb0068b3e chore(deps): cookie 0.18.3 and url 2.5.9 for two new advisories (#1075)
CI / Check (push) Skipped
CI / Agent integration (push) Skipped
CI / Detect Changes (push) Successful in 4s
CI / Deploy Docs (push) Skipped
CI / Deploy MCP (push) Successful in 6m3s
CI / Deploy Agent (push) Successful in 12m29s
CI / Deploy Dashboard (push) Successful in 14m6s
This PR changes only `Cargo.lock`, to fix `cargo audit`. The audit currently fails the Check job on every PR, including #1015 and #1074, because of two advisories published since the last main build:

- **RUSTSEC-2026-0594**, `cookie` 0.18.1 → 0.18.3: private cookie nonces can repeat in processes that fork. Medium, 6.5.
- **RUSTSEC-2026-0592**, `url` 2.5.8 → 2.5.9: stack overflow in `Url::origin()` on nested `blob:` URLs. `form_urlencoded` moves from 1.2.2 to 1.2.3 with it.

**Checks**
- Locally, `cargo audit` reports no vulnerabilities, only the 14 allowed warnings.
- `cargo check` passes for agent, MCP and dashboard (server).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com>
Reviewed-on: #1075
2026-11-27 21:59:51 +00:00
22 changed files with 498 additions and 168 deletions

No files matched your search

Generated
+6 -6
View File
@@ -959,9 +959,9 @@ dependencies = [
[[package]]
name = "cookie"
version = "0.18.1"
version = "0.18.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747"
checksum = "d55f2d6c30eeec7d5c6f98bd4395d4abb1895629eab97ee6522d340623615f8a"
dependencies = [
"base64 0.22.1",
"hmac 0.12.1",
@@ -2292,9 +2292,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]]
name = "form_urlencoded"
version = "1.2.2"
version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e"
dependencies = [
"percent-encoding",
]
@@ -6784,9 +6784,9 @@ checksum = "e497bb1f828cc9fb236722c2eaa100dcf201563f38f4da6252357a59037adf31"
[[package]]
name = "url"
version = "2.5.8"
version = "2.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a"
dependencies = [
"form_urlencoded",
"idna",
+4 -2
View File
@@ -20,7 +20,8 @@ use super::dto::{collect_cursor_async, tenant_db, AgentExt, ApiResponse, ApiResu
use super::findings::Actor;
/// GET /api/v1/targets/{id}/cves — the target's CVE alerts with their VEX
/// statements, newest first.
/// statements, newest first. A `fixed` a scan inferred from a CVE no longer
/// being found is left out (#994).
#[tracing::instrument(skip_all, fields(target_id = %id))]
pub async fn list_target_cves(
Extension(agent): AgentExt,
@@ -29,7 +30,8 @@ pub async fn list_target_cves(
) -> ApiResult<Vec<CveAlert>> {
let db = tenant_db(&agent, &tenant).await?;
// An unreadable list reads as empty here, as it always has.
let alerts = target_alerts(&db, &id).await.unwrap_or_default();
let mut alerts = target_alerts(&db, &id).await.unwrap_or_default();
alerts.iter_mut().for_each(CveAlert::drop_inferred_fix);
Ok(Json(ApiResponse {
total: Some(alerts.len() as u64),
data: alerts,
+134 -23
View File
@@ -3,9 +3,10 @@
//! For a target from a managed git source (#439), every critical or high CVE
//! in its components becomes one issue per package and CVE, labelled like the
//! finding issues plus `cve`, with the fixed version where the advisory names
//! one. When a later complete scan no longer finds the CVE (the dependency was
//! updated or removed), the issue is closed with a comment; when it comes back,
//! it is reopened.
//! one. When a later complete scan no longer finds the CVE, the issue stays
//! open and is told so once (#994): a CVE can disappear without a fix (other
//! scan data, a changed identification), so a person checks and closes it.
//! When the CVE comes back, the next disappearance is told again.
//!
//! An issue a person closed in Gitea (#953) stays closed while the scan still
//! finds its CVE: closing it was that person's call, and no VEX statement is
@@ -96,6 +97,8 @@ pub(crate) struct CveIssueCounts {
pub created: u32,
pub reopened: u32,
pub closed: u32,
/// Open issues told that the scan no longer finds their CVE.
pub noted_gone: u32,
}
/// The key a CVE issue is stored under (`TrackerIssue::finding_id`): one per
@@ -165,7 +168,8 @@ fn issue_worthy(alert: &CveAlert, epss_percentile: Option<f64>) -> bool {
/// its stored VEX statement
/// ([`crate::pipeline::vex_lifecycle::attach_stored_vex`])
/// * `complete` - whether every component was matched; only then is a CVE
/// that is missing from `alerts` known to be gone, and its issue closed
/// that is missing from `alerts` known to be gone, and its open issue told
/// so (once; it stays open)
///
/// # Errors
///
@@ -203,6 +207,11 @@ pub(crate) async fn sync_cve_issues(
match existing.get(key) {
// A person closed it in Gitea while the CVE is unchanged.
Some(issue) if issue.closed_in_tracker.is_some() => {}
// Found again after it was gone: a later disappearance is told
// again.
Some(issue) if issue.gone_noted_at.is_some() && !issue.status.is_closed() => {
note_gone(target.db, issue, false).await?;
}
Some(issue) if issue.status.is_closed() => {
let comment = "**Prüfwerk:** Bei der Prüfung erneut gefunden, daher wieder geöffnet.\n\nFound again by the scan, so reopened.";
if set_state(target, issue, comment, "open").await {
@@ -242,10 +251,22 @@ pub(crate) async fn sync_cve_issues(
}
continue;
}
let comment = "**Prüfwerk:** Die Prüfung findet diese Schwachstelle nicht mehr: Die Abhängigkeit wurde aktualisiert oder entfernt.\n\nThe scan no longer finds this vulnerability: the dependency was updated or removed.";
if set_state(target, issue, comment, "closed").await {
record(target.db, issue, IssueStatus::Closed).await?;
counts.closed += 1;
if issue.gone_noted_at.is_some() {
continue;
}
let number = issue.external_id.as_str();
match target
.tracker
.add_comment(target.owner, target.repo, number, GONE_COMMENT)
.await
{
Ok(()) => {
note_gone(target.db, issue, true).await?;
counts.noted_gone += 1;
}
Err(e) => {
tracing::warn!(issue = number, error = %e, "could not comment on the CVE issue");
}
}
}
}
@@ -505,6 +526,27 @@ async fn set_state(
}
}
/// The comment an open issue gets once when a complete scan no longer finds
/// its CVE. It stays open: that the CVE is gone is no proof of a fix (#994).
const GONE_COMMENT: &str = "**Prüfwerk:** Die Prüfung findet diese Schwachstelle nicht mehr. Das allein belegt keine Behebung: Bitte prüfen Sie, ob sie behoben ist, und schließen Sie das Issue dann selbst. In Prüfwerk können Sie dazu den VEX-Status \"Behoben\" mit Begründung setzen.\n\nThe scan no longer finds this vulnerability. That alone does not prove a fix: please check whether it is fixed and close the issue yourself. In Prüfwerk you can set the VEX status \"fixed\" with a reason.";
/// Store that `issue` was told its CVE is gone (`gone`), or that the CVE was
/// found again.
async fn note_gone(db: &Database, issue: &TrackerIssue, gone: bool) -> Result<(), AgentError> {
let Some(id) = issue.id else {
return Ok(());
};
let update = if gone {
doc! { "$set": { "gone_noted_at": mongodb::bson::DateTime::now() } }
} else {
doc! { "$unset": { "gone_noted_at": "" } }
};
db.tracker_issues()
.update_one(doc! { "_id": id }, update)
.await?;
Ok(())
}
/// Store an issue's new state.
async fn record(
db: &Database,
@@ -719,7 +761,7 @@ mod tests {
}
#[tokio::test]
async fn severe_cves_open_issues_that_close_when_the_dependency_is_fixed() {
async fn severe_cves_open_issues_a_person_closes_once_the_cve_is_gone() {
let uri = std::env::var("TEST_MONGODB_URI")
.unwrap_or_else(|_| "mongodb://root:example@localhost:27017/?authSource=admin".into());
let prefix = format!(
@@ -783,30 +825,50 @@ mod tests {
CveIssueCounts::default()
);
// The dependency is updated: the complete scan finds it no more.
// The complete scan finds it no more: the issue is told so once and
// stays open, since a CVE that is gone is no proof of a fix (#994).
let noted = CveIssueCounts {
noted_gone: 1,
..Default::default()
};
assert_eq!(
sync_cve_issues(&target, &[minor], true).await.unwrap(),
CveIssueCounts {
closed: 1,
..Default::default()
}
sync_cve_issues(&target, std::slice::from_ref(&minor), true)
.await
.unwrap(),
noted
);
{
let calls = calls.lock().unwrap();
let last = calls.last().unwrap();
assert!(
last.starts_with("comment 100: ") && last.contains("no longer finds"),
"{last}"
);
assert!(calls.iter().all(|c| !c.starts_with("state ")), "{calls:?}");
}
let sent = calls.lock().unwrap().len();
assert_eq!(
calls.lock().unwrap().last().unwrap(),
"state 100: \"closed\""
sync_cve_issues(&target, std::slice::from_ref(&minor), true)
.await
.unwrap(),
CveIssueCounts::default(),
"told once"
);
assert_eq!(calls.lock().unwrap().len(), sent);
// It comes back: reopened, not opened twice.
// It comes back: the issue is still open, so nothing is sent; gone
// again, it is told again.
assert_eq!(
sync_cve_issues(&target, std::slice::from_ref(&okhttp), true)
.await
.unwrap(),
CveIssueCounts {
reopened: 1,
..Default::default()
}
CveIssueCounts::default()
);
assert_eq!(calls.lock().unwrap().last().unwrap(), "state 100: \"open\"");
assert_eq!(calls.lock().unwrap().len(), sent);
assert_eq!(sync_cve_issues(&target, &[], true).await.unwrap(), noted);
sync_cve_issues(&target, std::slice::from_ref(&okhttp), true)
.await
.unwrap();
// A person closes it in Gitea (#953): the scan that still finds the
// CVE leaves it closed and sends nothing.
@@ -997,6 +1059,55 @@ mod tests {
pool.drop_tenant("cve-issues-vex").await.ok();
}
#[tokio::test]
async fn a_cve_gone_from_the_scan_is_never_closed_as_vex_fixed() {
let Some((pool, db)) = test_db("cve-issues-gone").await else {
return;
};
let calls: Calls = Arc::default();
let tracker = tracker_at(fake_gitea(calls.clone()).await);
let target = vex_target(&db, &tracker, IssueAutoclose::On);
// The `fixed` scans inferred from a CVE no longer found (#994).
let mut log4j = alert("log4j-core", "2.14.1", "CVE-2021-44228", "CRITICAL");
log4j.vex = Some(VexAssessment {
by: "pruefwerk-scan".into(),
by_scan: true,
..vex(VexStatus::Fixed)
});
// Reported with it: no statement, so the issue opens.
let counts = sync_cve_issues(&target, std::slice::from_ref(&log4j), true)
.await
.unwrap();
assert_eq!(
counts,
CveIssueCounts {
created: 1,
..Default::default()
}
);
// Gone: never closed, neither for being gone nor with a VEX status;
// the issue is told once that the scan no longer finds the CVE.
assert_eq!(
sync_cve_issues(&target, &[], true).await.unwrap(),
CveIssueCounts {
noted_gone: 1,
..Default::default()
}
);
{
let calls = calls.lock().unwrap();
assert!(calls.iter().all(|c| !c.starts_with("state ")), "{calls:?}");
assert!(
calls.iter().any(|c| c.contains("no longer finds")),
"{calls:?}"
);
}
pool.drop_tenant("cve-issues-gone").await.ok();
}
/// Log lines written while the returned guard lives (on this thread; a
/// `#[tokio::test]` runs on one).
fn capture_logs() -> (Arc<Mutex<Vec<u8>>>, tracing::subscriber::DefaultGuard) {
@@ -243,10 +243,11 @@ impl CveIssueSync<'_> {
let counts =
crate::pipeline::cve_issues::sync_cve_issues(&target, alerts, complete).await?;
tracing::info!(
"[{repo_id}] CVE issues: {} opened, {} reopened, {} closed",
"[{repo_id}] CVE issues: {} opened, {} reopened, {} closed, {} told the CVE is gone",
counts.created,
counts.reopened,
counts.closed
counts.closed,
counts.noted_gone
);
Ok(())
}
+25 -45
View File
@@ -2,10 +2,12 @@
//!
//! An alert is stored once per CVE and target. Reported again, it is updated
//! and counts as open: a `fixed` the scan had stated is withdrawn. When a
//! complete lookup no longer reports it (the component removed or updated
//! past the fix), it is marked resolved, and one nobody assessed, or
//! assessed as affected, gets the VEX status `fixed` from the scan. A
//! person's `not_affected` or `fixed` is never changed by a scan. What a
//! complete lookup no longer reports it, it is marked resolved, and its VEX
//! status stays as it was: that a CVE is gone is no evidence of a fix, so a
//! scan never states `fixed` for it (#994). A `fixed` scans stated that way
//! before is read as no statement ([`CveAlert::statement`]) and withdrawn
//! when the CVE is reported again. A person's statement is never changed by
//! a scan. What a
//! scan states from the target's own data (a Yocto recipe's CVE_STATUS or
//! `CVE:` patch) is stated again on every scan, and likewise never replaces
//! a person's statement. The first
@@ -20,7 +22,7 @@
use futures_util::TryStreamExt;
use mongodb::bson::doc;
use compliance_core::models::{CveAlert, StatusChange, VexAssessment, VexStatus};
use compliance_core::models::{CveAlert, VexAssessment};
use crate::database::{Database, DatabasePool};
use crate::error::AgentError;
@@ -308,6 +310,11 @@ pub async fn attach_stored_vex(
/// Mark resolved the stored alerts of `repo_id` a complete lookup
/// (`complete`) no longer reports in `current`.
///
/// That is what the scan observed, not a VEX statement: each alert keeps the
/// statement it has, and one without stays without. A CVE can disappear for
/// other reasons than a fix (other scan data, an incomplete inventory, a
/// changed identification), so only a person states `fixed` (#994).
///
/// # Returns
///
/// How many were resolved.
@@ -324,52 +331,25 @@ pub async fn resolve_gone(
if !complete {
return Ok(0);
}
let now = mongodb::bson::DateTime::now();
let seen: Vec<&str> = current.iter().map(|a| a.cve_id.as_str()).collect();
let gone = doc! {
"repo_id": repo_id,
"cve_id": { "$nin": seen },
"resolved_at": { "$exists": false },
};
let fixed = VexAssessment {
status: VexStatus::Fixed,
justification: None,
impact_statement: None,
action_statement: None,
by: StatusChange::SCAN_ACTOR.to_string(),
by_name: None,
at: chrono::Utc::now(),
by_scan: true,
};
let fixed = mongodb::bson::to_bson(&fixed)
.map_err(|e| AgentError::Other(format!("encode VEX: {e}")))?;
let mut unassessed = gone.clone();
unassessed.insert(
"$or",
mongodb::bson::bson!([
{ "vex": { "$exists": false } },
{ "vex.status": { "$in": ["under_investigation", "affected"] } },
]),
);
let became_fixed = db
.cve_alerts()
.update_many(
unassessed,
doc! { "$set": { "resolved_at": now, "vex": fixed } },
)
.await?;
let resolved = db
.cve_alerts()
.update_many(gone, doc! { "$set": { "resolved_at": now } })
.await?;
let total = became_fixed.modified_count + resolved.modified_count;
if total > 0 {
.update_many(
doc! {
"repo_id": repo_id,
"cve_id": { "$nin": seen },
"resolved_at": { "$exists": false },
},
doc! { "$set": { "resolved_at": mongodb::bson::DateTime::now() } },
)
.await?
.modified_count;
if resolved > 0 {
tracing::info!(
repo_id,
resolved = total,
fixed_by_scan = became_fixed.modified_count,
resolved,
"CVE alerts no longer found marked resolved"
);
}
Ok(total)
Ok(resolved)
}
+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;
+3 -1
View File
@@ -200,7 +200,9 @@ fn vulnerability(
let product = in_product(id);
let status = status_of(alert);
push_product(&mut v, "product_status", status_key(status), &product);
let Some(vex) = &alert.vex else { continue };
let Some(vex) = alert.statement() else {
continue;
};
match status {
VexStatus::NotAffected => {
if let Some(justification) = vex.justification {
+3 -2
View File
@@ -141,9 +141,10 @@ impl PackageKey {
}
/// Whether `alert` still asks for a decision: neither stated `not_affected`
/// or `fixed`, nor found gone by a complete scan.
/// or `fixed`, nor found gone by a complete scan. Gone is not `fixed`
/// (#994); it only takes the alert off the list.
pub fn is_open(alert: &CveAlert) -> bool {
!status_of(alert).resolves()
alert.resolved_at.is_none() && !status_of(alert).resolves()
}
/// The open CVE alerts of one component.
+69 -19
View File
@@ -142,9 +142,12 @@ pub enum Reportability {
NotExploited,
/// The manufacturer stated the product is not affected.
NotAffected,
/// The product no longer contains the vulnerable component or version,
/// and no scan found it exploited while it did.
/// Stated `fixed` (VEX), and no scan found it exploited before.
Fixed,
/// A complete scan no longer finds it and no scan found it exploited
/// before, but nobody stated it `fixed`: that it is gone is no evidence
/// of a fix (#994).
NoLongerFound,
}
impl Reportability {
@@ -156,9 +159,10 @@ impl Reportability {
}
Self::NotExploited => "not known to be actively exploited",
Self::NotAffected => "the product is not affected (VEX not_affected)",
Self::Fixed => {
"the product no longer contains the vulnerable component (VEX fixed), and no \
scan found it exploited before"
Self::Fixed => "stated fixed (VEX fixed), and no scan found it exploited before",
Self::NoLongerFound => {
"a complete scan no longer finds it and no scan found it exploited before; \
nobody has stated it fixed, so this says nothing about a fix"
}
}
}
@@ -174,10 +178,16 @@ pub fn reportability(alert: &CveAlert) -> Reportability {
.exploitation
.as_ref()
.is_some_and(|e| e.actively_exploited());
let seen_exploited = alert.exploited_seen_at.is_some();
match (exploited, status_of(alert)) {
(false, _) => Reportability::NotExploited,
(true, VexStatus::NotAffected) => Reportability::NotAffected,
(true, VexStatus::Fixed) if alert.exploited_seen_at.is_none() => Reportability::Fixed,
(true, VexStatus::Fixed) if !seen_exploited => Reportability::Fixed,
(true, VexStatus::Affected | VexStatus::UnderInvestigation)
if !seen_exploited && alert.resolved_at.is_some() =>
{
Reportability::NoLongerFound
}
(true, VexStatus::Affected | VexStatus::UnderInvestigation | VexStatus::Fixed) => {
Reportability::Reportable
}
@@ -185,17 +195,13 @@ pub fn reportability(alert: &CveAlert) -> Reportability {
}
/// When the fix became available, as far as Prüfwerk knows: when a person
/// stated `fixed`, else when a scan found the component gone.
/// stated `fixed`. A scan finding the component gone dates no fix (#994),
/// so without the statement the final report has no deadline yet.
fn fixed_at(alert: &CveAlert) -> Option<DateTime<Utc>> {
if status_of(alert) != VexStatus::Fixed {
return None;
}
alert
.vex
.as_ref()
.statement()
.filter(|v| v.status == VexStatus::Fixed && !v.by_scan)
.map(|v| v.at)
.or(alert.resolved_at)
}
/// The alerts of one vulnerability, grouped by CVE ([`CveAlert::cve`]): a
@@ -297,8 +303,7 @@ pub struct EnisaInput<'a> {
/// the fixed version.
fn user_measures(alert: &CveAlert) -> Option<String> {
alert
.vex
.as_ref()
.statement()
.and_then(|v| v.action_statement.clone())
.or_else(|| {
(!alert.fixed_versions.is_empty()).then(|| {
@@ -389,7 +394,7 @@ fn value(nr: &str, input: &EnisaInput<'_>) -> Option<serde_json::Value> {
"12" => text(components(alerts)),
"14" | "17" => joined(alerts, user_measures).and_then(text),
"16" => joined(alerts, |a| {
a.vex.as_ref().and_then(|v| v.action_statement.clone())
a.statement().and_then(|v| v.action_statement.clone())
})
.and_then(text),
"v19" => cve.starts_with("CVE-").then(|| serde_json::json!(cve)),
@@ -422,8 +427,7 @@ fn value(nr: &str, input: &EnisaInput<'_>) -> Option<serde_json::Value> {
})
}
"v25" => joined(alerts, |a| {
a.vex
.as_ref()
a.statement()
.and_then(|v| v.impact_statement.clone())
.or_else(|| a.llm_impact_summary.clone())
})
@@ -553,20 +557,66 @@ mod tests {
assert_eq!(reportability(&a), Reportability::NotAffected);
a.vex = None;
a.resolved_at = Some(Utc::now());
// Gone from the scan is no fix (#994), and no reason to report.
assert_eq!(reportability(&a), Reportability::NoLongerFound);
a.vex = Some(statement(VexStatus::Fixed));
assert_eq!(reportability(&a), Reportability::Fixed);
// Found exploited while the product contained it: the final report
// is still due.
a.exploited_seen_at = Some(at("2026-10-06T08:00:00Z"));
assert_eq!(reportability(&a), Reportability::Reportable);
a.vex = None;
assert_eq!(reportability(&a), Reportability::Reportable);
a.exploitation = None;
assert_eq!(reportability(&a), Reportability::NotExploited);
}
/// The final report's draft of `a`, aware at the first exploitation.
fn final_report_draft(a: &CveAlert) -> serde_json::Value {
draft(&EnisaInput {
product: "Pump Remote",
manufacturer: "example-pumps",
tooling: "Prüfwerk test",
alerts: &[a],
aware_at: at("2026-10-01T08:00:00Z"),
now: at("2026-10-06T09:00:00Z"),
})
}
/// The final report's due date while no fix is dated.
const UNDATED_FINAL_REPORT: &str = "14 days after the date in field v22";
#[test]
fn a_vulnerability_a_scan_no_longer_finds_dates_no_final_report() {
let mut a = alert();
a.exploited_seen_at = Some(at("2026-10-01T08:00:00Z"));
a.resolved_at = Some(at("2026-10-05T10:00:00Z"));
let doc = final_report_draft(&a);
assert_eq!(doc["due"]["final_report"], UNDATED_FINAL_REPORT);
// Nor does a `fixed` a scan inferred from that before #994.
a.vex = Some(VexAssessment {
impact_statement: None,
by: "pruefwerk-scan".into(),
by_scan: true,
at: at("2026-10-05T10:00:00Z"),
..statement(VexStatus::Fixed)
});
assert_eq!(fixed_at(&a), None);
assert_eq!(status_of(&a), VexStatus::UnderInvestigation);
let doc = final_report_draft(&a);
assert_eq!(doc["due"]["final_report"], UNDATED_FINAL_REPORT);
}
#[test]
fn a_fixed_vulnerability_dates_its_final_report() {
let mut a = alert();
a.exploited_seen_at = Some(at("2026-10-01T08:00:00Z"));
a.resolved_at = Some(at("2026-10-05T10:00:00Z"));
a.resolved_at = Some(at("2026-10-04T10:00:00Z"));
a.vex = Some(VexAssessment {
at: at("2026-10-05T10:00:00Z"),
..statement(VexStatus::Fixed)
});
let doc = draft(&EnisaInput {
product: "Pump Remote",
manufacturer: "example-pumps",
+52 -6
View File
@@ -209,13 +209,30 @@ impl CveAlert {
ids
}
/// Whether a VEX statement settles the alert: `not_affected` or `fixed`,
/// stated by a person, by the scan or in an imported VEX document. Such an
/// alert raises no notification and keeps no open tracker issue; once the
/// statement is withdrawn (back to `affected`, `under_investigation` or
/// none) it counts again.
/// The alert's VEX statement, by a person, by a scan from the target's
/// own data or in an imported VEX document. A `fixed` a scan inferred
/// from the CVE no longer being found is none
/// ([`super::vex::VexAssessment::is_inferred_from_absence`], #994).
pub fn statement(&self) -> Option<&super::vex::VexAssessment> {
self.vex
.as_ref()
.filter(|vex| !vex.is_inferred_from_absence())
}
/// Drop a `fixed` inferred from absence (see [`Self::statement`]), so a
/// client shown the stored alert does not read it as a statement.
pub fn drop_inferred_fix(&mut self) {
if self.statement().is_none() {
self.vex = None;
}
}
/// Whether a VEX statement ([`Self::statement`]) settles the alert:
/// `not_affected` or `fixed`. Such an alert raises no notification and
/// keeps no open tracker issue; once the statement is withdrawn (back to
/// `affected`, `under_investigation` or none) it counts again.
pub fn is_resolved_by_vex(&self) -> bool {
self.vex.as_ref().is_some_and(|vex| vex.status.resolves())
self.statement().is_some_and(|vex| vex.status.resolves())
}
pub fn new(
@@ -292,6 +309,35 @@ mod tests {
}
}
#[test]
fn a_fixed_inferred_from_absence_is_no_statement() {
use crate::models::vex::{VexAssessment, VexStatus};
let scan_fixed = |impact_statement: Option<&str>| VexAssessment {
status: VexStatus::Fixed,
justification: None,
impact_statement: impact_statement.map(String::from),
action_statement: None,
by: "pruefwerk-scan".into(),
by_name: None,
at: Utc::now(),
by_scan: true,
};
// What scans stated for a CVE they no longer found (#994).
let mut a = alert("CVE-2021-44228", &[]);
a.vex = Some(scan_fixed(None));
assert!(a.statement().is_none());
assert!(!a.is_resolved_by_vex());
a.drop_inferred_fix();
assert!(a.vex.is_none());
// A Yocto recipe's patch gives its reason: a statement.
let recipe = scan_fixed(Some("Patched in the recipe (CVE: tag)."));
a.vex = Some(recipe.clone());
assert_eq!(a.statement(), Some(&recipe));
assert!(a.is_resolved_by_vex());
a.drop_inferred_fix();
assert_eq!(a.vex, Some(recipe));
}
#[test]
fn a_cve_is_strictly_recognised() {
assert!(is_cve("CVE-2021-44228"));
+10
View File
@@ -98,6 +98,15 @@ pub struct TrackerIssue {
/// closed: a person's decision the scan does not undo on its own.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub closed_in_tracker: Option<String>,
/// When a complete scan first no longer found the issue's CVE (#994),
/// while it stays gone: the issue was told so once and stays open, since
/// a CVE that is gone is no proof of a fix.
#[serde(
default,
skip_serializing_if = "Option::is_none",
with = "super::serde_helpers::opt_bson_datetime"
)]
pub gone_noted_at: Option<DateTime<Utc>>,
#[serde(with = "super::serde_helpers::bson_datetime")]
pub created_at: DateTime<Utc>,
#[serde(with = "super::serde_helpers::bson_datetime")]
@@ -122,6 +131,7 @@ impl TrackerIssue {
title,
status: IssueStatus::Open,
closed_in_tracker: None,
gone_noted_at: None,
created_at: now,
updated_at: now,
}
+13 -1
View File
@@ -89,7 +89,9 @@ pub struct VexAssessment {
pub by_name: Option<String>,
#[serde(with = "super::serde_helpers::bson_datetime")]
pub at: DateTime<Utc>,
/// Set by a scan (a `fixed` because the component is gone), not a person.
/// Set by a scan from the target's own data (a Yocto recipe's
/// `CVE_STATUS` or patch), not a person. Before #994 also a `fixed` for
/// a CVE a scan no longer found ([`Self::is_inferred_from_absence`]).
#[serde(default)]
pub by_scan: bool,
}
@@ -142,6 +144,16 @@ pub enum VexError {
}
impl VexAssessment {
/// Whether this is a `fixed` that a scan stated only because a complete
/// scan no longer found the CVE, as scans did before #994. A CVE can
/// disappear without a fix (other scan data, an incomplete inventory, a
/// changed identification), so nothing reads such a statement as one. A
/// scan's statement from the target's own data always gives its reason
/// (`impact_statement`), so it is never one of them.
pub fn is_inferred_from_absence(&self) -> bool {
self.by_scan && self.status == VexStatus::Fixed && self.impact_statement.is_none()
}
/// Check what OpenVEX requires of a statement: a reason for
/// `not_affected`, and (stricter than OpenVEX, as CISA recommends) an
/// action for `affected`.
+13 -15
View File
@@ -2,8 +2,10 @@
//! known vulnerability of its components, in OpenVEX 0.2.0 and in CycloneDX
//! 1.6 (the SBOM with its vulnerabilities and their analysis).
//!
//! An alert nobody assessed is `under_investigation`; one a complete scan no
//! longer finds is `fixed`. The CycloneDX analysis uses CycloneDX's terms:
//! An alert nobody assessed is `under_investigation`, also when a complete
//! scan no longer finds it: a CVE can disappear without a fix, so only a
//! statement says `fixed` (#994). The CycloneDX analysis uses CycloneDX's
//! terms:
//!
//! | OpenVEX | CycloneDX |
//! |---|---|
@@ -42,14 +44,13 @@ pub struct VexInput<'a> {
pub now: DateTime<Utc>,
}
/// The status an alert is stated with: its VEX statement's, `fixed` once a
/// complete scan found it gone, else `under_investigation`.
/// The status an alert is stated with: its VEX statement's
/// ([`CveAlert::statement`]), else `under_investigation`. A CVE a complete
/// scan no longer finds is not thereby `fixed` (#994).
pub fn status_of(alert: &CveAlert) -> VexStatus {
match (&alert.vex, alert.resolved_at) {
(Some(vex), _) => vex.status,
(None, Some(_)) => VexStatus::Fixed,
(None, None) => VexStatus::UnderInvestigation,
}
alert
.statement()
.map_or(VexStatus::UnderInvestigation, |vex| vex.status)
}
/// The SBOM entry an alert is about, if it is in the SBOM.
@@ -105,10 +106,7 @@ impl Statement<'_> {
/// the same component: an explicit statement (the latest one) over none,
/// then an open alert over a resolved one.
fn weight(alert: &CveAlert) -> (Option<DateTime<Utc>>, bool) {
(
alert.vex.as_ref().map(|v| v.at),
alert.resolved_at.is_none(),
)
(alert.statement().map(|v| v.at), alert.resolved_at.is_none())
}
/// The statements of `input`, one per CVE and component in the order the
@@ -169,7 +167,7 @@ pub fn openvex(input: &VexInput<'_>) -> serde_json::Value {
}],
"status": status,
});
if let Some(vex) = &alert.vex {
if let Some(vex) = alert.statement() {
statement["timestamp"] = serde_json::json!(rfc3339(vex.at));
if let Some(j) = vex.justification {
statement["justification"] = serde_json::json!(j);
@@ -253,7 +251,7 @@ pub fn cyclonedx_vex(input: &VexInput<'_>) -> serde_json::Value {
}
let status = status_of(alert);
let mut analysis = serde_json::json!({ "state": cdx_state(status) });
if let Some(vex) = &alert.vex {
if let Some(vex) = alert.statement() {
if let Some(j) = vex.justification {
analysis["justification"] = serde_json::json!(cdx_justification(j));
}
+41 -3
View File
@@ -111,12 +111,13 @@ fn alerts() -> Vec<CveAlert> {
s.justification = Some(VexJustification::VulnerableCodeNotInExecutePath);
s.impact_statement = Some("template() is never called.".into());
not_affected.vex = Some(s);
let mut gone = alert("CVE-2020-0001", "zlib", "1.2.11");
gone.resolved_at = Some(Utc::now());
let mut fixed = alert("CVE-2020-0001", "zlib", "1.2.11");
fixed.resolved_at = Some(Utc::now());
fixed.vex = Some(statement(VexStatus::Fixed));
vec![
affected,
not_affected,
gone,
fixed,
alert("CVE-2024-0002", "PumpSDK", "3.1.0"),
]
}
@@ -412,8 +413,10 @@ fn a_fixed_component_that_left_the_sbom_keeps_its_stored_purl() {
let mut log4j = alert("CVE-2021-44228", "log4j-core", "2.14.1");
log4j.purl = Some(maven.into());
log4j.resolved_at = Some(Utc::now());
log4j.vex = Some(statement(VexStatus::Fixed));
let mut old = alert("CVE-2020-0001", "zlib", "1.2.11");
old.resolved_at = Some(Utc::now());
old.vex = Some(statement(VexStatus::Fixed));
let alerts = vec![log4j, old];
let input = vex_input(&alerts, &sbom);
@@ -597,3 +600,38 @@ fn the_cyclonedx_sbom_lists_a_vulnerability_under_its_cve_once() {
assert_eq!(vulns[1]["source"]["name"], "osv");
assert!(vulns[1].get("references").is_none());
}
#[test]
fn a_cve_a_scan_no_longer_finds_is_not_stated_fixed() {
// Arrange (#994): one alert gone without a statement (Weg B), one with
// the `fixed` scans inferred from that before (Weg A).
let mut unstated = alert("CVE-2020-0001", "zlib", "1.2.11");
unstated.resolved_at = Some(Utc::now());
let mut inferred = alert("CVE-2021-44228", "log4j-core", "2.14.1");
inferred.resolved_at = Some(Utc::now());
inferred.vex = Some(VexAssessment {
by: "pruefwerk-scan".into(),
by_name: None,
by_scan: true,
..statement(VexStatus::Fixed)
});
let (alerts, sbom) = (vec![unstated, inferred], sbom());
let input = vex_input(&alerts, &sbom);
// Act
let openvex = vex_docs::openvex(&input);
let cdx = vex_docs::cyclonedx_vex(&input);
let csaf = csaf_docs::csaf_vex(&input, "https://example.invalid/pumps", "en");
// Assert: under investigation in every format, never fixed.
assert_eq!(openvex_errors(&openvex), Vec::<String>::new());
assert_eq!(cyclonedx_errors(&cdx), Vec::<String>::new());
assert_eq!(csaf_errors(&csaf), Vec::<String>::new());
for i in 0..2 {
assert_eq!(openvex["statements"][i]["status"], "under_investigation");
assert_eq!(cdx["vulnerabilities"][i]["analysis"]["state"], "in_triage");
let status = &csaf["vulnerabilities"][i]["product_status"];
assert!(status["fixed"].is_null(), "{status}");
assert!(status["under_investigation"].is_array(), "{status}");
}
}
+6 -2
View File
@@ -109,9 +109,10 @@ pub struct ListCvesParams {
}
/// `list_cves`: the CVE alerts of a target's dependencies and firmware
/// libraries, highest CVSS first.
/// libraries, highest CVSS first, without a `fixed` a scan inferred from a
/// CVE no longer being found (#994).
pub async fn list_cves(db: &Database, params: ListCvesParams) -> Result<CallToolResult, McpError> {
let alerts = collect(
let mut alerts: Vec<compliance_core::models::CveAlert> = collect(
db.cve_alerts()
.find(doc! { "repo_id": &params.target_id })
.sort(doc! { "cvss_score": -1 })
@@ -119,6 +120,9 @@ pub async fn list_cves(db: &Database, params: ListCvesParams) -> Result<CallTool
.map_err(db_error)?,
)
.await?;
alerts
.iter_mut()
.for_each(compliance_core::models::CveAlert::drop_inferred_fix);
json_result(&alerts)
}
+1 -1
View File
@@ -19,7 +19,7 @@ A scan opens issues only for the findings it finds new, so a finding whose issue
### CVE issues (managed repositories)
For a repository from a managed git source, known vulnerabilities in its dependencies become issues too: one per package and CVE, labelled `cve`. A critical or high CVE opens one, and so does any CVE in CISA's Known Exploited Vulnerabilities catalog (rated at least high). A CVE whose EPSS percentile reaches `CVE_ISSUE_EPSS_PERCENTILE` (default `0.95`) is rated one step higher, so a medium one opens an issue as high. The issue names the KEV entry, the EPSS score with its attribution, and CISA's SSVC exploitation where known. When a complete scan no longer finds the CVE, the issue is closed; when it comes back, it is reopened. A CVE with the VEX status `not_affected` or `fixed` gets no new issue. Its issue that is already open is closed only with `ISSUE_AUTOCLOSE=on`: with a comment naming the status and the justification, at most 20 per target and scan (the rest follow in the next scans). `ISSUE_AUTOCLOSE=dry_run` only logs, per target, how many issues it would close per VEX status, and changes nothing; the default is `off`. When the statement is withdrawn, a closed issue is reopened.
For a repository from a managed git source, known vulnerabilities in its dependencies become issues too: one per package and CVE, labelled `cve`. A critical or high CVE opens one, and so does any CVE in CISA's Known Exploited Vulnerabilities catalog (rated at least high). A CVE whose EPSS percentile reaches `CVE_ISSUE_EPSS_PERCENTILE` (default `0.95`) is rated one step higher, so a medium one opens an issue as high. The issue names the KEV entry, the EPSS score with its attribution, and CISA's SSVC exploitation where known. When a complete scan no longer finds the CVE, the issue stays open and is told so once: a CVE can disappear without a fix, so a person checks and closes it. A closed issue whose CVE comes back is reopened. A CVE with the VEX status `not_affected` or `fixed` gets no new issue. Its issue that is already open is closed only with `ISSUE_AUTOCLOSE=on`: with a comment naming the status and the justification, at most 20 per target and scan (the rest follow in the next scans). `ISSUE_AUTOCLOSE=dry_run` only logs, per target, how many issues it would close per VEX status, and changes nothing; the default is `off`. When the statement is withdrawn, a closed issue is reopened.
### Closing an issue in Gitea
+4 -3
View File
@@ -22,9 +22,10 @@ of an organisation in that instance automatically:
- **Known vulnerabilities as issues.** A critical or high CVE in a dependency
becomes one issue per package and CVE (`[CVE] okhttp@3.12.0: CVE-2021-0341`),
labelled like the findings plus `cve`, with the fixed version where the
advisory names one. When a complete scan no longer finds it (the dependency
was updated or removed), the issue is closed with a comment; if it comes
back, it is reopened.
advisory names one. When a complete scan no longer finds it, the issue stays
open and gets one comment saying so: a CVE can disappear without a fix, so
you check and close it yourself (in Prüfwerk, set the VEX status "fixed"
with a reason). If it comes back and goes again, it is told again.
- **The issue follows the finding.** When the finding is closed in Prüfwerk —
the scan no longer finds it, or someone marks it resolved, a false alarm or
ignored — Prüfwerk comments on the issue why and closes it. An accepted risk
+5 -3
View File
@@ -24,9 +24,11 @@ Repository-Organisation dieser Instanz automatisch prüfen:
Abhängigkeit wird ein Issue je Paket und CVE
(`[CVE] okhttp@3.12.0: CVE-2021-0341`), mit denselben Labels wie die Befunde
plus `cve` und der behebenden Version, wenn die Meldung eine nennt. Findet
eine vollständige Prüfung sie nicht mehr (Abhängigkeit aktualisiert oder
entfernt), wird das Issue mit Kommentar geschlossen; taucht sie wieder auf,
wird es wieder geöffnet.
eine vollständige Prüfung sie nicht mehr, bleibt das Issue offen und erhält
einmal einen Kommentar dazu: Eine CVE kann auch ohne Behebung verschwinden,
deshalb prüfen und schließen Sie es selbst (im Prüfwerk mit dem VEX-Status
„Behoben“ und Begründung). Taucht sie wieder auf und verschwindet erneut,
kommt der Hinweis noch einmal.
- **Das Issue folgt dem Befund.** Wird der Befund im Prüfwerk geschlossen –
die Prüfung findet ihn nicht mehr, oder jemand setzt ihn auf behoben,
Fehlalarm oder ignoriert –, kommentiert Prüfwerk im Issue den Grund und
+6 -5
View File
@@ -684,11 +684,12 @@ Justifications for `not_affected` (OpenVEX): `component_not_present`,
`inline_mitigations_already_exist`. A statement without what its status
requires is refused.
A scan keeps the status current: when a complete CVE check no longer finds an
alert (the component was removed or updated past the fix), it is marked
resolved, and one nobody assessed, or assessed as affected, becomes `fixed`.
A `not_affected` or `fixed` someone stated is never changed by a scan. If the
vulnerability comes back, the scan's `fixed` is withdrawn. A Yocto recipe's
When a complete CVE check no longer finds an alert, it is marked resolved and
keeps its status: a scan never states `fixed` for it, since a vulnerability
can disappear without a fix. An alert nobody assessed stays
`under_investigation` in the exports until someone states its status. A
`fixed` scans stated that way before is not read as a statement. A statement
someone made is never changed by a scan. A Yocto recipe's
`CVE_STATUS` and `CVE:` patches are stated by the scan too (see
[Embedded Linux / Yocto](/guide/yocto#recipe-inventory)), likewise never over a
person's statement.
+11 -8
View File
@@ -55,10 +55,12 @@ Read-only roles see the statements but cannot assess.
## What a scan changes
When a complete scan no longer finds a vulnerability (the component was
removed or updated), it is marked fixed and "Stated by" shows **Scan**. A
"Not affected" or "Fixed" stated by a person is never changed by a scan. If
the vulnerability comes back, the scan withdraws its "Fixed".
When a complete scan no longer finds a vulnerability, it is no longer open,
and its assessment stays as it is. A scan never states "Fixed" for it: a
vulnerability can disappear without a fix, for example through other scan
data, an incomplete inventory or a changed identification. Only a person
states "Fixed". A "Fixed" a scan stated that way before is not read as a
statement. A statement made by a person is never changed by a scan.
A vulnerability that is "Not affected" or "Fixed" (stated by a person, by the
scan or in an imported VEX document) raises no notification and gets no issue
@@ -142,10 +144,11 @@ CVE) or it affects several components. The draft
yourself, through the CSIRT of your main establishment.
Through the API you can give the time the deadlines run from (`aware_at`);
without it, the first scan that found the exploitation counts. For a fixed
vulnerability the draft carries the date of the fix (field v22) and the final
report's deadline. A vulnerability assessed "Not affected", or fixed before
any scan found it exploited, gets no draft. Actively
without it, the first scan that found the exploitation counts. For a vulnerability
assessed "Fixed" the draft carries the date of that statement (field v22) and
the final report's deadline. One a scan only no longer finds leaves both open
until someone states "Fixed". A vulnerability assessed "Not affected", or
fixed or no longer found before any scan found it exploited, gets no draft. Actively
exploited vulnerabilities are also in the evidence pack as
`enisa-drafts.json`. When ENISA changes the glossary we update the fields;
the version in a draft shows which one it follows.
+12 -9
View File
@@ -58,11 +58,13 @@ Rollen mit Lesezugriff sehen die Aussagen, können aber nicht bewerten.
## Was die Prüfung ändert
Findet eine vollständige Prüfung eine Schwachstelle nicht mehr (Komponente
entfernt oder aktualisiert), wird sie als behoben markiert; „Aussage von“
zeigt dann **Prüfung**. Eine Aussage „Nicht betroffen“ oder „Behoben“, die
eine Person gemacht hat, ändert die Prüfung nie. Taucht die Schwachstelle
wieder auf, nimmt die Prüfung ihr „Behoben“ zurück.
Findet eine vollständige Prüfung eine Schwachstelle nicht mehr, gilt sie
nicht mehr als offen; ihre Bewertung bleibt, wie sie ist. Die Prüfung setzt
dafür nie „Behoben“: Eine Schwachstelle kann auch ohne Behebung
verschwinden, etwa durch andere Scandaten, eine unvollständige Erfassung oder
eine geänderte Zuordnung. „Behoben“ sagt nur eine Person. Ein „Behoben“, das
die Prüfung früher so gesetzt hat, gilt nicht als Aussage. Eine Aussage, die
eine Person gemacht hat, ändert die Prüfung nie.
Eine Schwachstelle mit „Nicht betroffen“ oder „Behoben“ (von einer Person,
der Prüfung oder aus einem importierten VEX-Dokument) löst keine
@@ -151,10 +153,11 @@ die CVE dazu) oder sie mehrere Komponenten betrifft. Der Entwurf
Den Zeitpunkt, ab dem die Fristen laufen, können Sie über die API angeben
(`aware_at`); ohne ihn gilt die erste Prüfung, die die Ausnutzung fand. Ist
eine behobene Schwachstelle bekannt, trägt der Entwurf das Datum der Behebung
(Feld v22) und die Frist des Abschlussberichts. Ist sie als „Nicht
betroffen“ bewertet, oder wurde sie behoben, bevor eine Prüfung ihre
Ausnutzung fand, gibt es keinen Entwurf. Aktiv ausgenutzte Schwachstellen stehen als
eine Schwachstelle als „Behoben“ bewertet, trägt der Entwurf das Datum dieser
Aussage (Feld v22) und die Frist des Abschlussberichts. Findet die Prüfung sie
nur nicht mehr, bleibt beides offen, bis jemand „Behoben“ sagt. Ist sie als
„Nicht betroffen“ bewertet, oder wurde sie behoben oder nicht mehr gefunden,
bevor eine Prüfung ihre Ausnutzung fand, gibt es keinen Entwurf. Aktiv ausgenutzte Schwachstellen stehen als
`enisa-drafts.json` auch im Nachweispaket. Ändert ENISA das Glossar,
passen wir die Felder an; die Version im Entwurf zeigt, nach welchem er
erstellt wurde.
+53
View File
@@ -0,0 +1,53 @@
// #994: count, and only on request remove, the VEX `fixed` statements that
// scans inferred from a CVE no longer being found (before the fix, Weg A).
//
// Since the fix, every reader ignores them (`CveAlert::statement`), so the
// stored statements no longer reach an export, the dashboard or a tracker.
// This script removes them from the data too; whether and when it runs is the
// owner's decision on #994. The alerts keep `resolved_at`: that the scan no
// longer finds the CVE stays recorded, as an observation.
//
// A statement counts when a scan made it (`by_scan`), it says `fixed`, and it
// gives no reason (`impact_statement`). A scan's statement from the target's
// own data (a Yocto recipe's patch) always gives one, so it is never matched.
//
// It prints counts only, never a database, target or CVE. Dry run unless
// `apply` is true:
//
// mongosh "$MONGODB_URI" --quiet \
// --eval 'var prefix = "<DB prefix>", apply = false' \
// scripts/vex-994-cleanup.js
if (typeof prefix !== "string" || prefix === "") {
throw new Error("set prefix, the agent's database prefix");
}
const write = typeof apply !== "undefined" && apply === true;
const inferred = {
"vex.by_scan": true,
"vex.status": "fixed",
"vex.impact_statement": null,
};
let databases = 0;
let matched = 0;
let removed = 0;
for (const { name } of db.adminCommand({ listDatabases: 1, nameOnly: true }).databases) {
if (!name.startsWith(prefix + "_")) {
continue;
}
const alerts = db.getSiblingDB(name).getCollection("cve_alerts");
const count = alerts.countDocuments(inferred);
if (count === 0) {
continue;
}
databases += 1;
matched += count;
if (write) {
removed += alerts.updateMany(inferred, { $unset: { vex: "" } }).modifiedCount;
}
}
print(
JSON.stringify({ mode: write ? "apply" : "dry-run", databases, statements: matched, removed }),
);