mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
feat: detect elixir bin (#4334)
* Elixir detection, fixed #4333 --------- Signed-off-by: Rez Moss <hi@rezmoss.com>
This commit is contained in:
parent
fe1ea443c2
commit
f69b1db099
@ -1403,6 +1403,22 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
|
|||||||
Metadata: metadata("ffmpeg-library"),
|
Metadata: metadata("ffmpeg-library"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
logicalFixture: "elixir/1.19.1/linux-amd64",
|
||||||
|
expected: pkg.Package{
|
||||||
|
Name: "elixir",
|
||||||
|
Version: "1.19.1",
|
||||||
|
Type: "binary",
|
||||||
|
PURL: "pkg:generic/elixir@1.19.1",
|
||||||
|
Locations: locations("elixir", "lib/elixir/ebin/elixir.app"),
|
||||||
|
Metadata: pkg.BinarySignature{
|
||||||
|
Matches: []pkg.ClassifierMatch{
|
||||||
|
match("elixir-binary", "elixir"),
|
||||||
|
match("elixir-library", "lib/elixir/ebin/elixir.app"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
|||||||
@ -663,6 +663,26 @@ func DefaultClassifiers() []binutils.Classifier {
|
|||||||
PURL: mustPURL("pkg:generic/ffmpeg@version"),
|
PURL: mustPURL("pkg:generic/ffmpeg@version"),
|
||||||
CPEs: singleCPE("cpe:2.3:a:ffmpeg:ffmpeg:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource),
|
CPEs: singleCPE("cpe:2.3:a:ffmpeg:ffmpeg:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Class: "elixir-binary",
|
||||||
|
FileGlob: "**/elixir",
|
||||||
|
EvidenceMatcher: m.FileContentsVersionMatcher(
|
||||||
|
`(?m)ELIXIR_VERSION=(?P<version>[0-9]+\.[0-9]+\.[0-9]+)`),
|
||||||
|
Package: "elixir",
|
||||||
|
PURL: mustPURL("pkg:generic/elixir@version"),
|
||||||
|
CPEs: []cpe.CPE{
|
||||||
|
cpe.Must("cpe:2.3:a:elixir-lang:elixir:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Class: "elixir-library",
|
||||||
|
FileGlob: "**/elixir/ebin/elixir.app",
|
||||||
|
EvidenceMatcher: m.FileContentsVersionMatcher(
|
||||||
|
`(?m)\{vsn,"(?P<version>[0-9]+\.[0-9]+\.[0-9]+(-[a-z0-9]+)?)"\}`),
|
||||||
|
Package: "elixir",
|
||||||
|
PURL: mustPURL("pkg:generic/elixir@version"),
|
||||||
|
CPEs: singleCPE("cpe:2.3:a:elixir-lang:elixir:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return append(classifiers, defaultJavaClassifiers()...)
|
return append(classifiers, defaultJavaClassifiers()...)
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-FileCopyrightText: 2021 The Elixir Team
|
||||||
|
# SPDX-FileCopyrightText: 2012 Plataformatec
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
ELIXIR_VERSION=1.19.1
|
||||||
|
|
||||||
|
if [ $# -eq 0 ] || { [ $# -eq 1 ] && { [ "$1" = "--help" ] || [ "$1" = "-h" ]; }; }; then
|
||||||
|
cat <<USAGE >&2
|
||||||
|
Usage: $(basename "$0") [options] [.exs file] [data]
|
||||||
|
|
||||||
|
## General options
|
||||||
|
|
||||||
|
-e "COMMAND" Evaluates the given command (*)
|
||||||
|
-h, --help Prints this message (standalone)
|
||||||
|
-r "FILE" Requires the given files/patterns (*)
|
||||||
|
-S SCRIPT Finds and executes the given script in \$PATH
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
{application,elixir,
|
||||||
|
[{description,"elixir"},
|
||||||
|
{vsn,"1.19.1"},
|
||||||
|
{modules,
|
||||||
|
['Elixir.Access','Elixir.Agent.Server','Elixir.Agent',
|
||||||
|
'Elixir.Application','Elixir.ArgumentError',
|
||||||
|
elixir_overridable,elixir_parser,elixir_quote,elixir_rewrite,
|
||||||
|
elixir_sup,elixir_tokenizer,elixir_utils,iex]},
|
||||||
|
{registered,[elixir_sup,elixir_config,elixir_code_server]},
|
||||||
|
{applications,[kernel,stdlib,compiler]},
|
||||||
|
{mod,{elixir,[]}},
|
||||||
|
{env,
|
||||||
|
[{ansi_syntax_colors,
|
||||||
|
[{atom,cyan},
|
||||||
|
{binary,default_color},
|
||||||
|
{operator,default_color}]},
|
||||||
|
{check_endianness,true},
|
||||||
|
{dbg_callback,{'Elixir.Macro',dbg,[]}},
|
||||||
|
{time_zone_database,'Elixir.Calendar.UTCOnlyTimeZoneDatabase'}]}]}.
|
||||||
Loading…
x
Reference in New Issue
Block a user