-
Notifications
You must be signed in to change notification settings - Fork 843
Match CPEs is nondeterministic #39899
Copy link
Copy link
Open
Labels
#g-security-complianceSecurity & Compliance product groupSecurity & Compliance product group:releaseReady to write code. Scheduled in a release. See "Making changes" in handbook.Ready to write code. Scheduled in a release. See "Making changes" in handbook.bugSomething isn't working as documentedSomething isn't working as documented~released bugThis bug was found in a stable release.This bug was found in a stable release.
Milestone
Metadata
Metadata
Assignees
Labels
#g-security-complianceSecurity & Compliance product groupSecurity & Compliance product group:releaseReady to write code. Scheduled in a release. See "Making changes" in handbook.Ready to write code. Scheduled in a release. See "Making changes" in handbook.bugSomething isn't working as documentedSomething isn't working as documented~released bugThis bug was found in a stable release.This bug was found in a stable release.
Type
Projects
Status
✅ Ready for release
Fleet version:
4.80.2
💥 Actual behavior
The CPE matching algorithm produces nondeterministic results for the "Line" messaging app. The NVD CPE database contains two products whose names contain "line":
ge:d60_line_distance_relay(a GE industrial relay) andlinecorp:line(the LINE messaging app). Both pass thecpeItemMatchesSoftwarecheck because the term "line" appears in the software name.Since SQLite does not guarantee row ordering among equally-qualifying rows, the algorithm returns whichever match SQLite happens to return first. This means the same software can be assigned different CPEs across runs, leading to inconsistent vulnerability detection results.
Observed in QA testing: 14 software entries for the Line app were assigned
ge:d60_line_distance_relayin one run andlinecorp:linein another, with identical input data.🛠️ To fix
Add a deterministic tiebreaker when multiple CPE candidates pass the
cpeItemMatchesSoftwarecheck. Options include:ORDER BY c.vendor, c.productto ensure consistent ordering across runs.🧑💻 Steps to reproduce
These steps:
fleet vuln_processing --devand query the resulting CPE:software_cpeand runfleet vuln_processing --devagain.ge:d60_line_distance_relayvslinecorp:line).🕯️ More info
QA
This is hard to QA. We have another bug that fixes the bigger issue here: #41644
For this one, just spot check vulnerabilities for any regressions.