mirror of
https://github.com/anchore/syft
synced 2024-11-13 23:57:07 +00:00
Create consul binary classifier (#1738)
* Create consul binary classifier Closes #1590 Signed-off-by: Shane Dell <shanedell100@gmail.com> * Create test for consul binary classifier Signed-off-by: Shane Dell <shanedell100@gmail.com> * Update version for consul. Add note that about consul version matcher is brittle Signed-off-by: Shane Dell <shanedell100@gmail.com> --------- Signed-off-by: Shane Dell <shanedell100@gmail.com>
This commit is contained in:
parent
95176d7e0c
commit
244b797a19
3 changed files with 32 additions and 1 deletions
|
@ -714,6 +714,18 @@ func Test_Cataloger_DefaultClassifiers_PositiveCases(t *testing.T) {
|
||||||
Metadata: metadata("ruby-binary"),
|
Metadata: metadata("ruby-binary"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "positive-consul-1.15.2",
|
||||||
|
fixtureDir: "test-fixtures/classifiers/dynamic/consul-1.15.2",
|
||||||
|
expected: pkg.Package{
|
||||||
|
Name: "consul",
|
||||||
|
Version: "1.15.2",
|
||||||
|
Type: "binary",
|
||||||
|
PURL: "pkg:golang/github.com/hashicorp/consul@1.15.2",
|
||||||
|
Locations: locations("consul"),
|
||||||
|
Metadata: metadata("consul-binary"),
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
|
|
@ -270,6 +270,17 @@ var defaultClassifiers = []classifier{
|
||||||
PURL: mustPURL("pkg:generic/ruby@version"),
|
PURL: mustPURL("pkg:generic/ruby@version"),
|
||||||
CPEs: singleCPE("cpe:2.3:a:ruby-lang:ruby:*:*:*:*:*:*:*:*"),
|
CPEs: singleCPE("cpe:2.3:a:ruby-lang:ruby:*:*:*:*:*:*:*:*"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Class: "consul-binary",
|
||||||
|
FileGlob: "**/consul",
|
||||||
|
EvidenceMatcher: fileContentsVersionMatcher(
|
||||||
|
// NOTE: This is brittle and may not work for past or future versions
|
||||||
|
`CONSUL_VERSION: (?P<version>\d+\.\d+\.\d+)`,
|
||||||
|
),
|
||||||
|
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]
|
// in both binaries and shared libraries, the version pattern is [NUL]3.11.2[NUL]
|
||||||
|
|
|
@ -15,7 +15,9 @@ all: \
|
||||||
classifiers/dynamic/kubectl-1.25.7 \
|
classifiers/dynamic/kubectl-1.25.7 \
|
||||||
classifiers/dynamic/kubectl-1.26.2 \
|
classifiers/dynamic/kubectl-1.26.2 \
|
||||||
classifiers/dynamic/kustomize-4.5.7 \
|
classifiers/dynamic/kustomize-4.5.7 \
|
||||||
classifiers/dynamic/kustomize-5.0.0
|
classifiers/dynamic/kustomize-5.0.0 \
|
||||||
|
classifiers/dynamic/consul-1.15.2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
classifiers/dynamic/python-binary-shared-lib-3.11:
|
classifiers/dynamic/python-binary-shared-lib-3.11:
|
||||||
|
@ -141,6 +143,12 @@ classifiers/dynamic/kustomize-5.0.0:
|
||||||
/usr/local/bin/kustomize \
|
/usr/local/bin/kustomize \
|
||||||
$@/kustomize
|
$@/kustomize
|
||||||
|
|
||||||
|
classifiers/dynamic/consul-1.15.2:
|
||||||
|
$(eval $@_image := "hashicorp/consul:1.15.2@sha256:c2169f3bb18dd947ae8eb5f6766896695c71fb439f050a3343e0007d895615b8")
|
||||||
|
./get-image-file.sh $($@_image) \
|
||||||
|
/bin/consul \
|
||||||
|
$@/consul
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -rf classifiers/dynamic
|
rm -rf classifiers/dynamic
|
||||||
|
|
Loading…
Reference in a new issue