diff --git a/syft/pkg/cataloger/binary/capabilities.yaml b/syft/pkg/cataloger/binary/capabilities.yaml index a0ed0c35d..e4c7d6534 100644 --- a/syft/pkg/cataloger/binary/capabilities.yaml +++ b/syft/pkg/cataloger/binary/capabilities.yaml @@ -623,6 +623,16 @@ catalogers: cpes: - cpe:2.3:a:grafana:grafana:*:*:*:*:*:*:*:* type: BinaryPkg + - method: glob + criteria: + - '**/envoy' + packages: + - class: envoy-binary + name: envoy + purl: pkg:generic/envoy + cpes: + - cpe:2.3:a:envoyproxy:envoy:*:*:*:*:*:*:*:* + type: BinaryPkg - method: glob criteria: - '**/java' diff --git a/syft/pkg/cataloger/binary/classifier_cataloger_test.go b/syft/pkg/cataloger/binary/classifier_cataloger_test.go index 4f839da2d..4d21c5b9c 100644 --- a/syft/pkg/cataloger/binary/classifier_cataloger_test.go +++ b/syft/pkg/cataloger/binary/classifier_cataloger_test.go @@ -1529,6 +1529,105 @@ func Test_Cataloger_PositiveCases(t *testing.T) { Metadata: metadata("grafana-binary"), }, }, + { + logicalFixture: "envoy/1.36.4/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.36.4", + Type: "binary", + PURL: "pkg:generic/envoy@1.36.4", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.34.5/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.34.5", + Type: "binary", + PURL: "pkg:generic/envoy@1.34.5", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.28.7/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.28.7", + Type: "binary", + PURL: "pkg:generic/envoy@1.28.7", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.22.11/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.22.11", + Type: "binary", + PURL: "pkg:generic/envoy@1.22.11", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.20.7/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.20.7", + Type: "binary", + PURL: "pkg:generic/envoy@1.20.7", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.18.6/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.18.6-dev", + Type: "binary", + PURL: "pkg:generic/envoy@1.18.6-dev", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.14.3/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.14.3", + Type: "binary", + PURL: "pkg:generic/envoy@1.14.3", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.11.0/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.11.0", + Type: "binary", + PURL: "pkg:generic/envoy@1.11.0", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.6.0/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.6.0", + Type: "binary", + PURL: "pkg:generic/envoy@1.6.0", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, } for _, test := range tests { diff --git a/syft/pkg/cataloger/binary/classifiers.go b/syft/pkg/cataloger/binary/classifiers.go index 99a8aafc1..025f546f1 100644 --- a/syft/pkg/cataloger/binary/classifiers.go +++ b/syft/pkg/cataloger/binary/classifiers.go @@ -727,6 +727,32 @@ func DefaultClassifiers() []binutils.Classifier { PURL: mustPURL("pkg:generic/grafana@version"), CPEs: singleCPE("cpe:2.3:a:grafana:grafana:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource), }, + { + Class: "envoy-binary", + FileGlob: "**/envoy", + EvidenceMatcher: binutils.MatchAny( + // 1.3x [NUL]1.36.4[NUL]...envoy_reloadable_features + // 1.34.5 [NUL]1.34.5[NUL]...envoy.reloadable_features + m.FileContentsVersionMatcher(`(?s)\x00(?P1\.3[0-9]\.[0-9]+(-dev)?)\x00.{0,1000}envoy_reloadable_features`), + m.FileContentsVersionMatcher(`(?s)\x00(?P1\.34\.5)\x00.{0,200}envoy\.reloadable_features`), + // 1.2x envoy_quic_...[NUL]1.28.7[NUL] + m.FileContentsVersionMatcher(`(?s)envoy_quic_.{0,1000}\x00(?P1\.2[0-9]\.[0-9]+(-dev)?)\x00`), + // 1.2x [NUL]1.20.7[NUL]Unable to + // 1.1x [NUL]1.18.6-dev[NUL]Unable to + m.FileContentsVersionMatcher(`(?s)\x00(?P1\.[12][0-9]\.[0-9]+(-dev)?)\x00.{0,1000}Unable to`), + // 1.2x [NUL]1.22.11[NUL]...ValidationError + // 1.1x [NUL]1.14.3[NUL]...ValidationError + m.FileContentsVersionMatcher(`(?s)\x00(?P1\.2[0-9]\.[0-9]+(-dev)?)\x00.{0,580}ValidationError`), + m.FileContentsVersionMatcher(`(?s)\x00(?P1\.1[0-9]\.[0-9]+(-dev)?)\x00.{0,1000}ValidationError`), + // 1.1x [source...[NUL]1.11.0[NUL]/ + m.FileContentsVersionMatcher(`(?s)\[source/.{0,200}\x00(?P1\.1[0-9]\.[0-9]+(-dev)?)\x00`), + // 1.x [NUL]1.6.0[NUL]RELEASE + m.FileContentsVersionMatcher(`(?s)\x00(?P1\.[0-9]\.[0-9]+(-dev)?)\x00.{0,20}RELEASE`), + ), + Package: "envoy", + PURL: mustPURL("pkg:generic/envoy@version"), + CPEs: singleCPE("cpe:2.3:a:envoyproxy:envoy:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource), + }, } return append(classifiers, defaultJavaClassifiers()...) diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.11.0/linux-amd64/envoy b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.11.0/linux-amd64/envoy new file mode 100644 index 000000000..ef3062a2c Binary files /dev/null and b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.11.0/linux-amd64/envoy differ diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.14.3/linux-amd64/envoy b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.14.3/linux-amd64/envoy new file mode 100644 index 000000000..36e4fd4a4 Binary files /dev/null and b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.14.3/linux-amd64/envoy differ diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.18.6/linux-amd64/envoy b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.18.6/linux-amd64/envoy new file mode 100644 index 000000000..c3f84354b Binary files /dev/null and b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.18.6/linux-amd64/envoy differ diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.20.7/linux-amd64/envoy b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.20.7/linux-amd64/envoy new file mode 100644 index 000000000..b1924313c Binary files /dev/null and b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.20.7/linux-amd64/envoy differ diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.22.11/linux-amd64/envoy b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.22.11/linux-amd64/envoy new file mode 100644 index 000000000..3a7fe4383 Binary files /dev/null and b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.22.11/linux-amd64/envoy differ diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.28.7/linux-amd64/envoy b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.28.7/linux-amd64/envoy new file mode 100644 index 000000000..41cdbc07e Binary files /dev/null and b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.28.7/linux-amd64/envoy differ diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.34.5/linux-amd64/envoy b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.34.5/linux-amd64/envoy new file mode 100644 index 000000000..15e3a4c26 Binary files /dev/null and b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.34.5/linux-amd64/envoy differ diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.36.4/linux-amd64/envoy b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.36.4/linux-amd64/envoy new file mode 100644 index 000000000..96a1837fc Binary files /dev/null and b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.36.4/linux-amd64/envoy differ diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.6.0/linux-amd64/envoy b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.6.0/linux-amd64/envoy new file mode 100644 index 000000000..f302a66f1 Binary files /dev/null and b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/envoy/1.6.0/linux-amd64/envoy differ diff --git a/syft/pkg/cataloger/binary/test-fixtures/config.yaml b/syft/pkg/cataloger/binary/test-fixtures/config.yaml index a4a834f02..1c0d79f98 100644 --- a/syft/pkg/cataloger/binary/test-fixtures/config.yaml +++ b/syft/pkg/cataloger/binary/test-fixtures/config.yaml @@ -924,3 +924,66 @@ from-images: platform: linux/amd64 paths: - /usr/share/grafana/bin/grafana-server + + - version: 1.36.4 + images: + - ref: envoyproxy/envoy:v1.36.4@sha256:ae31562b8cede20913a2d3d6a4f44c8479a50551e033cb8ef7bb8e38cec4b573 + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.34.5 + images: + - ref: envoyproxy/envoy:v1.34.5@sha256:8ed42378a045901df417eaf8dbaba8b24aead1e995bf1b0277d907ed6320322c + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.28.7 + images: + - ref: envoyproxy/envoy:v1.28.7@sha256:c62d3ccc883457d5403a0f77b31cf2f6d35572f3f9c1c0dd93498c39a281dcfc + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.22.11 + images: + - ref: envoyproxy/envoy:v1.22.1@sha256:1385b1f75e74aef47b2cb1bafdffa43b171cf32b70e8e97d9f5d7cbf161a390a + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.20.7 + images: + - ref: envoyproxy/envoy:v1.20.7@sha256:ca581c36093f2b78d371bff49198cd2cf06753a3ae6d91699788772842e67e3c + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.18.6 + images: + - ref: envoyproxy/envoy:v1.18.6@sha256:a49240deca44017155b880172f3b2919fc26d554ad301a6f9941421849337c08 + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.14.3 + images: + - ref: envoyproxy/envoy:v1.14.3@sha256:295522f90150dc787cc7fd4b104402c43ae53ffec82b2afcb1767cfdbfce2306 + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.11.0 + images: + - ref: envoyproxy/envoy:v1.11.0@sha256:3b3eb76bc74c8e36e0ed3507844b6c12f69e9efa7588a7e35a29f90ee3e90067 + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.6.0 + images: + - ref: envoyproxy/envoy:v1.6.0@sha256:6d02409028d76b69bc348650e080e68fd81b863e68aa16e96c95d74ab0f16f24 + platform: linux/amd64 + paths: + - /usr/local/bin/envoy \ No newline at end of file