fix: mysql 8.0.3x binary detection (#3142)

Signed-off-by: Keith Zantow <kzantow@gmail.com>
This commit is contained in:
Keith Zantow 2024-08-21 09:48:28 -04:00 committed by GitHub
parent f786233e97
commit 73b9d5aa42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 24 additions and 2 deletions

View File

@ -116,6 +116,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("mysql-binary"),
},
},
{
logicalFixture: "mysql/8.0.37/linux-amd64",
expected: pkg.Package{
Name: "mysql",
Version: "8.0.37",
Type: "binary",
PURL: "pkg:generic/mysql@8.0.37",
Locations: locations("mysql"),
Metadata: metadata("mysql-binary"),
},
},
{
logicalFixture: "percona-server/8.0.35/linux-amd64",
expected: pkg.Package{

View File

@ -294,8 +294,12 @@ func DefaultClassifiers() []Classifier {
{
Class: "mysql-binary",
FileGlob: "**/mysql",
EvidenceMatcher: FileContentsVersionMatcher(
`(?m).*/mysql-(?P<version>[0-9]+(\.[0-9]+)?(\.[0-9]+)?(alpha[0-9]|beta[0-9]|rc[0-9])?)`),
EvidenceMatcher: evidenceMatchers(
// shutdown[NUL]8.0.37[NUL][NUL][NUL][NUL][NUL]mysql_real_esc
FileContentsVersionMatcher(`\x00(?P<version>[0-9]+(\.[0-9]+)?(\.[0-9]+)?(alpha[0-9]|beta[0-9]|rc[0-9])?)\x00+mysql`),
// /export/home/pb2/build/sb_0-26781090-1516292385.58/release/mysql-8.0.4-rc/mysys_ssl/my_default.cc
FileContentsVersionMatcher(`(?m).*/mysql-(?P<version>[0-9]+(\.[0-9]+)?(\.[0-9]+)?(alpha[0-9]|beta[0-9]|rc[0-9])?)`),
),
Package: "mysql",
PURL: mustPURL("pkg:generic/mysql@version"),
CPEs: singleCPE("cpe:2.3:a:oracle:mysql:*:*:*:*:*:*:*:*"),

View File

@ -157,6 +157,13 @@ from-images:
paths:
- /usr/bin/mysql
- version: 8.0.37
images:
- ref: mysql:8.0.37-bookworm@sha256:bad55a5bb69d6710927792384b5eb55669ee15dc85dca1888874e4a7993eecd8
platform: linux/amd64
paths:
- /usr/bin/mysql
- name: percona-server
version: 8.0.35
images: