Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions syft/pkg/cataloger/binary/cataloger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
34 changes: 34 additions & 0 deletions syft/pkg/cataloger/binary/default_classifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,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<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",
FileGlob: "**/mariadb",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
24 changes: 24 additions & 0 deletions syft/pkg/cataloger/binary/test-fixtures/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,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:
Expand Down