From 5466705adb7d38a72eac47d926c60685f89f7729 Mon Sep 17 00:00:00 2001 From: Shane Dell Date: Fri, 14 Apr 2023 11:01:08 -0400 Subject: [PATCH] Create consul binary classifier Closes #1590 Signed-off-by: Shane Dell --- syft/pkg/cataloger/binary/default_classifiers.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/syft/pkg/cataloger/binary/default_classifiers.go b/syft/pkg/cataloger/binary/default_classifiers.go index a80f9676fdf7..a2fc0334d339 100644 --- a/syft/pkg/cataloger/binary/default_classifiers.go +++ b/syft/pkg/cataloger/binary/default_classifiers.go @@ -270,6 +270,15 @@ var defaultClassifiers = []classifier{ PURL: mustPURL("pkg:generic/ruby@version"), CPEs: singleCPE("cpe:2.3:a:ruby-lang:ruby:*:*:*:*:*:*:*:*"), }, + { + Class: "consul-binary", + FileGlob: "**/consul", + EvidenceMatcher: fileContentsVersionMatcher( + `(?m)consul(?P[0-9]+\.[0-9]+(\.[0-9]+|beta[0-9]+|alpha[0-9]+|rc[0-9]+)?)\x00`), + Package: "consul", + PURL: mustPURL("pkg:golang/github.com/hashicorp/consul@version"), + CPEs: singleCPE("cpe:2.3:a:hashicorp:consul:*:*:*:*:*:*:*:*"), + }, } // in both binaries and shared libraries, the version pattern is [NUL]3.11.2[NUL]