diff --git a/syft/pkg/cataloger/binary/classifier_cataloger_test.go b/syft/pkg/cataloger/binary/classifier_cataloger_test.go index 20a4711b7..a45bcbb0b 100644 --- a/syft/pkg/cataloger/binary/classifier_cataloger_test.go +++ b/syft/pkg/cataloger/binary/classifier_cataloger_test.go @@ -2178,6 +2178,28 @@ func Test_Cataloger_PositiveCases(t *testing.T) { Metadata: metadata("istio-binary"), }, }, + { + logicalFixture: "istio_pilot-discovery/1.19.0-rc.0/linux-amd64", + expected: pkg.Package{ + Name: "pilot-discovery", + Version: "1.19.0-rc.0", + Type: "binary", + PURL: "pkg:generic/istio@1.19.0-rc.0", + Locations: locations("pilot-discovery"), + Metadata: metadata("istio-binary"), + }, + }, + { + logicalFixture: "istio_pilot-discovery/1.15.0-beta.0/linux-amd64", + expected: pkg.Package{ + Name: "pilot-discovery", + Version: "1.15.0-beta.0", + Type: "binary", + PURL: "pkg:generic/istio@1.15.0-beta.0", + Locations: locations("pilot-discovery"), + Metadata: metadata("istio-binary"), + }, + }, { logicalFixture: "istio_pilot-discovery/1.10-dev/linux-amd64", expected: pkg.Package{ @@ -2200,6 +2222,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) { Metadata: metadata("istio-binary"), }, }, + { + logicalFixture: "istio_pilot-discovery/1.5.0-alpha.0/linux-amd64", + expected: pkg.Package{ + Name: "pilot-discovery", + Version: "1.5.0-alpha.0", + Type: "binary", + PURL: "pkg:generic/istio@1.5.0-alpha.0", + Locations: locations("pilot-discovery"), + Metadata: metadata("istio-binary"), + }, + }, { logicalFixture: "istio_pilot-discovery/1.3.8/linux-amd64", expected: pkg.Package{ @@ -2222,6 +2255,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) { Metadata: metadata("istio-binary"), }, }, + { + logicalFixture: "istio_pilot-discovery/1.0.0-snapshot.0/linux-amd64", + expected: pkg.Package{ + Name: "pilot-discovery", + Version: "1.0.0-snapshot.0", + Type: "binary", + PURL: "pkg:generic/istio@1.0.0-snapshot.0", + Locations: locations("pilot-discovery"), + Metadata: metadata("istio-binary"), + }, + }, { logicalFixture: "istio_pilot-agent/1.29.0-alpha.0/linux-amd64", expected: pkg.Package{ @@ -2266,6 +2310,28 @@ func Test_Cataloger_PositiveCases(t *testing.T) { Metadata: metadata("istio-binary"), }, }, + { + logicalFixture: "istio_pilot-agent/1.19.0-rc.0/linux-amd64", + expected: pkg.Package{ + Name: "pilot-agent", + Version: "1.19.0-rc.0", + Type: "binary", + PURL: "pkg:generic/istio@1.19.0-rc.0", + Locations: locations("pilot-agent"), + Metadata: metadata("istio-binary"), + }, + }, + { + logicalFixture: "istio_pilot-agent/1.15.0-beta.0/linux-amd64", + expected: pkg.Package{ + Name: "pilot-agent", + Version: "1.15.0-beta.0", + Type: "binary", + PURL: "pkg:generic/istio@1.15.0-beta.0", + Locations: locations("pilot-agent"), + Metadata: metadata("istio-binary"), + }, + }, { logicalFixture: "istio_pilot-agent/1.10-dev/linux-amd64", expected: pkg.Package{ @@ -2288,6 +2354,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) { Metadata: metadata("istio-binary"), }, }, + { + logicalFixture: "istio_pilot-agent/1.5.0-alpha.0/linux-amd64", + expected: pkg.Package{ + Name: "pilot-agent", + Version: "1.5.0-alpha.0", + Type: "binary", + PURL: "pkg:generic/istio@1.5.0-alpha.0", + Locations: locations("pilot-agent"), + Metadata: metadata("istio-binary"), + }, + }, { logicalFixture: "istio_pilot-agent/1.1.17/linux-amd64", expected: pkg.Package{ @@ -2299,6 +2376,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) { Metadata: metadata("istio-binary"), }, }, + { + logicalFixture: "istio_pilot-agent/1.0.0-snapshot.0/linux-amd64", + expected: pkg.Package{ + Name: "pilot-agent", + Version: "1.0.0-snapshot.0", + Type: "binary", + PURL: "pkg:generic/istio@1.0.0-snapshot.0", + Locations: locations("pilot-agent"), + Metadata: metadata("istio-binary"), + }, + }, { logicalFixture: "grafana/12.4.0-22081664032/linux-amd64", expected: pkg.Package{ diff --git a/syft/pkg/cataloger/binary/classifiers.go b/syft/pkg/cataloger/binary/classifiers.go index a23f9d1f4..2f9037a94 100644 --- a/syft/pkg/cataloger/binary/classifiers.go +++ b/syft/pkg/cataloger/binary/classifiers.go @@ -1042,13 +1042,16 @@ func DefaultClassifiers() []binutils.Classifier { 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]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-dev)?)\x00+`), + // [NUL]1.15.0-beta.0[NUL][NUL][NUL]1.15.0-beta.0[NUL] (pre-release builds repeat the full version, suffix included) + m.FileContentsVersionMatcher(`[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-snapshot\.[0-9]+|-dev)?\x00+(?P[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-snapshot\.[0-9]+|-dev)?)\x00+`), + // [NUL][NUL][NUL]1.0.0-snapshot.0[NUL][NUL][NUL] (snapshot builds record the version only once) + m.FileContentsVersionMatcher(`\x00+(?P[0-9]+\.[0-9]+\.[0-9]+-snapshot\.[0-9]+)\x00+`), // Clean[NUL][NUL][NUL]1.8.0[NUL] - m.FileContentsVersionMatcher(`Clean\x00+(?P[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-dev)?)\x00+`), + m.FileContentsVersionMatcher(`Clean\x00+(?P[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-snapshot\.[0-9]+|-dev)?)\x00+`), // Modified[NUL][NUL][NUL][NUL][NUL][NUL][NUL][NUL]1.10-dev[NUL][NUL][NUL] m.FileContentsVersionMatcher(`Modified\x00+(?P[0-9]+\.[0-9]+-dev)\x00+`), // 1.1.17[NUL]...S=v[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-dev)?)\x00+.{1,100}S?=v[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-snapshot\.[0-9]+|-dev)?)\x00+.{1,100}S?=v[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-dev)?)\x00+`), + // [NUL]1.15.0-beta.0[NUL][NUL][NUL]1.15.0-beta.0[NUL] (pre-release builds repeat the full version, suffix included) + m.FileContentsVersionMatcher(`[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-snapshot\.[0-9]+|-dev)?\x00+(?P[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-snapshot\.[0-9]+|-dev)?)\x00+`), + // [NUL][NUL][NUL]1.0.0-snapshot.0[NUL][NUL][NUL] (snapshot builds record the version only once) + m.FileContentsVersionMatcher(`\x00+(?P[0-9]+\.[0-9]+\.[0-9]+-snapshot\.[0-9]+)\x00+`), // Clean[NUL][NUL][NUL]1.8.0[NUL] - m.FileContentsVersionMatcher(`Clean\x00+(?P[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-dev)?)\x00+`), + m.FileContentsVersionMatcher(`Clean\x00+(?P[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-snapshot\.[0-9]+|-dev)?)\x00+`), // Modified[NUL][NUL][NUL][NUL][NUL][NUL][NUL][NUL]1.10-dev[NUL][NUL][NUL] m.FileContentsVersionMatcher(`Modified\x00+(?P[0-9]+\.[0-9]+-dev)\x00+`), // 1.1.17[NUL]...S=v[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-dev)?)\x00+.{1,100}S?=v[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-snapshot\.[0-9]+|-dev)?)\x00+.{1,100}S?=v