mirror of
https://github.com/anchore/syft.git
synced 2026-11-04 08:26:38 +01:00
fix(binary): match istio snapshot and older pre-release versions (#5121)
The istio pilot-agent/pilot-discovery classifiers missed every -snapshot.N build and the older -alpha.N/-beta.N/-rc.N layouts. Two defects: 1. The doubled-version matcher anchored on a bare x.y.z followed by NULs, but pre-release builds repeat the full version including the suffix (1.15.0-beta.0 NUL NUL NUL 1.15.0-beta.0), so the anchor never matched. Only the capture group had been widened previously. 2. -snapshot.N was absent from every alternation, and snapshot builds store the version only once with no leading copy, so no existing matcher could reach it. Widen the leading anchor to accept the same optional pre-release suffix it already accepts in the capture group, add -snapshot.N to each alternation, and add a matcher for the standalone snapshot layout. The new matcher is second so it can never shadow a normal build. Adds real captured snippets for pilot-agent and pilot-discovery at 1.0.0-snapshot.0, 1.5.0-alpha.0, 1.15.0-beta.0 and 1.19.0-rc.0. Fixes #5060 Signed-off-by: phatlc <phatle.hsd@gmail.com>
This commit is contained in:
@@ -2178,6 +2178,28 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
|
|||||||
Metadata: metadata("istio-binary"),
|
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",
|
logicalFixture: "istio_pilot-discovery/1.10-dev/linux-amd64",
|
||||||
expected: pkg.Package{
|
expected: pkg.Package{
|
||||||
@@ -2200,6 +2222,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
|
|||||||
Metadata: metadata("istio-binary"),
|
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",
|
logicalFixture: "istio_pilot-discovery/1.3.8/linux-amd64",
|
||||||
expected: pkg.Package{
|
expected: pkg.Package{
|
||||||
@@ -2222,6 +2255,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
|
|||||||
Metadata: metadata("istio-binary"),
|
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",
|
logicalFixture: "istio_pilot-agent/1.29.0-alpha.0/linux-amd64",
|
||||||
expected: pkg.Package{
|
expected: pkg.Package{
|
||||||
@@ -2266,6 +2310,28 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
|
|||||||
Metadata: metadata("istio-binary"),
|
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",
|
logicalFixture: "istio_pilot-agent/1.10-dev/linux-amd64",
|
||||||
expected: pkg.Package{
|
expected: pkg.Package{
|
||||||
@@ -2288,6 +2354,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
|
|||||||
Metadata: metadata("istio-binary"),
|
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",
|
logicalFixture: "istio_pilot-agent/1.1.17/linux-amd64",
|
||||||
expected: pkg.Package{
|
expected: pkg.Package{
|
||||||
@@ -2299,6 +2376,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
|
|||||||
Metadata: metadata("istio-binary"),
|
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",
|
logicalFixture: "grafana/12.4.0-22081664032/linux-amd64",
|
||||||
expected: pkg.Package{
|
expected: pkg.Package{
|
||||||
|
|||||||
@@ -1042,13 +1042,16 @@ func DefaultClassifiers() []binutils.Classifier {
|
|||||||
EvidenceMatcher: binutils.MatchAny(
|
EvidenceMatcher: binutils.MatchAny(
|
||||||
// [NUL]1.26.8[NUL][NUL]1.26.8[NUL]
|
// [NUL]1.26.8[NUL][NUL]1.26.8[NUL]
|
||||||
// [NUL]1.3.7[NUL][NUL][NUL]1.3.8[NUL]
|
// [NUL]1.3.7[NUL][NUL][NUL]1.3.8[NUL]
|
||||||
m.FileContentsVersionMatcher(`[0-9]+\.[0-9]+\.[0-9]+\x00+(?P<version>[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<version>[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<version>[0-9]+\.[0-9]+\.[0-9]+-snapshot\.[0-9]+)\x00+`),
|
||||||
// Clean[NUL][NUL][NUL]1.8.0[NUL]
|
// Clean[NUL][NUL][NUL]1.8.0[NUL]
|
||||||
m.FileContentsVersionMatcher(`Clean\x00+(?P<version>[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-dev)?)\x00+`),
|
m.FileContentsVersionMatcher(`Clean\x00+(?P<version>[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]
|
// Modified[NUL][NUL][NUL][NUL][NUL][NUL][NUL][NUL]1.10-dev[NUL][NUL][NUL]
|
||||||
m.FileContentsVersionMatcher(`Modified\x00+(?P<version>[0-9]+\.[0-9]+-dev)\x00+`),
|
m.FileContentsVersionMatcher(`Modified\x00+(?P<version>[0-9]+\.[0-9]+-dev)\x00+`),
|
||||||
// 1.1.17[NUL]...S=v<y5
|
// 1.1.17[NUL]...S=v<y5
|
||||||
m.FileContentsVersionMatcher(`(?s)(?P<version>[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-dev)?)\x00+.{1,100}S?=v<y5`),
|
m.FileContentsVersionMatcher(`(?s)(?P<version>[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-snapshot\.[0-9]+|-dev)?)\x00+.{1,100}S?=v<y5`),
|
||||||
),
|
),
|
||||||
Package: "pilot-discovery",
|
Package: "pilot-discovery",
|
||||||
PURL: mustPURL("pkg:generic/istio@version"),
|
PURL: mustPURL("pkg:generic/istio@version"),
|
||||||
@@ -1059,13 +1062,16 @@ func DefaultClassifiers() []binutils.Classifier {
|
|||||||
FileGlob: "**/pilot-agent",
|
FileGlob: "**/pilot-agent",
|
||||||
EvidenceMatcher: binutils.MatchAny(
|
EvidenceMatcher: binutils.MatchAny(
|
||||||
// [NUL]1.26.8[NUL][NUL]1.26.8[NUL]
|
// [NUL]1.26.8[NUL][NUL]1.26.8[NUL]
|
||||||
m.FileContentsVersionMatcher(`[0-9]+\.[0-9]+\.[0-9]+\x00+(?P<version>[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<version>[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<version>[0-9]+\.[0-9]+\.[0-9]+-snapshot\.[0-9]+)\x00+`),
|
||||||
// Clean[NUL][NUL][NUL]1.8.0[NUL]
|
// Clean[NUL][NUL][NUL]1.8.0[NUL]
|
||||||
m.FileContentsVersionMatcher(`Clean\x00+(?P<version>[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-dev)?)\x00+`),
|
m.FileContentsVersionMatcher(`Clean\x00+(?P<version>[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]
|
// Modified[NUL][NUL][NUL][NUL][NUL][NUL][NUL][NUL]1.10-dev[NUL][NUL][NUL]
|
||||||
m.FileContentsVersionMatcher(`Modified\x00+(?P<version>[0-9]+\.[0-9]+-dev)\x00+`),
|
m.FileContentsVersionMatcher(`Modified\x00+(?P<version>[0-9]+\.[0-9]+-dev)\x00+`),
|
||||||
// 1.1.17[NUL]...S=v<y5
|
// 1.1.17[NUL]...S=v<y5
|
||||||
m.FileContentsVersionMatcher(`(?s)(?P<version>[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-dev)?)\x00+.{1,100}S?=v<y5`),
|
m.FileContentsVersionMatcher(`(?s)(?P<version>[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+|-beta\.[0-9]+|-rc\.[0-9]+|-snapshot\.[0-9]+|-dev)?)\x00+.{1,100}S?=v<y5`),
|
||||||
),
|
),
|
||||||
Package: "pilot-agent",
|
Package: "pilot-agent",
|
||||||
PURL: mustPURL("pkg:generic/istio@version"),
|
PURL: mustPURL("pkg:generic/istio@version"),
|
||||||
|
|||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+64
@@ -1203,6 +1203,22 @@ from-images:
|
|||||||
paths:
|
paths:
|
||||||
- /usr/local/bin/pilot-discovery
|
- /usr/local/bin/pilot-discovery
|
||||||
|
|
||||||
|
- name: istio_pilot-discovery
|
||||||
|
version: 1.19.0-rc.0
|
||||||
|
images:
|
||||||
|
- ref: istio/pilot:1.19.0-rc.0@sha256:09c3c80be369a9724f11e1edfc60cc0b4d58612a6a99ac7314f620254986b159
|
||||||
|
platform: linux/amd64
|
||||||
|
paths:
|
||||||
|
- /usr/local/bin/pilot-discovery
|
||||||
|
|
||||||
|
- name: istio_pilot-discovery
|
||||||
|
version: 1.15.0-beta.0
|
||||||
|
images:
|
||||||
|
- ref: istio/pilot:1.15.0-beta.0@sha256:07a1fd1b14ce51c47f0051f597e9b581020a2e5cc53d144592e85f3fa07bbef6
|
||||||
|
platform: linux/amd64
|
||||||
|
paths:
|
||||||
|
- /usr/local/bin/pilot-discovery
|
||||||
|
|
||||||
- name: istio_pilot-discovery
|
- name: istio_pilot-discovery
|
||||||
version: 1.10-dev
|
version: 1.10-dev
|
||||||
images:
|
images:
|
||||||
@@ -1219,6 +1235,14 @@ from-images:
|
|||||||
paths:
|
paths:
|
||||||
- /usr/local/bin/pilot-discovery
|
- /usr/local/bin/pilot-discovery
|
||||||
|
|
||||||
|
- name: istio_pilot-discovery
|
||||||
|
version: 1.5.0-alpha.0
|
||||||
|
images:
|
||||||
|
- ref: istio/pilot:1.5.0-alpha.0@sha256:b372bcbacd5af241afe097bd017e16773514b6ba17152ca02b7d5285e290b110
|
||||||
|
platform: linux/amd64
|
||||||
|
paths:
|
||||||
|
- /usr/local/bin/pilot-discovery
|
||||||
|
|
||||||
- name: istio_pilot-discovery
|
- name: istio_pilot-discovery
|
||||||
version: 1.3.8
|
version: 1.3.8
|
||||||
images:
|
images:
|
||||||
@@ -1235,6 +1259,14 @@ from-images:
|
|||||||
paths:
|
paths:
|
||||||
- /usr/local/bin/pilot-discovery
|
- /usr/local/bin/pilot-discovery
|
||||||
|
|
||||||
|
- name: istio_pilot-discovery
|
||||||
|
version: 1.0.0-snapshot.0
|
||||||
|
images:
|
||||||
|
- ref: istio/pilot:1.0.0-snapshot.0@sha256:3b32619b36014eeafaad8199d8af48f7725e9e75a01c0b1abfba1d7166e53b66
|
||||||
|
platform: linux/amd64
|
||||||
|
paths:
|
||||||
|
- /usr/local/bin/pilot-discovery
|
||||||
|
|
||||||
- name: istio_pilot-agent
|
- name: istio_pilot-agent
|
||||||
version: 1.29.0-alpha.0
|
version: 1.29.0-alpha.0
|
||||||
images:
|
images:
|
||||||
@@ -1267,6 +1299,22 @@ from-images:
|
|||||||
paths:
|
paths:
|
||||||
- /usr/local/bin/pilot-agent
|
- /usr/local/bin/pilot-agent
|
||||||
|
|
||||||
|
- name: istio_pilot-agent
|
||||||
|
version: 1.19.0-rc.0
|
||||||
|
images:
|
||||||
|
- ref: istio/proxyv2:1.19.0-rc.0@sha256:8c23abb1663e83ec19cac1e3de46c3cf7e942329936463646ca7a8d8088806b4
|
||||||
|
platform: linux/amd64
|
||||||
|
paths:
|
||||||
|
- /usr/local/bin/pilot-agent
|
||||||
|
|
||||||
|
- name: istio_pilot-agent
|
||||||
|
version: 1.15.0-beta.0
|
||||||
|
images:
|
||||||
|
- ref: istio/proxyv2:1.15.0-beta.0@sha256:9f54e6fa64c6ef6bb8b3e72e513c4f0415f1576ae755b4fe9a5be8c8b38694de
|
||||||
|
platform: linux/amd64
|
||||||
|
paths:
|
||||||
|
- /usr/local/bin/pilot-agent
|
||||||
|
|
||||||
- name: istio_pilot-agent
|
- name: istio_pilot-agent
|
||||||
version: 1.10-dev
|
version: 1.10-dev
|
||||||
images:
|
images:
|
||||||
@@ -1283,6 +1331,14 @@ from-images:
|
|||||||
paths:
|
paths:
|
||||||
- /usr/local/bin/pilot-agent
|
- /usr/local/bin/pilot-agent
|
||||||
|
|
||||||
|
- name: istio_pilot-agent
|
||||||
|
version: 1.5.0-alpha.0
|
||||||
|
images:
|
||||||
|
- ref: istio/proxyv2:1.5.0-alpha.0@sha256:6d31b7e373622b2d483124bdc46974ff7b39c9b3fff8a9dc73a47d91344a24f6
|
||||||
|
platform: linux/amd64
|
||||||
|
paths:
|
||||||
|
- /usr/local/bin/pilot-agent
|
||||||
|
|
||||||
- name: istio_pilot-agent
|
- name: istio_pilot-agent
|
||||||
version: 1.1.17
|
version: 1.1.17
|
||||||
images:
|
images:
|
||||||
@@ -1291,6 +1347,14 @@ from-images:
|
|||||||
paths:
|
paths:
|
||||||
- /usr/local/bin/pilot-agent
|
- /usr/local/bin/pilot-agent
|
||||||
|
|
||||||
|
- name: istio_pilot-agent
|
||||||
|
version: 1.0.0-snapshot.0
|
||||||
|
images:
|
||||||
|
- ref: istio/proxyv2:1.0.0-snapshot.0@sha256:13c352cd8b82c326d6e36a8d0a1eed9debe6b1816e30cfe79970d316c9e59714
|
||||||
|
platform: linux/amd64
|
||||||
|
paths:
|
||||||
|
- /usr/local/bin/pilot-agent
|
||||||
|
|
||||||
- name: grafana
|
- name: grafana
|
||||||
version: 12.3.1
|
version: 12.3.1
|
||||||
images:
|
images:
|
||||||
|
|||||||
Reference in New Issue
Block a user