Feat/catalog mongodb bin (#4541)

* fixed #4550, catalog mongodb bin

Signed-off-by: Rez Moss <hi@rezmoss.com>

* fixed #4550, catalog mongodb bin

Signed-off-by: Rez Moss <hi@rezmoss.com>

---------

Signed-off-by: Rez Moss <hi@rezmoss.com>
This commit is contained in:
Rez Moss 2026-01-08 12:18:51 -05:00 committed by GitHub
parent d24e843c45
commit 2f3a504acf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 123 additions and 0 deletions

View File

@ -653,6 +653,16 @@ catalogers:
cpes:
- cpe:2.3:a:envoyproxy:envoy:*:*:*:*:*:*:*:*
type: BinaryPkg
- method: glob
criteria:
- '**/mongod'
packages:
- class: mongodb-binary
name: mongodb
purl: pkg:generic/mongodb
cpes:
- cpe:2.3:a:mongodb:mongodb:*:*:*:*:*:*:*:*
type: BinaryPkg
- method: glob
criteria:
- '**/java'

View File

@ -183,6 +183,61 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("mariadb-binary"),
},
},
{
logicalFixture: "mongodb/8.0.17/linux-amd64",
expected: pkg.Package{
Name: "mongodb",
Version: "8.0.17",
Type: "binary",
PURL: "pkg:generic/mongodb@8.0.17",
Locations: locations("mongod"),
Metadata: metadata("mongodb-binary"),
},
},
{
logicalFixture: "mongodb/7.0.28/linux-amd64",
expected: pkg.Package{
Name: "mongodb",
Version: "7.0.28",
Type: "binary",
PURL: "pkg:generic/mongodb@7.0.28",
Locations: locations("mongod"),
Metadata: metadata("mongodb-binary"),
},
},
{
logicalFixture: "mongodb/6.0.27/linux-amd64",
expected: pkg.Package{
Name: "mongodb",
Version: "6.0.27",
Type: "binary",
PURL: "pkg:generic/mongodb@6.0.27",
Locations: locations("mongod"),
Metadata: metadata("mongodb-binary"),
},
},
{
logicalFixture: "mongodb/5.0.32/linux-amd64",
expected: pkg.Package{
Name: "mongodb",
Version: "5.0.32",
Type: "binary",
PURL: "pkg:generic/mongodb@5.0.32",
Locations: locations("mongod"),
Metadata: metadata("mongodb-binary"),
},
},
{
logicalFixture: "mongodb/4.4.30/linux-amd64",
expected: pkg.Package{
Name: "mongodb",
Version: "4.4.30",
Type: "binary",
PURL: "pkg:generic/mongodb@4.4.30",
Locations: locations("mongod"),
Metadata: metadata("mongodb-binary"),
},
},
{
logicalFixture: "traefik/1.7.34/linux-amd64",
expected: pkg.Package{

View File

@ -784,6 +784,24 @@ func DefaultClassifiers() []binutils.Classifier {
PURL: mustPURL("pkg:generic/envoy@version"),
CPEs: singleCPE("cpe:2.3:a:envoyproxy:envoy:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource),
},
{
Class: "mongodb-binary",
FileGlob: "**/mongod",
EvidenceMatcher: binutils.MatchAny(
// mongodb 4.x, 5.x, 6.x: ber followed by tcmalloc
// e.g 6.0.27[NUL]tcmalloc
m.FileContentsVersionMatcher(`(?P<version>[0-9]+\.[0-9]+\.[0-9]+)\x00tcmalloc`),
// mongodb 7.x: ver followed by "heap_size"
// e.g 7.0.28[NUL]heap_size
m.FileContentsVersionMatcher(`(?P<version>[0-9]+\.[0-9]+\.[0-9]+)\x00+heap_size`),
// mongodb 8.x: ber followed by "cppdefines"
// e.g 8.0.17[NUL]cppdefines
m.FileContentsVersionMatcher(`(?P<version>[0-9]+\.[0-9]+\.[0-9]+)\x00+cppdefines`),
),
Package: "mongodb",
PURL: mustPURL("pkg:generic/mongodb@version"),
CPEs: singleCPE("cpe:2.3:a:mongodb:mongodb:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource),
},
}
return append(classifiers, defaultJavaClassifiers()...)

View File

@ -269,6 +269,46 @@ from-images:
# paths:
# - /usr/sbin/mysqld
- name: mongodb
version: 8.0.17
images:
- ref: mongo:8.0@sha256:48432a75b23f0883e9b631af3497cbf0d477124d33a67f217c71f6e9b40fde39
platform: linux/amd64
paths:
- /usr/bin/mongod
- name: mongodb
version: 7.0.28
images:
- ref: mongo:7.0@sha256:32b5cbf6e1075ad0f5eb2b880ee61e985d5135519a7a34a7d81712af37f27913
platform: linux/amd64
paths:
- /usr/bin/mongod
- name: mongodb
version: 6.0.27
images:
- ref: mongo:6.0@sha256:03cda579c8caad6573cb98c2b3d5ff5ead452a6450561129b89595b4b9c18de2
platform: linux/amd64
paths:
- /usr/bin/mongod
- name: mongodb
version: 5.0.32
images:
- ref: mongo:5.0@sha256:5e3e87afd24d75e722884d777c5713d254f7e88ba65381b5d6484f75a21b73e3
platform: linux/amd64
paths:
- /usr/bin/mongod
- name: mongodb
version: 4.4.30
images:
- ref: mongo:4.4@sha256:4be76f674fc4b27859816811b8baa3c51830eb1dbf4ca81a51e26b79edd662ef
platform: linux/amd64
paths:
- /usr/bin/mongod
- version: 1.25.1
images:
- ref: nginx:1.25.1@sha256:73e957703f1266530db0aeac1fd6a3f87c1e59943f4c13eb340bb8521c6041d7