Skip to content

Commit

Permalink
feat: detect fluent-bit binaries (#2905)
Browse files Browse the repository at this point in the history
Signed-off-by: Keith Zantow <kzantow@gmail.com>
  • Loading branch information
kzantow committed May 28, 2024
1 parent 2b70ea3 commit ac34808
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 0 deletions.
22 changes: 22 additions & 0 deletions syft/pkg/cataloger/binary/classifier_cataloger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,28 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("gcc-binary"),
},
},
{
logicalFixture: "fluent-bit/3.0.2/linux-amd64",
expected: pkg.Package{
Name: "fluent-bit",
Version: "3.0.2",
Type: "binary",
PURL: "pkg:github/fluent/fluent-bit@3.0.2",
Locations: locations("fluent-bit"),
Metadata: metadata("fluent-bit-binary"),
},
},
{
logicalFixture: "fluent-bit/2.2.1/linux-arm64",
expected: pkg.Package{
Name: "fluent-bit",
Version: "2.2.1",
Type: "binary",
PURL: "pkg:github/fluent/fluent-bit@2.2.1",
Locations: locations("fluent-bit"),
Metadata: metadata("fluent-bit-binary"),
},
},
{
logicalFixture: "wp/2.9.0/linux-amd64",
expected: pkg.Package{
Expand Down
13 changes: 13 additions & 0 deletions syft/pkg/cataloger/binary/classifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,19 @@ func DefaultClassifiers() []Classifier {
PURL: mustPURL("pkg:generic/gcc@version"),
CPEs: singleCPE("cpe:2.3:a:gnu:gcc:*:*:*:*:*:*:*:*"),
},
{
Class: "fluent-bit-binary",
FileGlob: "**/fluent-bit",
EvidenceMatcher: FileContentsVersionMatcher(
// [NUL]3.0.2[NUL]%sFluent Bit
// [NUL]2.2.3[NUL]Fluent Bit
// [NUL]2.2.1[NUL][NUL][NUL]Fluent Bit
`\x00(?P<version>[0-9]+\.[0-9]+\.[0-9]+)\x00[^\d]*Fluent`,
),
Package: "fluent-bit",
PURL: mustPURL("pkg:github/fluent/fluent-bit@version"),
CPEs: singleCPE("cpe:2.3:a:treasuredata:fluent_bit:*:*:*:*:*:*:*:*"),
},
{
Class: "wordpress-cli-binary",
FileGlob: "**/wp",
Expand Down
Binary file not shown.
Binary file not shown.
14 changes: 14 additions & 0 deletions syft/pkg/cataloger/binary/test-fixtures/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,20 @@ from-images:
paths:
- /bin/consul

- version: 3.0.2
images:
- ref: fluent/fluent-bit:3.0.2-amd64@sha256:7e6fe8efd51dda0739e355f58bf5e3b1623cbf2d4a23c06c7a365d9553e2d242
platform: linux/amd64
paths:
- /fluent-bit/bin/fluent-bit

- version: 2.2.1
images:
- ref: fluent/fluent-bit:2.2.1-arm64@sha256:28eb03950eb0dac0ca6faead7fdd7261291d669a2b2f010113dab2c25b52b6bf
platform: linux/arm64
paths:
- /fluent-bit/bin/fluent-bit

- name: openssl
version: 1.1.1w
images:
Expand Down

0 comments on commit ac34808

Please sign in to comment.