Skip to content

Commit

Permalink
feat: add perl binary classifier (anchore#1592)
Browse files Browse the repository at this point in the history
Signed-off-by: Benji Visser <[email protected]>
  • Loading branch information
noqcks committed Feb 23, 2023
1 parent 0c35f61 commit 03ca3e0
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 0 deletions.
42 changes: 42 additions & 0 deletions syft/pkg/cataloger/binary/cataloger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,48 @@ func Test_Cataloger_DefaultClassifiers_PositiveCases(t *testing.T) {
},
},
},
{
name: "positive-perl-5.12.5",
fixtureDir: "test-fixtures/classifiers/positive/perl-5.12.5",
expected: pkg.Package{
Name: "perl",
Version: "5.12.5",
Type: "binary",
PURL: "pkg:generic/[email protected]",
Locations: singleLocation("perl"),
Metadata: pkg.BinaryMetadata{
Classifier: "perl-binary",
},
},
},
{
name: "positive-perl-5.20.0",
fixtureDir: "test-fixtures/classifiers/positive/perl-5.20.0",
expected: pkg.Package{
Name: "perl",
Version: "5.20.0",
Type: "binary",
PURL: "pkg:generic/[email protected]",
Locations: singleLocation("perl"),
Metadata: pkg.BinaryMetadata{
Classifier: "perl-binary",
},
},
},
{
name: "positive-perl-5.37.8",
fixtureDir: "test-fixtures/classifiers/positive/perl-5.37.8",
expected: pkg.Package{
Name: "perl",
Version: "5.37.8",
Type: "binary",
PURL: "pkg:generic/[email protected]",
Locations: singleLocation("perl"),
Metadata: pkg.BinaryMetadata{
Classifier: "perl-binary",
},
},
},
{
name: "positive-redis-2.8.23",
fixtureDir: "test-fixtures/classifiers/positive/redis-server-2.8.23",
Expand Down
9 changes: 9 additions & 0 deletions syft/pkg/cataloger/binary/default_classifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ var defaultClassifiers = []classifier{
Package: "busybox",
CPEs: singleCPE("cpe:2.3:a:busybox:busybox:*:*:*:*:*:*:*:*"),
},
{
Class: "perl-binary",
FileGlob: "**/perl",
EvidenceMatcher: fileContentsVersionMatcher(
`(?m)\/usr\/local\/lib\/perl\d\/(?P<version>[0-9]+\.[0-9]+\.[0-9]+)`),
Package: "perl",
PURL: mustPURL("pkg:generic/perl@version"),
CPEs: singleCPE("cpe:2.3:a:perl:perl:*:*:*:*:*:*:*:*"),
},
{
Class: "php-cli-binary",
FileGlob: "**/php*",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 03ca3e0

Please sign in to comment.