From 1f4f9332c55856369a3a19a6e3931982ba9989bd Mon Sep 17 00:00:00 2001 From: Rez Moss Date: Mon, 22 Jun 2026 13:16:33 -0400 Subject: [PATCH] feat: support envoy bin classifier Signed-off-by: Rez Moss --- .../binary/classifier_cataloger_test.go | 121 ++++++++++++++++++ syft/pkg/cataloger/binary/classifiers.go | 14 ++ .../snippets/envoy/1.22.10/linux-amd64/envoy | Bin 0 -> 449 bytes .../snippets/envoy/1.23.7/linux-amd64/envoy | Bin 0 -> 569 bytes .../snippets/envoy/1.24.5/linux-amd64/envoy | Bin 0 -> 749 bytes .../snippets/envoy/1.24.9/linux-amd64/envoy | Bin 0 -> 349 bytes .../snippets/envoy/1.30.1/linux-amd64/envoy | Bin 0 -> 329 bytes .../snippets/envoy/1.30.2/linux-amd64/envoy | Bin 0 -> 429 bytes .../snippets/envoy/1.30.6/linux-amd64/envoy | Bin 0 -> 429 bytes .../snippets/envoy/1.31.2/linux-amd64/envoy | Bin 0 -> 429 bytes .../snippets/envoy/1.34.12/linux-amd64/envoy | Bin 0 -> 430 bytes .../snippets/envoy/1.35.4/linux-amd64/envoy | Bin 0 -> 430 bytes .../snippets/envoy/1.36.1/linux-amd64/envoy | Bin 0 -> 849 bytes .../pkg/cataloger/binary/testdata/config.yaml | 78 +++++++++++ 14 files changed, 213 insertions(+) create mode 100644 syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.22.10/linux-amd64/envoy create mode 100644 syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.23.7/linux-amd64/envoy create mode 100644 syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.24.5/linux-amd64/envoy create mode 100644 syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.24.9/linux-amd64/envoy create mode 100644 syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.30.1/linux-amd64/envoy create mode 100644 syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.30.2/linux-amd64/envoy create mode 100644 syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.30.6/linux-amd64/envoy create mode 100644 syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.31.2/linux-amd64/envoy create mode 100644 syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.34.12/linux-amd64/envoy create mode 100644 syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.35.4/linux-amd64/envoy create mode 100644 syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.36.1/linux-amd64/envoy diff --git a/syft/pkg/cataloger/binary/classifier_cataloger_test.go b/syft/pkg/cataloger/binary/classifier_cataloger_test.go index a64ea072b..a57290a9b 100644 --- a/syft/pkg/cataloger/binary/classifier_cataloger_test.go +++ b/syft/pkg/cataloger/binary/classifier_cataloger_test.go @@ -2778,6 +2778,127 @@ func Test_Cataloger_PositiveCases(t *testing.T) { }, }, }, + { + logicalFixture: "envoy/1.22.10/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.22.10", + Type: "binary", + PURL: "pkg:generic/envoy@1.22.10", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.24.5/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.24.5", + Type: "binary", + PURL: "pkg:generic/envoy@1.24.5", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.30.2/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.30.2", + Type: "binary", + PURL: "pkg:generic/envoy@1.30.2", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.31.2/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.31.2", + Type: "binary", + PURL: "pkg:generic/envoy@1.31.2", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.34.12/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.34.12", + Type: "binary", + PURL: "pkg:generic/envoy@1.34.12", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.35.4/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.35.4", + Type: "binary", + PURL: "pkg:generic/envoy@1.35.4", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.23.7/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.23.7", + Type: "binary", + PURL: "pkg:generic/envoy@1.23.7", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.24.9/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.24.9", + Type: "binary", + PURL: "pkg:generic/envoy@1.24.9", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.30.1/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.30.1", + Type: "binary", + PURL: "pkg:generic/envoy@1.30.1", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.30.6/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.30.6", + Type: "binary", + PURL: "pkg:generic/envoy@1.30.6", + Locations: locations("envoy"), + Metadata: metadata("envoy-binary"), + }, + }, + { + logicalFixture: "envoy/1.36.1/linux-amd64", + expected: pkg.Package{ + Name: "envoy", + Version: "1.36.1", + Type: "binary", + PURL: "pkg:generic/envoy@1.36.1", + 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 56f7865de..c5229235b 100644 --- a/syft/pkg/cataloger/binary/classifiers.go +++ b/syft/pkg/cataloger/binary/classifiers.go @@ -1076,6 +1076,20 @@ func DefaultClassifiers() []binutils.Classifier { 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`), + // contrib 1.3x [NUL]1.34.12[NUL]envoy_quiche... or [NUL]1.30.2[NUL]envoy/extensions... or [NUL]1.30.8[NUL]envoy:// + m.FileContentsVersionMatcher(`(?s)\x00(?P1\.3[0-9]\.[0-9]+(-dev)?)\x00envoy[/._:]`), + // contrib 1.3x [NUL]1.30.7[NUL]...envoy.service or [NUL]1.30.6[NUL]...envoy.data + m.FileContentsVersionMatcher(`(?s)\x00(?P1\.3[0-9]\.[0-9]+(-dev)?)\x00.{0,200}envoy[./]`), + // contrib1.3x [NUL]1.31.2[NUL]...envoy_quic or [NUL]1.36.x[NUL]...envoy_quic + m.FileContentsVersionMatcher(`(?s)\x00(?P1\.3[0-9]\.[0-9]+(-dev)?)\x00.{0,1000}envoy_quic`), + // contrib 1.3x [NUL]1.30.1[NUL]TLS client + m.FileContentsVersionMatcher(`(?s)\x00(?P1\.3[0-9]\.[0-9]+(-dev)?)\x00TLS `), + // contrib 1.2x [NUL]1.24.9[NUL]envoy/extensions... + m.FileContentsVersionMatcher(`(?s)\x00(?P1\.2[0-9]\.[0-9]+(-dev)?)\x00envoy[/._]`), + // contrib 1.2x [NUL]1.22.10[NUL]...envoy. or [NUL]1.24.5[NUL]...envoy. + m.FileContentsVersionMatcher(`(?s)\x00(?P1\.2[0-9]\.[0-9]+(-dev)?)\x00.{0,500}envoy\.`), + // contrib 1.2x [NUL]1.23.7[NUL]...envoy_internal + m.FileContentsVersionMatcher(`(?s)\x00(?P1\.2[0-9]\.[0-9]+(-dev)?)\x00.{0,300}envoy_`), ), Package: "envoy", PURL: mustPURL("pkg:generic/envoy@version"), diff --git a/syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.22.10/linux-amd64/envoy b/syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.22.10/linux-amd64/envoy new file mode 100644 index 0000000000000000000000000000000000000000..ebf4ad28626892656432ed1d3aeea559e070107a GIT binary patch literal 449 zcmZ8eO^eh(6wEolqG2vGilMuc{>nvABRinWFdMzNvh>I6Odv_e?%vTw{O^Wky?A?6 z6-8COMbFS8Sgzrz4BjWmEs|I?n5%MvWyqHnQHsm7jOz;d?xHEpDw>pZ7nf7q~y zylc_#KLx2Mtq3mm-|pS_*N6M+|6~7VU%fgU-WJ{0?zVq8oxAtPyY8Vse(ui2@pR>A z3mqXPNJvLOOUNiau4{-H9107{mocGP+sn8>aT`8`Wq|krhNvC5n~-wRk2Cb);}}!^ svZfqC&*xw7wjRavLn^1UuJkrrN>doBYhB&+{pk!p9wFsZ3@gO^7pF6d+yDRo literal 0 HcmV?d00001 diff --git a/syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.23.7/linux-amd64/envoy b/syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.23.7/linux-amd64/envoy new file mode 100644 index 0000000000000000000000000000000000000000..e64339de8b2bf89849e41371236ee5cfc71e601b GIT binary patch literal 569 zcmZvaO>5&Y5QcsBuNVk{_L9hwB|GkEVfV1GUy$B|tQo}uSu&Oq(|^B8w|nbJ1JCfz z^MZn&X#fiM_*O@26XgLq);6sYwWn~+(*UAnbqa1-D4!?Ir5d1bnCwrSm^jIXnZ_8& zNXcFywOWwu87kf>*&6D2FFVaurv&Q-avBAr+B#4F!}vHNH)tCxRAVJtEBjWRETggG zBR3qC7c`t z&Ms8Vfr~>|rFdHn9Zj6)7>?u3T3SDzi<=jJFsAwyGw4Sc;Un0T8LpIn-m)G&ebrfm zvyi+q1TKM_=YOR7wiE~0r>8wWLkwUM_6Sy&?s$OT9)a!@a)OOkD(D4P(ggR#)nMMvRZ?Gg5v3b8kT-u9Olb(B(uZP10>y;+jjBVw9&MJZm$#K-K#% exVVsM4cb?)Kh9vhD}wJ@7ei}y))}4YveI8xbhLf| literal 0 HcmV?d00001 diff --git a/syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.24.5/linux-amd64/envoy b/syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.24.5/linux-amd64/envoy new file mode 100644 index 0000000000000000000000000000000000000000..1f22478b929d83aee614578e6a6aedb726b47f39 GIT binary patch literal 749 zcmZ8fOOKl{5a!IU7%7U{N?XLs;N;rJsZtN^9gXcVv6k2fOg8k_cbwfy)rtdnX8gSd zk5@Va`CHiYVC_or481(by6W~ym8SnsNFnk4Sof*krs#-+TnsX0!8G3 z*?{R@9Lr{N3e}!;!An@4i|h;f51hya{rEp-GO18MudG_rdr0S*87KFLOu@0OZX6V@ zG)zH1KYTBwiPJN{Esq=*`%#?NLzNGZrjrBf#%&>!{rH|Fq~)-Fy3fQPCVTv;g`T#R e%fn-nucd47V;D3qod?qBhO4@;z-6;ljimfrQLM>!Q=gzuF@OH zxAJI;>MFH2UFW-au+1d-qn>*McHgXdoM)-WGueahP4o&DZ3^f(F!+HfYKP!bP!E#2 zAvp>l*r7y=grdZI-2F=d(+fnv`kaEn(kaYOTCxn(ynE=NIi|Y%Azz#dvh&6D?X=s`fs~=DYb0mCb^zirrx~F=2iI{QPgjV literal 0 HcmV?d00001 diff --git a/syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.30.1/linux-amd64/envoy b/syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.30.1/linux-amd64/envoy new file mode 100644 index 0000000000000000000000000000000000000000..597d46fb92ccb012c6719f362c97951993328d1d GIT binary patch literal 329 zcmXw#&1%Ci5QKf!Q!M0INVS$FTfXHGN};6C7CZ(l>(+rZ3x43piJ zdZ7HZ+{MDYQt82>L8&`2Q@)g`2b5B*Io)nl&XcRP*$OUt9}OWnZh~X-ZD7N;Riu%0 z!r^lrQVzE5{fzo8{? zi(fNuZA5B`;!Lu#$tJi{I=6&TnngFxGt%*_SuI+k>!E74GODtsww!Y`s%IrMtC$i- zZ*4{2l!jJyPq}8g=8dhDk+McrtNv0^>oJ~(z-zcUbq^$>NtEHf{ zw9Hi7F0X{>CFdoWlv%dl?@7NVkiRoY^2GXS@;9i%c>9DMS-r;SfRZ^*AUj|j_X wkPl-tenD9Ch35xMNgp1Q7rb8)QyviK4M*p^GuXX8AIY6YAOU*l%rwHKZ#+Yc*Z=?k literal 0 HcmV?d00001 diff --git a/syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.30.6/linux-amd64/envoy b/syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.30.6/linux-amd64/envoy new file mode 100644 index 0000000000000000000000000000000000000000..c69ef23797498d8d23540ad44ea0e8bfaa8e6178 GIT binary patch literal 429 zcmXw$&2GaW5QKg9Qy}HiTpSD-6RYi|s?+Z~_(M+;O z92llczSY_Lf;2GGx2;yDj+l0|ADH00E-9Q&NN;;9Iz6z-Oel@w+W1~MK8b#dN?|7v zx#dPG*`b~UhvnQ!qYZ#WtGSsR2oIw6A>uzwwVmI#s&~+e-Z{mcK}6A+#joYoYumTN z*oD$-*()$!pcM{%C$>u*SJ$i6icL2{_7{^;W+^(~@%SC-eivN?JLlij+D^(op*E6~%>K3d_D`b{Mw68IJ_Z zy*|g9(iPj0SUMTa#F(+n?Q|rZ((ziB%LUu(3Amb$MAHzgQsB`_5rR(Km|!F52tp>6 zSoDlWrKOkF^wBb8Ng6~ssm|47S~C8MMMJeTfLg^U6BX3@qzqamnV^Y7Pl@+FM8Tj# zQ7g`rFqB)PMViKOx7!i_Y)Cenq*an?&hG-*pZE_JBxD_Gdx({J^fl_KCk9FxD?vQUthM%8qBAuEm eMDSfUWte}~&ij?SZeRrm;SHmEEG5>*|CitU5{&); literal 0 HcmV?d00001 diff --git a/syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.34.12/linux-amd64/envoy b/syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.34.12/linux-amd64/envoy new file mode 100644 index 0000000000000000000000000000000000000000..45b46380a86de014f51514f2d9519007978e5963 GIT binary patch literal 430 zcma)1OKJl#49(i7Fl1YTf8)kkKS9-5l4>8 zwcc1IYS>3Eg|tq(z-CudE z&XBjcB$cu&k_2Ph?Uv_TNB$d=_sXfxbA9J`h;ah`%0Itec)y+Sv2Nr}o1IjfNB4NX zOyz)a#knR(dB#X{+CR>*)TQBiO?|pz%$K$G_JoS2kJzUp*2`1$6-!+q_S)i4k$(^F Lp$aZNww}HL{hN>` literal 0 HcmV?d00001 diff --git a/syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.35.4/linux-amd64/envoy b/syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.35.4/linux-amd64/envoy new file mode 100644 index 0000000000000000000000000000000000000000..f950eb6a734350bb0d523eb43d15ea7f28178368 GIT binary patch literal 430 zcmX|+%}&EG5QKBiQ&{R175~I`5{Xmc07pRL7}@J}Yss|g zYOq{rYI(z2L4^V4I!lo|&fB`)Y&OJR3X)q*QZn&5#{5ZEsV3f$2lD-MN6O`h*R^6> zA-7F+eSJ7B0S-7!7_)K4MjU)J`zsz?n6KoF(;RXdPP9?gyx1|6T}}z1yy9uWx!mB# z6bk;Myi9=ikjF8n`;gZemMNtD5XNKN0#tSh(Y?$$J!V)&Or_dohw#1@t!^pL?&+&w Gn!_()Cya3b literal 0 HcmV?d00001 diff --git a/syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.36.1/linux-amd64/envoy b/syft/pkg/cataloger/binary/testdata/classifiers/snippets/envoy/1.36.1/linux-amd64/envoy new file mode 100644 index 0000000000000000000000000000000000000000..f35b7f961cf5c20023739c82c369f8cc39455caf GIT binary patch literal 849 zcmYjQ!EW0y4AnVbL7laljpt`j*+l0>D`v}nsR)rCZ!XR>V*ob$BP*rshd!}*lYCfZp1*DO!7R&@!N z1yAH0lj$sJHH9P=dEU*FX;$bNFF5tc%ABi=r#w?sROm8CRZJ#VS69%UBElO@h#s`J z*1rHjlLK}U6|5dX%ih=%{QkrEO`6|uhEBE?VL+*_K`Xc&u})gs%5ER3YVAJZ*0?W( z;}AZCNSVDb>XxnDlRHpS{Tk5)>6+w{2)575ZGso_cF@mK(4Qx z_H0QM7v9Ce+j`7n%gxIbP@2iLsWt8(wcm-qlIj-!){NzK|@m&oi-pX20aP!^JuyqiUF;cYTOi|t=yi& SqO*oN3WZu8Z4{SH5`O_->l{S@ literal 0 HcmV?d00001 diff --git a/syft/pkg/cataloger/binary/testdata/config.yaml b/syft/pkg/cataloger/binary/testdata/config.yaml index 53fb35c64..41d402bc9 100644 --- a/syft/pkg/cataloger/binary/testdata/config.yaml +++ b/syft/pkg/cataloger/binary/testdata/config.yaml @@ -1737,3 +1737,81 @@ from-images: platform: linux/amd64 paths: - /usr/share/elastic-agent/data/elastic-agent-1c21b0/elastic-agent + + # contrib builds + - version: 1.22.10 + images: + - ref: envoyproxy/envoy:contrib-v1.22.10@sha256:2c479dd69aaaf555ab48ab9142b5970b74ee472e50f08d2b85caa1460c19f689 + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.24.5 + images: + - ref: envoyproxy/envoy:contrib-v1.24.5@sha256:9a32eaff6798dd62a7d6662a02226d47df694406d1698f000ad25dd1a3355952 + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.30.2 + images: + - ref: envoyproxy/envoy:contrib-v1.30.2@sha256:8878516ce3c8f099300243fadacb2e3d869d447dfd276ac2661c6c06c92bcd45 + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.31.2 + images: + - ref: envoyproxy/envoy:contrib-v1.31.2@sha256:ebdf98ff3b26d5fa70276fb43f0dbca168f49aa5aa1fe5f18382d391f482aa3e + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.34.12 + images: + - ref: envoyproxy/envoy:contrib-v1.34.12@sha256:50da8a5221c9afc84df79f384aa9ee9c7000f8509d3f2562a58d84cb2fd39645 + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.23.7 + images: + - ref: envoyproxy/envoy:contrib-v1.23.7@sha256:4589b08900e41de763d19ac3c854c280796a575f58c218c5e8b2f2a6e4765dda + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.24.9 + images: + - ref: envoyproxy/envoy:contrib-v1.24.9@sha256:e6cdba2e747f2c024821cec58d2e2833cd0e6512c61d1dbe7200f8046235a026 + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.30.1 + images: + - ref: envoyproxy/envoy:contrib-v1.30.1@sha256:92d50d25c28d68979a20607736e401e4c05c717109fc0d07d688aaa3db35bd94 + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.30.6 + images: + - ref: envoyproxy/envoy:contrib-v1.30.6@sha256:58bd1cb68eea4ffd5b4d41112bc31299057f17e72c6cacaf7431fd0ee6b5222b + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.35.4 + images: + - ref: envoyproxy/envoy:contrib-v1.35.4@sha256:07378820f9669a3c7eac5d0a88fda78ccb8dfdd4100388db1110b2038f8d5d21 + platform: linux/amd64 + paths: + - /usr/local/bin/envoy + + - version: 1.36.1 + images: + - ref: envoyproxy/envoy:contrib-v1.36.1@sha256:f2001f6f72abc22e7ac9cebe940e48570ee5970703ada61bca6919c687b2accf + platform: linux/amd64 + paths: + - /usr/local/bin/envoy