Skip to content

Commit

Permalink
feat: add binary classifier for syslog-ng
Browse files Browse the repository at this point in the history
Signed-off-by: Krystian Gorny <[email protected]>
  • Loading branch information
Krystian Gorny committed Sep 24, 2024
1 parent 36022ca commit 2d5fd47
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
11 changes: 11 additions & 0 deletions syft/pkg/cataloger/binary/classifier_cataloger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("openssh-binary"),
},
},
{
logicalFixture: "syslog-ng/4.7.1/linux-amd64",
expected: pkg.Package{
Name: "syslog-ng",
Version: "4.7.1",
Type: "binary",
PURL: "pkg:generic/[email protected]",
Locations: locations("syslog-ng"),
Metadata: metadata("syslog-ng-binary"),
},
},
}

for _, test := range tests {
Expand Down
10 changes: 10 additions & 0 deletions syft/pkg/cataloger/binary/classifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,16 @@ func DefaultClassifiers() []Classifier {
PURL: mustPURL("pkg:generic/openssh@version"),
CPEs: singleCPE("cpe:2.3:a:openbsd:openssh:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource),
},
{
Class: "syslog-ng-binary",
FileGlob: "**/syslog-ng",
EvidenceMatcher: FileContentsVersionMatcher(
`\x00syslog-ng [0-9] \((?P<version>[0-9]+\.[0-9]+\.[0-9]+)\)`,
),
Package: "syslog-ng",
PURL: mustPURL("pkg:generic/syslog-ng@version"),
CPEs: singleCPE("cpe:2.3:a:oneidentity:syslog-ng:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource),
},
}
}

Expand Down
8 changes: 8 additions & 0 deletions syft/pkg/cataloger/binary/test-fixtures/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -687,3 +687,11 @@ from-images:
platform: linux/amd64
paths:
- /usr/bin/ssh

- name: syslog-ng
version: 4.7.1
images:
- ref: linuxserver/syslog-ng:4.7.1@sha256:c995ed807bafc61972c486a4a876589df214dc34f4caf2e329bb6ef6bcf12639
platform: linux/amd64
paths:
- /usr/sbin/syslog-ng

0 comments on commit 2d5fd47

Please sign in to comment.