add ingress-nginx classifier (#4857)

Signed-off-by: witchcraze <witchcraze@gmail.com>
This commit is contained in:
witchcraze 2026-05-06 23:54:20 +09:00 committed by GitHub
parent 1caf243d29
commit 605391114c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 203 additions and 0 deletions

View File

@ -684,6 +684,16 @@ catalogers:
cpes:
- cpe:2.3:a:mongodb:mongodb:*:*:*:*:*:*:*:*
type: BinaryPkg
- method: glob
criteria:
- '**/nginx-ingress-controller'
packages:
- class: ingress-nginx-binary
name: nginx-ingress-controller
purl: pkg:generic/nginx-ingress-controller
cpes:
- cpe:2.3:a:kubernetes:ingress-nginx:*:*:*:*:*:*:*:*
type: BinaryPkg
- method: glob
criteria:
- '**/java'

View File

@ -2227,6 +2227,105 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("envoy-binary"),
},
},
{
logicalFixture: "nginx-ingress-controller/1.15.1/linux-amd64",
expected: pkg.Package{
Name: "nginx-ingress-controller",
Version: "1.15.1",
Type: "binary",
PURL: "pkg:generic/nginx-ingress-controller@1.15.1",
Locations: locations("nginx-ingress-controller"),
Metadata: metadata("ingress-nginx-binary"),
},
},
{
logicalFixture: "nginx-ingress-controller/1.11.8/linux-amd64",
expected: pkg.Package{
Name: "nginx-ingress-controller",
Version: "1.11.8",
Type: "binary",
PURL: "pkg:generic/nginx-ingress-controller@1.11.8",
Locations: locations("nginx-ingress-controller"),
Metadata: metadata("ingress-nginx-binary"),
},
},
{
logicalFixture: "nginx-ingress-controller/1.9.6/linux-amd64",
expected: pkg.Package{
Name: "nginx-ingress-controller",
Version: "1.9.6",
Type: "binary",
PURL: "pkg:generic/nginx-ingress-controller@1.9.6",
Locations: locations("nginx-ingress-controller"),
Metadata: metadata("ingress-nginx-binary"),
},
},
{
logicalFixture: "nginx-ingress-controller/1.7.1/linux-amd64",
expected: pkg.Package{
Name: "nginx-ingress-controller",
Version: "1.7.1",
Type: "binary",
PURL: "pkg:generic/nginx-ingress-controller@1.7.1",
Locations: locations("nginx-ingress-controller"),
Metadata: metadata("ingress-nginx-binary"),
},
},
{
logicalFixture: "nginx-ingress-controller/1.12.0-beta.0/linux-amd64",
expected: pkg.Package{
Name: "nginx-ingress-controller",
Version: "1.12.0-beta.0",
Type: "binary",
PURL: "pkg:generic/nginx-ingress-controller@1.12.0-beta.0",
Locations: locations("nginx-ingress-controller"),
Metadata: metadata("ingress-nginx-binary"),
},
},
{
logicalFixture: "nginx-ingress-controller/1.2.0-beta.1/linux-amd64",
expected: pkg.Package{
Name: "nginx-ingress-controller",
Version: "1.2.0-beta.1",
Type: "binary",
PURL: "pkg:generic/nginx-ingress-controller@1.2.0-beta.1",
Locations: locations("nginx-ingress-controller"),
Metadata: metadata("ingress-nginx-binary"),
},
},
{
logicalFixture: "nginx-ingress-controller/1.0.0-alpha.2/linux-amd64",
expected: pkg.Package{
Name: "nginx-ingress-controller",
Version: "1.0.0-alpha.2",
Type: "binary",
PURL: "pkg:generic/nginx-ingress-controller@1.0.0-alpha.2",
Locations: locations("nginx-ingress-controller"),
Metadata: metadata("ingress-nginx-binary"),
},
},
{
logicalFixture: "nginx-ingress-controller/0.34.0/linux-amd64",
expected: pkg.Package{
Name: "nginx-ingress-controller",
Version: "0.34.0",
Type: "binary",
PURL: "pkg:generic/nginx-ingress-controller@0.34.0",
Locations: locations("nginx-ingress-controller"),
Metadata: metadata("ingress-nginx-binary"),
},
},
{
logicalFixture: "nginx-ingress-controller/0.33.0/linux-amd64",
expected: pkg.Package{
Name: "nginx-ingress-controller",
Version: "0.33.0",
Type: "binary",
PURL: "pkg:generic/nginx-ingress-controller@0.33.0",
Locations: locations("nginx-ingress-controller"),
Metadata: metadata("ingress-nginx-binary"),
},
},
}
for _, test := range tests {

View File

@ -911,6 +911,29 @@ func DefaultClassifiers() []binutils.Classifier {
PURL: mustPURL("pkg:generic/mongodb@version"),
CPEs: singleCPE("cpe:2.3:a:mongodb:mongodb:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource),
},
{
Class: "ingress-nginx-binary",
FileGlob: "**/nginx-ingress-controller",
EvidenceMatcher: binutils.MatchAny(
// [NUL][NUL]v1.15.1[NUL][NUL]@e[ETX][NUL][NUL][NUL][NUL]go1.26.1[NUL][NUL][NUL]
// <20>v1.15.1[NUL][NUL]<5D>z[ETX][NUL][NUL][NUL][NUL]go1.24.4[NUL][NUL][NUL]
m.FileContentsVersionMatcher(`v(?P<version>[0-9]+\.[0-9]+\.[0-9]+)\x00+.{0,50}go[0-9]+\.[0-9]+(\-(alpha|beta)\.[0-9])?\.[0-9]+\x00+`),
// <20>Lv1.9.6[NUL][NUL]$a<>c[SOH][NUL][NUL][NUL]
// [NUL][NUL]v0.34.0[NUL]......<2E>$a<>...[NUL]
m.FileContentsVersionMatcher(`v(?P<version>[0-9]+\.[0-9]+\.[0-9]+(\-(alpha|beta)\.[0-9])?)\x00+.{0,800}\$a.{0,10}\x00+`),
// [NUL][NUL]v1.7.1[NUL][NUL][NUL]...S=v<y5...
// [NUL]0.33.0[NUL][NUL]...[NUL][NUL]...S=v<y5
m.FileContentsVersionMatcher(`\x00+v?(?P<version>[0-9]+\.[0-9]+\.[0-9]+(\-(alpha|beta)\.[0-9])?)\x00+.{0,100}S=v<y5`),
// [NUL][NUL]go1.22.8[NUL][NUL][NUL][NUL][NUL][NUL][NUL][NUL][NUL]v1.12.0-beta.0[NUL][NUL]
m.FileContentsVersionMatcher(`\x00+go[0-9]+\.[0-9]+\.[0-9]+\x00+v(?P<version>[0-9]+\.[0-9]+\.[0-9]+(\-(alpha|beta)\.[0-9])?)\x00+`),
// [NUL][NUL]v1.2.0-beta.1[NUL][NUL]
// [NUL][NUL]v1.0.0-alpha.2[NUL][NUL]
m.FileContentsVersionMatcher(`\x00+v(?P<version>[0-9]+\.[0-9]+\.[0-9]+\-(alpha|beta)\.[0-9])\x00+`),
),
Package: "nginx-ingress-controller",
PURL: mustPURL("pkg:generic/nginx-ingress-controller@version"),
CPEs: singleCPE("cpe:2.3:a:kubernetes:ingress-nginx:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource),
},
}
return append(classifiers, defaultJavaClassifiers()...)

View File

@ -1381,3 +1381,74 @@ from-images:
platform: linux/amd64
paths:
- /usr/local/bin/envoy
- version: 1.15.1
images:
- ref: registry.k8s.io/ingress-nginx/controller:v1.15.1@sha256:594ceea76b01c592858f803f9ff4d2cb40542cae2060410b2c95f75907d659e1
platform: linux/amd64
paths:
- /nginx-ingress-controller
- version: 1.11.8
images:
- ref: registry.k8s.io/ingress-nginx/controller:v1.11.8@sha256:695d79381ee6af00c7f5c9fd434f50851d7d32838ad5b2c507e416cf2084fc79
platform: linux/amd64
paths:
- /nginx-ingress-controller
- version: 1.9.6
images:
- ref: registry.k8s.io/ingress-nginx/controller:v1.9.6@sha256:1405cc613bd95b2c6edd8b2a152510ae91c7e62aea4698500d23b2145960ab9c
platform: linux/amd64
paths:
- /nginx-ingress-controller
- version: 1.8.4
images:
- ref: registry.k8s.io/ingress-nginx/controller:v1.8.4@sha256:8d8ddf32b83ca3e74bd5f66369fa60d85353e18ff55fa7691b321aa4716f5ba9
platform: linux/amd64
paths:
- /nginx-ingress-controller
- version: 1.7.1
images:
- ref: registry.k8s.io/ingress-nginx/controller:v1.7.1@sha256:7244b95ea47bddcb8267c1e625fb163fc183ef55448855e3ac52a7b260a60407
platform: linux/amd64
paths:
- /nginx-ingress-controller
- version: 1.12.0-beta.0
images:
- ref: registry.k8s.io/ingress-nginx/controller:v1.12.0-beta.0@sha256:9724476b928967173d501040631b23ba07f47073999e80e34b120e8db5f234d5
platform: linux/amd64
paths:
- /nginx-ingress-controller
- version: 1.2.0-beta.1
images:
- ref: k8s.gcr.io/ingress-nginx/controller:v1.2.0-beta.1@sha256:7059739637c30865f74cae403fffa55c2cb6d9779cd15654480dd0e4f850d536
platform: linux/amd64
paths:
- /nginx-ingress-controller
- version: 1.0.0-alpha.2
images:
- ref: k8s.gcr.io/ingress-nginx/controller:v1.0.0-alpha.2@sha256:04a0ad3a1279c2a58898e789eed767eafa138ee1e5b9b23a988c6e8485cf958d
platform: linux/amd64
paths:
- /nginx-ingress-controller
- version: 0.34.0
images:
- ref: k8s.gcr.io/ingress-nginx/controller:v0.34.0@sha256:5e0dcdc3ddb076f9ad988c624b8c459b53235ace26b9b18c192dedd3a038173c
platform: linux/amd64
paths:
- /nginx-ingress-controller
- version: 0.33.0
images:
- ref: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.33.0@sha256:ad8a1e9e44b4deb6ded8d677e9f0014178294e579d0710a48bca1e05838f2473
platform: linux/amd64
paths:
- /nginx-ingress-controller