fix: more istio classifier matching (#4645)

Signed-off-by: witchcraze <witchcraze@gmail.com>
This commit is contained in:
witchcraze 2026-04-12 23:54:08 +09:00 committed by GitHub
parent cc3b8eb48f
commit e420322494
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 162 additions and 6 deletions

View File

@ -1589,6 +1589,39 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
}, },
}, },
}, },
{
logicalFixture: "istio_pilot-discovery/1.29.0-alpha.0/linux-amd64",
expected: pkg.Package{
Name: "pilot-discovery",
Version: "1.29.0-alpha.0",
Type: "binary",
PURL: "pkg:generic/istio@1.29.0-alpha.0",
Locations: locations("pilot-discovery"),
Metadata: metadata("istio-binary"),
},
},
{
logicalFixture: "istio_pilot-discovery/1.29.0-beta.0/linux-amd64",
expected: pkg.Package{
Name: "pilot-discovery",
Version: "1.29.0-beta.0",
Type: "binary",
PURL: "pkg:generic/istio@1.29.0-beta.0",
Locations: locations("pilot-discovery"),
Metadata: metadata("istio-binary"),
},
},
{
logicalFixture: "istio_pilot-discovery/1.29.0-rc.3/linux-amd64",
expected: pkg.Package{
Name: "pilot-discovery",
Version: "1.29.0-rc.3",
Type: "binary",
PURL: "pkg:generic/istio@1.29.0-rc.3",
Locations: locations("pilot-discovery"),
Metadata: metadata("istio-binary"),
},
},
{ {
logicalFixture: "istio_pilot-discovery/1.26.8/linux-amd64", logicalFixture: "istio_pilot-discovery/1.26.8/linux-amd64",
expected: pkg.Package{ expected: pkg.Package{
@ -1600,6 +1633,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("istio-binary"), Metadata: metadata("istio-binary"),
}, },
}, },
{
logicalFixture: "istio_pilot-discovery/1.10-dev/linux-amd64",
expected: pkg.Package{
Name: "pilot-discovery",
Version: "1.10-dev",
Type: "binary",
PURL: "pkg:generic/istio@1.10-dev",
Locations: locations("pilot-discovery"),
Metadata: metadata("istio-binary"),
},
},
{ {
logicalFixture: "istio_pilot-discovery/1.8.0/linux-amd64", logicalFixture: "istio_pilot-discovery/1.8.0/linux-amd64",
expected: pkg.Package{ expected: pkg.Package{
@ -1633,6 +1677,39 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("istio-binary"), Metadata: metadata("istio-binary"),
}, },
}, },
{
logicalFixture: "istio_pilot-agent/1.29.0-alpha.0/linux-amd64",
expected: pkg.Package{
Name: "pilot-agent",
Version: "1.29.0-alpha.0",
Type: "binary",
PURL: "pkg:generic/istio@1.29.0-alpha.0",
Locations: locations("pilot-agent"),
Metadata: metadata("istio-binary"),
},
},
{
logicalFixture: "istio_pilot-agent/1.29.0-beta.0/linux-amd64",
expected: pkg.Package{
Name: "pilot-agent",
Version: "1.29.0-beta.0",
Type: "binary",
PURL: "pkg:generic/istio@1.29.0-beta.0",
Locations: locations("pilot-agent"),
Metadata: metadata("istio-binary"),
},
},
{
logicalFixture: "istio_pilot-agent/1.29.0-rc.3/linux-amd64",
expected: pkg.Package{
Name: "pilot-agent",
Version: "1.29.0-rc.3",
Type: "binary",
PURL: "pkg:generic/istio@1.29.0-rc.3",
Locations: locations("pilot-agent"),
Metadata: metadata("istio-binary"),
},
},
{ {
logicalFixture: "istio_pilot-agent/1.26.8/linux-amd64", logicalFixture: "istio_pilot-agent/1.26.8/linux-amd64",
expected: pkg.Package{ expected: pkg.Package{
@ -1644,6 +1721,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("istio-binary"), Metadata: metadata("istio-binary"),
}, },
}, },
{
logicalFixture: "istio_pilot-agent/1.10-dev/linux-amd64",
expected: pkg.Package{
Name: "pilot-agent",
Version: "1.10-dev",
Type: "binary",
PURL: "pkg:generic/istio@1.10-dev",
Locations: locations("pilot-agent"),
Metadata: metadata("istio-binary"),
},
},
{ {
logicalFixture: "istio_pilot-agent/1.8.0/linux-amd64", logicalFixture: "istio_pilot-agent/1.8.0/linux-amd64",
expected: pkg.Package{ expected: pkg.Package{

View File

@ -718,11 +718,13 @@ func DefaultClassifiers() []binutils.Classifier {
EvidenceMatcher: binutils.MatchAny( EvidenceMatcher: binutils.MatchAny(
// [NUL]1.26.8[NUL][NUL]1.26.8[NUL] // [NUL]1.26.8[NUL][NUL]1.26.8[NUL]
// [NUL]1.3.7[NUL][NUL][NUL]1.3.8[NUL] // [NUL]1.3.7[NUL][NUL][NUL]1.3.8[NUL]
m.FileContentsVersionMatcher(`[0-9]+\.[0-9]+\.[0-9]+\x00+(?P<version>[0-9]+\.[0-9]+\.[0-9]+)\x00+`), m.FileContentsVersionMatcher(`[0-9]+\.[0-9]+\.[0-9]+\x00+(?P<version>[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-dev)?)\x00+`),
// Clean[NUL][NUL][NUL]1.8.0[NUL] // Clean[NUL][NUL][NUL]1.8.0[NUL]
m.FileContentsVersionMatcher(`Clean\x00+(?P<version>[0-9]+\.[0-9]+\.[0-9]+)\x00+`), m.FileContentsVersionMatcher(`Clean\x00+(?P<version>[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-dev)?)\x00+`),
// Modified[NUL][NUL][NUL][NUL][NUL][NUL][NUL][NUL]1.10-dev[NUL][NUL][NUL]
m.FileContentsVersionMatcher(`Modified\x00+(?P<version>[0-9]+\.[0-9]+-dev)\x00+`),
// 1.1.17[NUL]...S=v<y5 // 1.1.17[NUL]...S=v<y5
m.FileContentsVersionMatcher(`(?s)(?P<version>[0-9]+\.[0-9]+\.[0-9]+)\x00+.{1,100}S?=v<y5`), m.FileContentsVersionMatcher(`(?s)(?P<version>[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-dev)?)\x00+.{1,100}S?=v<y5`),
), ),
Package: "pilot-discovery", Package: "pilot-discovery",
PURL: mustPURL("pkg:generic/istio@version"), PURL: mustPURL("pkg:generic/istio@version"),
@ -733,11 +735,13 @@ func DefaultClassifiers() []binutils.Classifier {
FileGlob: "**/pilot-agent", FileGlob: "**/pilot-agent",
EvidenceMatcher: binutils.MatchAny( EvidenceMatcher: binutils.MatchAny(
// [NUL]1.26.8[NUL][NUL]1.26.8[NUL] // [NUL]1.26.8[NUL][NUL]1.26.8[NUL]
m.FileContentsVersionMatcher(`[0-9]+\.[0-9]+\.[0-9]+\x00+(?P<version>[0-9]+\.[0-9]+\.[0-9]+)\x00+`), m.FileContentsVersionMatcher(`[0-9]+\.[0-9]+\.[0-9]+\x00+(?P<version>[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-dev)?)\x00+`),
// Clean[NUL][NUL][NUL]1.8.0[NUL] // Clean[NUL][NUL][NUL]1.8.0[NUL]
m.FileContentsVersionMatcher(`Clean\x00+(?P<version>[0-9]+\.[0-9]+\.[0-9]+)\x00+`), m.FileContentsVersionMatcher(`Clean\x00+(?P<version>[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-dev)?)\x00+`),
// Modified[NUL][NUL][NUL][NUL][NUL][NUL][NUL][NUL]1.10-dev[NUL][NUL][NUL]
m.FileContentsVersionMatcher(`Modified\x00+(?P<version>[0-9]+\.[0-9]+-dev)\x00+`),
// 1.1.17[NUL]...S=v<y5 // 1.1.17[NUL]...S=v<y5
m.FileContentsVersionMatcher(`(?s)(?P<version>[0-9]+\.[0-9]+\.[0-9]+)\x00+.{1,100}S?=v<y5`), m.FileContentsVersionMatcher(`(?s)(?P<version>[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-dev)?)\x00+.{1,100}S?=v<y5`),
), ),
Package: "pilot-agent", Package: "pilot-agent",
PURL: mustPURL("pkg:generic/istio@version"), PURL: mustPURL("pkg:generic/istio@version"),

View File

@ -907,6 +907,30 @@ from-images:
paths: paths:
- /usr/local/lib/python3.11/site-packages/opencv_contrib_python.libs/libavcodec-9aae324f.so.59.37.100 - /usr/local/lib/python3.11/site-packages/opencv_contrib_python.libs/libavcodec-9aae324f.so.59.37.100
- name: istio_pilot-discovery
version: 1.29.0-alpha.0
images:
- ref: istio/pilot:1.29.0-alpha.0@sha256:9ef461d06e22cdfd874043b42292406a3988b50d4ee83ebcd028da85f02f4cf4
platform: linux/amd64
paths:
- /usr/local/bin/pilot-discovery
- name: istio_pilot-discovery
version: 1.29.0-beta.0
images:
- ref: istio/pilot:1.29.0-beta.0@sha256:d8d347ef47eebff948542243c23c1682c55c20ff0c122a30db5bcfbd8f7b36dd
platform: linux/amd64
paths:
- /usr/local/bin/pilot-discovery
- name: istio_pilot-discovery
version: 1.29.0-rc.3
images:
- ref: istio/pilot:1.29.0-rc.3@sha256:b5f60ecfe3fb34239169b46e01d2b1126f79b3f6da65734bdd3c63cf62042ad2
platform: linux/amd64
paths:
- /usr/local/bin/pilot-discovery
- name: istio_pilot-discovery - name: istio_pilot-discovery
version: 1.26.8 version: 1.26.8
images: images:
@ -915,6 +939,14 @@ from-images:
paths: paths:
- /usr/local/bin/pilot-discovery - /usr/local/bin/pilot-discovery
- name: istio_pilot-discovery
version: 1.10-dev
images:
- ref: istio/pilot:377977f494e3a37d4c77818a77fe677a4e3eb1a5@sha256:c4466fe97d981d31e84a367f1a1df1f7f976b45b96a73483ba04725414aa96e9
platform: linux/amd64
paths:
- /usr/local/bin/pilot-discovery
- name: istio_pilot-discovery - name: istio_pilot-discovery
version: 1.8.0 version: 1.8.0
images: images:
@ -939,6 +971,30 @@ from-images:
paths: paths:
- /usr/local/bin/pilot-discovery - /usr/local/bin/pilot-discovery
- name: istio_pilot-agent
version: 1.29.0-alpha.0
images:
- ref: istio/proxyv2:1.29.0-alpha.0@sha256:ed845d471e9e85d60ae26f14f166bb09eaef01ed0fede850e688ca18fa304873
platform: linux/amd64
paths:
- /usr/local/bin/pilot-agent
- name: istio_pilot-agent
version: 1.29.0-beta.0
images:
- ref: istio/proxyv2:1.29.0-beta.0@sha256:a5b9427e7de50149911ce0181c058ee2476999482bd02de5cab52d8456bc6b4d
platform: linux/amd64
paths:
- /usr/local/bin/pilot-agent
- name: istio_pilot-agent
version: 1.29.0-rc.3
images:
- ref: istio/proxyv2:1.29.0-rc.3@sha256:c91bfb91cd4da0c6877b7e675c7b190eca9747bd4e3e1b4f9b3ba3a4246df744
platform: linux/amd64
paths:
- /usr/local/bin/pilot-agent
- name: istio_pilot-agent - name: istio_pilot-agent
version: 1.26.8 version: 1.26.8
images: images:
@ -947,6 +1003,14 @@ from-images:
paths: paths:
- /usr/local/bin/pilot-agent - /usr/local/bin/pilot-agent
- name: istio_pilot-agent
version: 1.10-dev
images:
- ref: istio/proxyv2:377977f494e3a37d4c77818a77fe677a4e3eb1a5@sha256:336fd56493fb69a260483adc6a77d773e8c2cba42ac116bfd52d56c16d91f92b
platform: linux/amd64
paths:
- /usr/local/bin/pilot-agent
- name: istio_pilot-agent - name: istio_pilot-agent
version: 1.8.0 version: 1.8.0
images: images: