fix(cve): an alert keeps when it was first found when a scan reports it again (#1041) #1045

Merged
sharang merged 1 commits from fix/cve-first-found into main 2026-11-17 12:59:51 +00:00
Owner

Fixes #1041. I found it testing supplier SBOMs on stage, but it affects every target.

Cause

vex_lifecycle::upsert_reported writes the whole alert a scan builds with $set, including created_at. Every scan builds its alerts anew, with created_at set to now. So each rescan moved the "found" time of every CVE it still reports to the rescan itself:

  • Verlauf: the rescan listed those CVEs as neu again. On stage, lodash's four CVEs were already found by the first scan and showed as "neu" on the rescan.
  • CVE trend ("Offene CVE mit Fix", cve_history): it counts a CVE as open from created_at, so the days before the last scan lost it.

This has been the behaviour since #502.

What

created_at is written only when the alert is first stored ($setOnInsert); every other field is still set as before. #1015 changes other parts of vex_lifecycle.rs, not upsert_reported, so they don't overlap.

Alerts stored before this change keep the created_at of their last scan; earlier times can't be recovered. From the next scan on, the time no longer moves.

Tests

  • tests/vex_lifecycle.rs: an alert reported again with a later created_at keeps the first one.
  • Local runs: the agent test suite is green, and clippy --all-targets -D warnings is clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9

Fixes #1041. I found it testing supplier SBOMs on stage, but it affects every target. ## Cause `vex_lifecycle::upsert_reported` writes the whole alert a scan builds with `$set`, including `created_at`. Every scan builds its alerts anew, with `created_at` set to now. So each rescan moved the "found" time of every CVE it still reports to the rescan itself: - **Verlauf:** the rescan listed those CVEs as **neu** again. On stage, lodash's four CVEs were already found by the first scan and showed as "neu" on the rescan. - **CVE trend** ("Offene CVE mit Fix", `cve_history`): it counts a CVE as open from `created_at`, so the days before the last scan lost it. This has been the behaviour since #502. ## What `created_at` is written only when the alert is first stored (`$setOnInsert`); every other field is still set as before. #1015 changes other parts of `vex_lifecycle.rs`, not `upsert_reported`, so they don't overlap. Alerts stored before this change keep the `created_at` of their last scan; earlier times can't be recovered. From the next scan on, the time no longer moves. ## Tests - `tests/vex_lifecycle.rs`: an alert reported again with a later `created_at` keeps the first one. - **Local runs:** the agent test suite is green, and clippy `--all-targets -D warnings` is clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang added 1 commit 2026-11-17 12:20:55 +00:00
fix(cve): an alert keeps when it was first found when a scan reports it again (#1041)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
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 / Agent integration (pull_request) Successful in 5m3s
CI / Check (pull_request) Successful in 21m22s
0fcef79ea6
upsert_reported $set the whole alert a scan built, created_at included,
so every rescan moved each still-reported CVE's 'found' time to its own:
the target's history listed them as new again, and the CVE trend lost
them for the days before. created_at is now written on insert only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang merged commit 832f9b13e1 into main 2026-11-17 12:59:51 +00:00
sharang deleted branch fix/cve-first-found 2026-11-17 12:59:52 +00:00
Sign in to join this conversation.