mirror of
https://github.com/anchore/syft.git
synced 2026-11-01 23:16:30 +01:00
binary classifier: detect elixir release-candidate versions (#4851)
The elixir-binary and elixir-library classifiers' regexes only matched the bare semver triplet (and a single sub-segment for the library), so release-candidate elixir images were either missed entirely or had their version truncated: $ syft -q elixir:1.12.0-rc | grep elixir # nothing $ syft -q elixir:1.13.0-rc.0 | grep elixir elixir 1.13.0 binary # truncated, "-rc.0" lost Extend the version capture group to optionally include "-<a-z0-9>+(\\.<digits>)?" so "1.12.0-rc.1", "1.13.0-rc.0", etc. match exactly as the elixir.app and the binary's ELIXIR_VERSION line have them. Add a logical fixture under testdata/classifiers/snippets/elixir/ 1.12.0-rc.1/linux-amd64 (cloned from the existing 1.19.1 fixture with just the version strings changed) and register it in Test_Cataloger_PositiveCases. Closes #4819 Signed-off-by: Chris (ChrisJr404) <11917633+ChrisJr404@users.noreply.github.com> Co-authored-by: Chris (ChrisJr404) <11917633+ChrisJr404@users.noreply.github.com>
This commit is contained in:
@@ -1754,6 +1754,25 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
// release-candidate elixir image — pre-fix the matchers stripped the
|
||||
// "-rc.1" suffix from the elixir-library result and missed the
|
||||
// elixir-binary entirely (#4819).
|
||||
logicalFixture: "elixir/1.12.0-rc.1/linux-amd64",
|
||||
expected: pkg.Package{
|
||||
Name: "elixir",
|
||||
Version: "1.12.0-rc.1",
|
||||
Type: "binary",
|
||||
PURL: "pkg:generic/elixir@1.12.0-rc.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"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
logicalFixture: "istio_pilot-discovery/1.29.0-alpha.0/linux-amd64",
|
||||
expected: pkg.Package{
|
||||
|
||||
Reference in New Issue
Block a user