feat: classifier for util-linux (#2933)

Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
This commit is contained in:
Laurent Goderre 2024-06-05 17:32:52 -04:00 committed by GitHub
parent f4c941f08d
commit b608ab77e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 27 additions and 0 deletions

View File

@ -616,6 +616,16 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("busybox-binary", "[", "busybox"),
},
},
{
logicalFixture: `util-linux/2.37.4/linux-amd64`,
expected: pkg.Package{
Name: "util-linux",
Version: "2.37.4",
PURL: "pkg:generic/util-linux@2.37.4",
Locations: locations("getopt"),
Metadata: metadata("util-linux-binary"),
},
},
{
logicalFixture: "java-jre-openjdk/1.8.0_352-b08/linux-amd64",
expected: pkg.Package{

View File

@ -173,6 +173,15 @@ func DefaultClassifiers() []Classifier {
PURL: mustPURL("pkg:generic/busybox@version"),
CPEs: singleCPE("cpe:2.3:a:busybox:busybox:*:*:*:*:*:*:*:*"),
},
{
Class: "util-linux-binary",
FileGlob: "**/getopt",
EvidenceMatcher: FileContentsVersionMatcher(
`\x00util-linux\s(?P<version>[0-9]+\.[0-9]+\.[0-9]+)\x00`),
Package: "util-linux",
PURL: mustPURL("pkg:generic/util-linux@version"),
CPEs: singleCPE("cpe:2.3:a:kernel:util-linux:*:*:*:*:*:*:*:*"),
},
{
Class: "haproxy-binary",
FileGlob: "**/haproxy",

View File

@ -17,6 +17,14 @@ from-images:
paths:
- /bin/[
- name: util-linux
version: 2.37.4
images:
- ref: cirros:0.6.2@sha256:7ba1f5bc57923f65c99677e53758d386320ed699b621d9630b1f2bd7ceb3a878
platform: linux/amd64
paths:
- /usr/bin/getopt
- version: 5.1.16
images:
- ref: bash:5.1.16@sha256:c7a903a541d8f5fe693cbe7f5ece18a1b6a03734c76092d2b153d7e98a964927