diff --git a/syft/pkg/cataloger/binary/capabilities.yaml b/syft/pkg/cataloger/binary/capabilities.yaml index e4c7d6534..0adf563ea 100644 --- a/syft/pkg/cataloger/binary/capabilities.yaml +++ b/syft/pkg/cataloger/binary/capabilities.yaml @@ -603,6 +603,26 @@ catalogers: cpes: - cpe:2.3:a:elixir-lang:elixir:*:*:*:*:*:*:*:* type: BinaryPkg + - method: glob + criteria: + - '**/pilot-discovery' + packages: + - class: istio-binary + name: pilot-discovery + purl: pkg:generic/istio + cpes: + - cpe:2.3:a:istio:istio:*:*:*:*:*:*:*:* + type: BinaryPkg + - method: glob + criteria: + - '**/pilot-agent' + packages: + - class: istio-binary + name: pilot-agent + purl: pkg:generic/istio + cpes: + - cpe:2.3:a:istio:istio:*:*:*:*:*:*:*:* + type: BinaryPkg - method: glob criteria: - '**/grafana' diff --git a/syft/pkg/cataloger/binary/classifier_cataloger_test.go b/syft/pkg/cataloger/binary/classifier_cataloger_test.go index 4d21c5b9c..80e962502 100644 --- a/syft/pkg/cataloger/binary/classifier_cataloger_test.go +++ b/syft/pkg/cataloger/binary/classifier_cataloger_test.go @@ -1441,6 +1441,83 @@ func Test_Cataloger_PositiveCases(t *testing.T) { }, }, }, + { + logicalFixture: "istio_pilot-discovery/1.26.8/linux-amd64", + expected: pkg.Package{ + Name: "pilot-discovery", + Version: "1.26.8", + Type: "binary", + PURL: "pkg:generic/istio@1.26.8", + Locations: locations("pilot-discovery"), + Metadata: metadata("istio-binary"), + }, + }, + { + logicalFixture: "istio_pilot-discovery/1.8.0/linux-amd64", + expected: pkg.Package{ + Name: "pilot-discovery", + Version: "1.8.0", + Type: "binary", + PURL: "pkg:generic/istio@1.8.0", + Locations: locations("pilot-discovery"), + Metadata: metadata("istio-binary"), + }, + }, + { + logicalFixture: "istio_pilot-discovery/1.3.8/linux-amd64", + expected: pkg.Package{ + Name: "pilot-discovery", + Version: "1.3.8", + Type: "binary", + PURL: "pkg:generic/istio@1.3.8", + Locations: locations("pilot-discovery"), + Metadata: metadata("istio-binary"), + }, + }, + { + logicalFixture: "istio_pilot-discovery/1.1.17/linux-amd64", + expected: pkg.Package{ + Name: "pilot-discovery", + Version: "1.1.17", + Type: "binary", + PURL: "pkg:generic/istio@1.1.17", + Locations: locations("pilot-discovery"), + Metadata: metadata("istio-binary"), + }, + }, + { + logicalFixture: "istio_pilot-agent/1.26.8/linux-amd64", + expected: pkg.Package{ + Name: "pilot-agent", + Version: "1.26.8", + Type: "binary", + PURL: "pkg:generic/istio@1.26.8", + Locations: locations("pilot-agent"), + Metadata: metadata("istio-binary"), + }, + }, + { + logicalFixture: "istio_pilot-agent/1.8.0/linux-amd64", + expected: pkg.Package{ + Name: "pilot-agent", + Version: "1.8.0", + Type: "binary", + PURL: "pkg:generic/istio@1.8.0", + Locations: locations("pilot-agent"), + Metadata: metadata("istio-binary"), + }, + }, + { + logicalFixture: "istio_pilot-agent/1.1.17/linux-amd64", + expected: pkg.Package{ + Name: "pilot-agent", + Version: "1.1.17", + Type: "binary", + PURL: "pkg:generic/istio@1.1.17", + Locations: locations("pilot-agent"), + Metadata: metadata("istio-binary"), + }, + }, { logicalFixture: "grafana/12.3.1/linux-amd64", expected: pkg.Package{ diff --git a/syft/pkg/cataloger/binary/classifiers.go b/syft/pkg/cataloger/binary/classifiers.go index 025f546f1..8420faf64 100644 --- a/syft/pkg/cataloger/binary/classifiers.go +++ b/syft/pkg/cataloger/binary/classifiers.go @@ -697,6 +697,37 @@ func DefaultClassifiers() []binutils.Classifier { PURL: mustPURL("pkg:generic/elixir@version"), CPEs: singleCPE("cpe:2.3:a:elixir-lang:elixir:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource), }, + { + Class: "istio-binary", + FileGlob: "**/pilot-discovery", + EvidenceMatcher: binutils.MatchAny( + // [NUL]1.26.8[NUL][NUL]1.26.8[NUL] + // [NUL]1.3.7[NUL][NUL][NUL]1.3.8[NUL] + m.FileContentsVersionMatcher(`[0-9]+\.[0-9]+\.[0-9]+\x00+(?P[0-9]+\.[0-9]+\.[0-9]+)\x00+`), + // Clean[NUL][NUL][NUL]1.8.0[NUL] + m.FileContentsVersionMatcher(`Clean\x00+(?P[0-9]+\.[0-9]+\.[0-9]+)\x00+`), + // 1.1.17[NUL]...S=v[0-9]+\.[0-9]+\.[0-9]+)\x00+.{1,100}S?=v[0-9]+\.[0-9]+\.[0-9]+)\x00+`), + // Clean[NUL][NUL][NUL]1.8.0[NUL] + m.FileContentsVersionMatcher(`Clean\x00+(?P[0-9]+\.[0-9]+\.[0-9]+)\x00+`), + // 1.1.17[NUL]...S=v[0-9]+\.[0-9]+\.[0-9]+)\x00+.{1,100}S?=v