Skip to content

Commit

Permalink
Add binary classifier for swipl
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentGoderre committed Jul 24, 2024
1 parent 741c8fb commit 41cc189
Show file tree
Hide file tree
Showing 5 changed files with 37 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 @@ -918,6 +918,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("erlang-alpine-binary"),
},
},
{
logicalFixture: "swipl/9.3.8/linux-amd64",
expected: pkg.Package{
Name: "swipl",
Version: "9.3.8",
Type: "binary",
PURL: "pkg:generic/swipl@9.3.8",
Locations: locations("swipl"),
Metadata: metadata("swipl-binary"),
},
},
{
logicalFixture: "nginx/1.25.1/linux-amd64",
expected: pkg.Package{
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 @@ -427,6 +427,16 @@ func DefaultClassifiers() []Classifier {
PURL: mustPURL("pkg:generic/erlang@version"),
CPEs: singleCPE("cpe:2.3:a:erlang:erlang\\/otp:*:*:*:*:*:*:*:*"),
},
{
Class: "swipl-binary",
FileGlob: "**/swipl",
EvidenceMatcher: FileContentsVersionMatcher(
`(?m)swipl-(?P<version>[0-9]+\.[0-9]+\.[0-9]+)\/`,
),
Package: "swipl",
PURL: mustPURL("pkg:generic/swipl@version"),
CPEs: singleCPE("cpe:2.3:a:erlang:erlang\\/otp:*:*:*:*:*:*:*:*"),
},
{
Class: "consul-binary",
FileGlob: "**/consul",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: beam.smp
offset: 6378906
length: 140
snippetSha256: 186c882decc4160bfcfbdddaee08e8364675c795d3e85697422fbd7218452ee2
fileSha256: f84f0ffc2e397abcf5f081b865e241017b1793c2ec38f5136bff4e5e21ffdad7

### byte snippet to follow ###
ied by configure */
#define ERTS_EMU_CMDLINE_FLAGS " -fno-strict-aliasing -fno-common -g -O2 -I/usr/src/otp_src_27.0/erts/x86_64-pc-linux-mu
Binary file not shown.
7 changes: 7 additions & 0 deletions syft/pkg/cataloger/binary/test-fixtures/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ from-images:
paths:
- /usr/local/lib/erlang/erts-15.0/bin/beam.smp

- version: 9.3.8
images:
- ref: swipl:9.3.8@sha256:6a15e6a03afe943228924a5502ba763e653ff28d9b3391e2b3e1fc3e991f37d4
platform: linux/amd64
paths:
- /usr/lib/swipl/bin/x86_64-linux/swipl

- version: 1.21.3
images:
- ref: golang:1.21.3@sha256:3ce8313c3513515040870c55e0c041a2b94f3576a58cfd3948633604214aa811
Expand Down

0 comments on commit 41cc189

Please # to comment.