Commit 8775f01
Aharon Haravon
Fix OSV version matching for npm vulnerabilities with 'introduced: 0'
Fixes #5716
The OSV integration was filtering out version range values of "0",
assuming that versionStartIncluding=null is semantically equivalent
to >=0. However, this causes version matching to fail for OSV
vulnerabilities that use {"introduced": "0"} without an upper bound.
When all version range fields are null, the vers library creates a
WILDCARD constraint, which should match everything. However, in
practice this was preventing npm malicious packages like MAL-2022-1471
(bats-file) from being matched to affected components.
The fix stores "0" as-is in versionStartIncluding, allowing the vers
library to correctly evaluate >=0 ranges using SEMVER comparison.
Test case added for MAL-2022-1471 to verify parsing of npm malicious
packages with "introduced": "0" range notation.
Signed-off-by: Aharon Haravon <aharon.haravon@khealth.com>1 parent 0c21ab9 commit 8775f01
3 files changed
Lines changed: 25 additions & 6 deletions
File tree
- src
- main/java/org/dependencytrack/tasks
- test
- java/org/dependencytrack/parser/osv
- resources/unit/osv.jsons
Lines changed: 5 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
797 | 797 | | |
798 | 798 | | |
799 | 799 | | |
800 | | - | |
801 | | - | |
802 | | - | |
803 | | - | |
804 | | - | |
805 | | - | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
806 | 805 | | |
807 | 806 | | |
808 | 807 | | |
| |||
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
170 | 189 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments