From 15af992225b8f046de9459a019de7e39f5525fbb Mon Sep 17 00:00:00 2001 From: witchcraze <67056980+witchcraze@users.noreply.github.com> Date: Mon, 5 Jan 2026 23:40:35 +0900 Subject: [PATCH] add valkey classifier (#4509) * add valkey classifier Signed-off-by: witchcraze * fix test path Signed-off-by: witchcraze * Run 'go generate ./internal/capabilities' Signed-off-by: witchcraze --- syft/pkg/cataloger/binary/capabilities.yaml | 12 ++++++++++++ .../cataloger/binary/classifier_cataloger_test.go | 11 +++++++++++ syft/pkg/cataloger/binary/classifiers.go | 14 ++++++++++++++ .../valkey-server/9.0.0/linux-amd64/valkey-server | Bin 0 -> 357 bytes .../cataloger/binary/test-fixtures/config.yaml | 7 +++++++ 5 files changed, 44 insertions(+) create mode 100644 syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/valkey-server/9.0.0/linux-amd64/valkey-server diff --git a/syft/pkg/cataloger/binary/capabilities.yaml b/syft/pkg/cataloger/binary/capabilities.yaml index d2d37adee..39871208f 100644 --- a/syft/pkg/cataloger/binary/capabilities.yaml +++ b/syft/pkg/cataloger/binary/capabilities.yaml @@ -87,6 +87,18 @@ catalogers: - cpe:2.3:a:redislabs:redis:*:*:*:*:*:*:*:* - cpe:2.3:a:redis:redis:*:*:*:*:*:*:*:* type: BinaryPkg + - method: glob + criteria: + - '**/valkey-server' + packages: + - class: valkey-binary + name: valkey + purl: pkg:generic/valkey + cpes: + - cpe:2.3:a:lfprojects:valkey:*:*:*:*:*:*:*:* + - cpe:2.3:a:linuxfoundation:valkey:*:*:*:*:*:*:*:* + - cpe:2.3:a:valkey-io:valkey:*:*:*:*:*:*:*:* + type: BinaryPkg - method: glob criteria: - '**/node' diff --git a/syft/pkg/cataloger/binary/classifier_cataloger_test.go b/syft/pkg/cataloger/binary/classifier_cataloger_test.go index 4cd12f4df..abac67912 100644 --- a/syft/pkg/cataloger/binary/classifier_cataloger_test.go +++ b/syft/pkg/cataloger/binary/classifier_cataloger_test.go @@ -469,6 +469,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) { Metadata: metadata("redis-binary"), }, }, + { + logicalFixture: "valkey-server/9.0.0/linux-amd64", + expected: pkg.Package{ + Name: "valkey", + Version: "9.0.0", + Type: "binary", + PURL: "pkg:generic/valkey@9.0.0", + Locations: locations("valkey-server"), + Metadata: metadata("valkey-binary"), + }, + }, { logicalFixture: "python-shared-lib/3.7.4/linux-amd64", expected: pkg.Package{ diff --git a/syft/pkg/cataloger/binary/classifiers.go b/syft/pkg/cataloger/binary/classifiers.go index c3480aac8..4d2189639 100644 --- a/syft/pkg/cataloger/binary/classifiers.go +++ b/syft/pkg/cataloger/binary/classifiers.go @@ -113,6 +113,20 @@ func DefaultClassifiers() []binutils.Classifier { cpe.Must("cpe:2.3:a:redis:redis:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource), }, }, + { + Class: "valkey-binary", + FileGlob: "**/valkey-server", + EvidenceMatcher: m.FileContentsVersionMatcher( + // valkey9.0.0buildkitsandbox-1764887574000000000 + `[^\d](?P\d+.\d+\.\d+)buildkitsandbox-\d+`), + Package: "valkey", + PURL: mustPURL("pkg:generic/valkey@version"), + CPEs: []cpe.CPE{ + cpe.Must("cpe:2.3:a:lfprojects:valkey:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource), + cpe.Must("cpe:2.3:a:linuxfoundation:valkey:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource), + cpe.Must("cpe:2.3:a:valkey-io:valkey:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource), + }, + }, { Class: "nodejs-binary", FileGlob: "**/node", diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/valkey-server/9.0.0/linux-amd64/valkey-server b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/valkey-server/9.0.0/linux-amd64/valkey-server new file mode 100644 index 0000000000000000000000000000000000000000..da5f79ffc96102ce7cd947b52743ac9cb2724b75 GIT binary patch literal 357 zcmXw#OKt)&42HYTDIy`Hb^&r;PBIcl=!z5M;gk_!1~Dmxp1z?i|HjsD`;+Y{oM_*!qEOfcjh0Ucb)CR6Jpw+-CO&{$ra3O&$(|A5p+aH27IB?W95*CP7D=oc3%vOuy zK*|i!Nh5)>Pr)l!d`3zUu$wZZU@#ZS%2??M6EPU)sVLBpqeklqvP;f-j|xzrrKr6t z5rQE~V5}-hh=4{Kn_^;YwOa9bZ^ZxCegek}QwhxD0e(8I9K{1iGpJ-pZlcis7=?AEp39{88J G=Jo?CMQ8B< literal 0 HcmV?d00001 diff --git a/syft/pkg/cataloger/binary/test-fixtures/config.yaml b/syft/pkg/cataloger/binary/test-fixtures/config.yaml index c777ff243..f2a5638a2 100644 --- a/syft/pkg/cataloger/binary/test-fixtures/config.yaml +++ b/syft/pkg/cataloger/binary/test-fixtures/config.yaml @@ -513,6 +513,13 @@ from-images: paths: - /usr/local/bin/redis-server + - version: 9.0.0 + images: + - ref: valkey/valkey:9.0.0@sha256:42ea97850708540d4e05f6241cfbd241c1ba502e64d9a42efb2c2e277a8ca9d6 + platform: linux/amd64 + paths: + - /usr/local/bin/valkey-server + - version: 2.9.0 images: - ref: wordpress:cli-2.9.0-php8.3@sha256:3a008aafccc6a8d2d7ec2b069722cb43b3569b61cd833f9f2f13d74a9284746e