Add binary classifier for the ERLang interpretter (#2417)

Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
This commit is contained in:
Laurent Goderre 2023-12-18 15:00:49 -05:00 committed by GitHub
parent 51d3cd0066
commit a635d66657
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 0 deletions

View file

@ -715,6 +715,18 @@ func Test_Cataloger_DefaultClassifiers_PositiveCases(t *testing.T) {
Metadata: metadata("consul-binary"),
},
},
{
name: "positive-erlang-25.3.2.7",
fixtureDir: "test-fixtures/classifiers/positive/erlang-25.3.2.7",
expected: pkg.Package{
Name: "erlang",
Version: "25.3.2.7",
Type: "binary",
PURL: "pkg:generic/erlang@25.3.2.7",
Locations: locations("erlexec"),
Metadata: metadata("erlang-binary"),
},
},
{
name: "positive-nginx-1.25.1",
fixtureDir: "test-fixtures/classifiers/positive/nginx-1.25.1",

View file

@ -283,6 +283,17 @@ var defaultClassifiers = []classifier{
PURL: mustPURL("pkg:generic/ruby@version"),
CPEs: singleCPE("cpe:2.3:a:ruby-lang:ruby:*:*:*:*:*:*:*:*"),
},
{
Class: "erlang-binary",
FileGlob: "**/erlexec",
EvidenceMatcher: fileContentsVersionMatcher(
// <artificial>[NUL]/usr/local/src/otp-25.3.2.7/erts/
`(?m)\<artificial\>\x00/usr/local/src/otp-(?P<version>[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+?)/erts/`,
),
Package: "erlang",
PURL: mustPURL("pkg:generic/erlang@version"),
CPEs: singleCPE("cpe:2.3:a:erlang:erlang\\/otp:*:*:*:*:*:*:*:*"),
},
{
Class: "consul-binary",
FileGlob: "**/consul",