Skip to content

Commit f29bdf6

Browse files
committed
Fix lookup of golang packages with major versions
Fix a bug causing to false positives for all golang packages with a major version. The bug is caused by the name of golang packages not including the major version. This leads the osv query to look up vulnerabilities to look up the right version, but for the wrong major. E.g. [email protected] instead of go-jose/[email protected]. Solve this issue by using the PURL to all requests to osv.dev, which correctly seems to resolve such versions.
1 parent e0aeca0 commit f29bdf6

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

internal/clients/clientimpl/osvmatcher/osvmatcher.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,8 @@ func pkgToQuery(pkg imodels.PackageInfo) *osvdev.Query {
113113
if pkg.Name() != "" && !pkg.Ecosystem().IsEmpty() && pkg.Version() != "" {
114114
return &osvdev.Query{
115115
Package: osvdev.Package{
116-
Name: pkg.Name(),
117-
Ecosystem: pkg.Ecosystem().String(),
116+
PURL: pkg.PURL().String(),
118117
},
119-
Version: pkg.Version(),
120118
}
121119
}
122120

0 commit comments

Comments
 (0)