diff --git a/syft/pkg/cataloger/binary/classifier_cataloger_test.go b/syft/pkg/cataloger/binary/classifier_cataloger_test.go index 4cbd2f6f393..ac5d0555553 100644 --- a/syft/pkg/cataloger/binary/classifier_cataloger_test.go +++ b/syft/pkg/cataloger/binary/classifier_cataloger_test.go @@ -2151,6 +2151,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{ @@ -2173,6 +2195,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{ @@ -2195,6 +2228,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{ @@ -2239,6 +2283,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{ @@ -2261,6 +2327,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{ @@ -2272,6 +2349,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 afd4c7536cb..7733869629e 100644 --- a/syft/pkg/cataloger/binary/classifiers.go +++ b/syft/pkg/cataloger/binary/classifiers.go @@ -1014,13 +1014,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