diff --git a/syft/pkg/cataloger/binary/cataloger_test.go b/syft/pkg/cataloger/binary/cataloger_test.go index 6724e6d80..26992889a 100644 --- a/syft/pkg/cataloger/binary/cataloger_test.go +++ b/syft/pkg/cataloger/binary/cataloger_test.go @@ -89,6 +89,39 @@ func Test_Cataloger_PositiveCases(t *testing.T) { Metadata: metadata("mysql-binary"), }, }, + { + logicalFixture: "percona-server/8.0.35/linux-amd64", + expected: pkg.Package{ + Name: "percona-server", + Version: "8.0.35", + Type: "binary", + PURL: "pkg:generic/percona-server@8.0.35", + Locations: locations("mysql"), + Metadata: metadata("mysql-binary"), + }, + }, + { + logicalFixture: "percona-xtradb-cluster/8.0.34/linux-amd64", + expected: pkg.Package{ + Name: "percona-xtradb-cluster", + Version: "8.0.34", + Type: "binary", + PURL: "pkg:generic/percona-xtradb-cluster@8.0.34", + Locations: locations("mysql"), + Metadata: metadata("mysql-binary"), + }, + }, + { + logicalFixture: "percona-xtrabackup/8.0.35/linux-amd64", + expected: pkg.Package{ + Name: "percona-xtrabackup", + Version: "8.0.35", + Type: "binary", + PURL: "pkg:generic/percona-xtrabackup@8.0.35", + Locations: locations("xtrabackup"), + Metadata: metadata("xtrabackup-binary"), + }, + }, { logicalFixture: "mysql/5.6.51/linux-amd64", expected: pkg.Package{ diff --git a/syft/pkg/cataloger/binary/default_classifiers.go b/syft/pkg/cataloger/binary/default_classifiers.go index 6adc136fb..c0ef9de6b 100644 --- a/syft/pkg/cataloger/binary/default_classifiers.go +++ b/syft/pkg/cataloger/binary/default_classifiers.go @@ -247,6 +247,40 @@ func DefaultClassifiers() []Classifier { PURL: mustPURL("pkg:generic/mysql@version"), CPEs: singleCPE("cpe:2.3:a:oracle:mysql:*:*:*:*:*:*:*:*"), }, + { + Class: "mysql-binary", + FileGlob: "**/mysql", + EvidenceMatcher: FileContentsVersionMatcher( + `(?m).*/percona-server-(?P[0-9]+(\.[0-9]+)?(\.[0-9]+)?(alpha[0-9]|beta[0-9]|rc[0-9])?)`), + Package: "percona-server", + PURL: mustPURL("pkg:generic/percona-server@version"), + CPEs: []cpe.CPE{ + cpe.Must("cpe:2.3:a:oracle:mysql:*:*:*:*:*:*:*:*"), + cpe.Must("cpe:2.3:a:percona:percona_server:*:*:*:*:*:*:*:*"), + }, + }, + { + Class: "mysql-binary", + FileGlob: "**/mysql", + EvidenceMatcher: FileContentsVersionMatcher( + `(?m).*/Percona-XtraDB-Cluster-(?P[0-9]+(\.[0-9]+)?(\.[0-9]+)?(alpha[0-9]|beta[0-9]|rc[0-9])?)`), + Package: "percona-xtradb-cluster", + PURL: mustPURL("pkg:generic/percona-xtradb-cluster@version"), + CPEs: []cpe.CPE{ + cpe.Must("cpe:2.3:a:oracle:mysql:*:*:*:*:*:*:*:*"), + cpe.Must("cpe:2.3:a:percona:percona_server:*:*:*:*:*:*:*:*"), + cpe.Must("cpe:2.3:a:percona:xtradb_cluster:*:*:*:*:*:*:*:*"), + }, + }, + { + Class: "xtrabackup-binary", + FileGlob: "**/xtrabackup", + EvidenceMatcher: FileContentsVersionMatcher( + `(?m).*/percona-xtrabackup-(?P[0-9]+(\.[0-9]+)?(\.[0-9]+)?(alpha[0-9]|beta[0-9]|rc[0-9])?)`), + Package: "percona-xtrabackup", + PURL: mustPURL("pkg:generic/percona-xtrabackup@version"), + CPEs: singleCPE("cpe:2.3:a:percona:xtrabackup:*:*:*:*:*:*:*:*"), + }, { Class: "mariadb-binary", FileGlob: "**/mariadb", diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/percona-server/8.0.35/linux-amd64/mysql b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/percona-server/8.0.35/linux-amd64/mysql new file mode 100644 index 000000000..ec564097f Binary files /dev/null and b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/percona-server/8.0.35/linux-amd64/mysql differ diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/percona-xtrabackup/8.0.35/linux-amd64/xtrabackup b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/percona-xtrabackup/8.0.35/linux-amd64/xtrabackup new file mode 100644 index 000000000..61c6f0a91 Binary files /dev/null and b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/percona-xtrabackup/8.0.35/linux-amd64/xtrabackup differ diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/percona-xtradb-cluster/8.0.34/linux-amd64/mysql b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/percona-xtradb-cluster/8.0.34/linux-amd64/mysql new file mode 100644 index 000000000..1d60bcf95 Binary files /dev/null and b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/percona-xtradb-cluster/8.0.34/linux-amd64/mysql differ diff --git a/syft/pkg/cataloger/binary/test-fixtures/config.yaml b/syft/pkg/cataloger/binary/test-fixtures/config.yaml index 05632221d..478a74d5d 100644 --- a/syft/pkg/cataloger/binary/test-fixtures/config.yaml +++ b/syft/pkg/cataloger/binary/test-fixtures/config.yaml @@ -124,6 +124,30 @@ from-images: paths: - /usr/bin/mysql + - name: percona-server + version: 8.0.35 + images: + - ref: percona/percona-server:8.0.35@sha256:b76c455d3db1ae297449753b1054547b7910b3fd2ed4fd8c761cc1a6e202095a + platform: linux/amd64 + paths: + - /usr/bin/mysql + + - name: percona-xtrabackup + version: 8.0.35 + images: + - ref: percona/percona-xtrabackup:8.0.35@sha256:7fe6514db30384145b7387efb0f5250bc1f558dc8779ee15269a81c942bf8698 + platform: linux/amd64 + paths: + - /usr/bin/xtrabackup + + - name: percona-xtradb-cluster + version: 8.0.34 + images: + - ref: percona/percona-xtradb-cluster:8.0.34@sha256:cc5ec8d61a1eb5cccc2727932f85764151aaf4c1dd17c4c20b7c522e2fea57a8 + platform: linux/amd64 + paths: + - /usr/bin/mysql + # TODO: add pattern for mysqld # - version: 5.6.51 # images: