Support detection of Chrome binaries (#3136)

* test: add test cases

Signed-off-by: Stijn Taelemans <taelemansst@gmail.com>

* feat: add classifier for chrome

Signed-off-by: Stijn Taelemans <taelemansst@gmail.com>

---------

Signed-off-by: Stijn Taelemans <taelemansst@gmail.com>
This commit is contained in:
Stijn Taelemans 2025-04-21 22:37:15 +02:00 committed by GitHub
parent ab570497b0
commit df11561929
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 33 additions and 0 deletions

View File

@ -1342,6 +1342,28 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("jq-binary"), Metadata: metadata("jq-binary"),
}, },
}, },
{
logicalFixture: "chrome/126.0.6478.182/linux-amd64",
expected: pkg.Package{
Name: "chrome",
Version: "126.0.6478.182",
Type: "binary",
PURL: "pkg:generic/chrome@126.0.6478.182",
Locations: locations("chrome"),
Metadata: metadata("chrome-binary"),
},
},
{
logicalFixture: "chrome/127.0.6533.119/linux-amd64",
expected: pkg.Package{
Name: "chrome",
Version: "127.0.6533.119",
Type: "binary",
PURL: "pkg:generic/chrome@127.0.6533.119",
Locations: locations("chrome"),
Metadata: metadata("chrome-binary"),
},
},
} }
for _, test := range tests { for _, test := range tests {

View File

@ -670,6 +670,17 @@ func DefaultClassifiers() []Classifier {
PURL: mustPURL("pkg:generic/jq@version"), PURL: mustPURL("pkg:generic/jq@version"),
CPEs: singleCPE("cpe:2.3:a:jqlang:jq:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource), CPEs: singleCPE("cpe:2.3:a:jqlang:jq:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource),
}, },
{
Class: "chrome-binary",
FileGlob: "**/chrome",
EvidenceMatcher: FileContentsVersionMatcher(
// [NUL]127.0.6533.119[NUL]Default
`\x00(?P<version>[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\x00Default`,
),
Package: "chrome",
PURL: mustPURL("pkg:generic/chrome@version"),
CPEs: singleCPE("cpe:2.3:a:google:chrome:*:*:*:*:*:*:*:*"),
},
} }
} }