Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions syft/pkg/cataloger/binary/classifier_cataloger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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{
Expand All @@ -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{
Expand Down Expand Up @@ -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{
Expand All @@ -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{
Expand All @@ -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{
Expand Down
18 changes: 12 additions & 6 deletions syft/pkg/cataloger/binary/classifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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<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]
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]
m.FileContentsVersionMatcher(`Modified\x00+(?P<version>[0-9]+\.[0-9]+-dev)\x00+`),
// 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",
PURL: mustPURL("pkg:generic/istio@version"),
Expand All @@ -1031,13 +1034,16 @@ func DefaultClassifiers() []binutils.Classifier {
FileGlob: "**/pilot-agent",
EvidenceMatcher: binutils.MatchAny(
// [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]
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]
m.FileContentsVersionMatcher(`Modified\x00+(?P<version>[0-9]+\.[0-9]+-dev)\x00+`),
// 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",
PURL: mustPURL("pkg:generic/istio@version"),
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
64 changes: 64 additions & 0 deletions syft/pkg/cataloger/binary/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,22 @@ from-images:
paths:
- /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
version: 1.10-dev
images:
Expand All @@ -1219,6 +1235,14 @@ from-images:
paths:
- /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
version: 1.3.8
images:
Expand All @@ -1235,6 +1259,14 @@ from-images:
paths:
- /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
version: 1.29.0-alpha.0
images:
Expand Down Expand Up @@ -1267,6 +1299,22 @@ from-images:
paths:
- /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
version: 1.10-dev
images:
Expand All @@ -1283,6 +1331,14 @@ from-images:
paths:
- /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
version: 1.1.17
images:
Expand All @@ -1291,6 +1347,14 @@ from-images:
paths:
- /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
version: 12.3.1
images:
Expand Down