Skip to content

Commit

Permalink
feat: classifier for Dart lang binaries (#3265)
Browse files Browse the repository at this point in the history
Signed-off-by: Laurent Goderre <[email protected]>
  • Loading branch information
LaurentGoderre authored Sep 23, 2024
1 parent 963ea59 commit 7815d8e
Show file tree
Hide file tree
Showing 5 changed files with 46 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 @@ -961,6 +961,28 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("swipl-binary"),
},
},
{
logicalFixture: "dart/3.5.2/linux-amd64",
expected: pkg.Package{
Name: "dart",
Version: "3.5.2",
Type: "binary",
PURL: "pkg:generic/[email protected]",
Locations: locations("dart"),
Metadata: metadata("dart-binary"),
},
},
{
logicalFixture: "dart/3.6.0-216.1.beta/linux-amd64",
expected: pkg.Package{
Name: "dart",
Version: "3.6.0-216.1.beta",
Type: "binary",
PURL: "pkg:generic/[email protected]",
Locations: locations("dart"),
Metadata: metadata("dart-binary"),
},
},
{
logicalFixture: "haskell-ghc/9.6.5/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 @@ -447,6 +447,16 @@ func DefaultClassifiers() []Classifier {
PURL: mustPURL("pkg:generic/swipl@version"),
CPEs: singleCPE("cpe:2.3:a:erlang:erlang\\/otp:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource),
},
{
Class: "dart-binary",
FileGlob: "**/dart",
EvidenceMatcher: FileContentsVersionMatcher(
`(?m)Dart,GC"\x00(?P<version>[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+(\.[0-9]+)?\.beta)?) `,
),
Package: "dart",
PURL: mustPURL("pkg:generic/dart@version"),
CPEs: singleCPE("cpe:2.3:a:dart:dart_software_development_kit:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource),
},
{
Class: "haskell-ghc-binary",
FileGlob: "**/ghc*",
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 @@ -78,6 +78,20 @@ from-images:
paths:
- /usr/lib/swipl/bin/x86_64-linux/swipl

- version: 3.5.2
images:
- ref: dart:3.5.2@sha256:1fd62cb5036bdc42de89bdae747683277986639be9b0b0a0751d2c50bbd9441f
platform: linux/amd64
paths:
- /usr/lib/dart/bin/dart

- version: 3.6.0-216.1.beta
images:
- ref: dart:3.6.0-216.1.beta@sha256:f4211fec53f972987f5bc1dd0ffd3d3cb1fd820ac1ade4e45a7a0c7bffd71d58
platform: linux/amd64
paths:
- /usr/lib/dart/bin/dart

- name: haskell-ghc
version: 9.6.5
images:
Expand Down

0 comments on commit 7815d8e

Please sign in to comment.