feat: binary classifiers for Percona Software For MySQL (#2478)

Signed-off-by: Andrew Garner <garnera@vmware.com>
This commit is contained in:
Andrew Garner 2024-01-10 10:06:14 -06:00 committed by GitHub
parent d1e4ecba42
commit 29c9857857
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 91 additions and 0 deletions

View File

@ -89,6 +89,39 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("mysql-binary"), 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", logicalFixture: "mysql/5.6.51/linux-amd64",
expected: pkg.Package{ expected: pkg.Package{

View File

@ -247,6 +247,40 @@ func DefaultClassifiers() []Classifier {
PURL: mustPURL("pkg:generic/mysql@version"), PURL: mustPURL("pkg:generic/mysql@version"),
CPEs: singleCPE("cpe:2.3:a:oracle:mysql:*:*:*:*:*:*:*:*"), CPEs: singleCPE("cpe:2.3:a:oracle:mysql:*:*:*:*:*:*:*:*"),
}, },
{
Class: "mysql-binary",
FileGlob: "**/mysql",
EvidenceMatcher: FileContentsVersionMatcher(
`(?m).*/percona-server-(?P<version>[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<version>[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<version>[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", Class: "mariadb-binary",
FileGlob: "**/mariadb", FileGlob: "**/mariadb",

View File

@ -124,6 +124,30 @@ from-images:
paths: paths:
- /usr/bin/mysql - /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 # TODO: add pattern for mysqld
# - version: 5.6.51 # - version: 5.6.51
# images: # images: