mirror of
https://github.com/anchore/syft.git
synced 2026-05-20 04:05:24 +02:00
fix: consul classifier (#4741)
Signed-off-by: witchcraze <witchcraze@gmail.com>
This commit is contained in:
parent
9b58efed0c
commit
26175d74f8
@ -1111,6 +1111,28 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
|
||||
Metadata: metadata("consul-binary"),
|
||||
},
|
||||
},
|
||||
{
|
||||
logicalFixture: "consul/1.12.9/linux-amd64",
|
||||
expected: pkg.Package{
|
||||
Name: "consul",
|
||||
Version: "1.12.9",
|
||||
Type: "binary",
|
||||
PURL: "pkg:golang/github.com/hashicorp/consul@1.12.9",
|
||||
Locations: locations("consul"),
|
||||
Metadata: metadata("consul-binary"),
|
||||
},
|
||||
},
|
||||
{
|
||||
logicalFixture: "consul/1.7.14/linux-amd64",
|
||||
expected: pkg.Package{
|
||||
Name: "consul",
|
||||
Version: "1.7.14",
|
||||
Type: "binary",
|
||||
PURL: "pkg:golang/github.com/hashicorp/consul@1.7.14",
|
||||
Locations: locations("consul"),
|
||||
Metadata: metadata("consul-binary"),
|
||||
},
|
||||
},
|
||||
{
|
||||
logicalFixture: "vault/1.21.0-rc1/linux-amd64",
|
||||
expected: pkg.Package{
|
||||
|
||||
@ -468,9 +468,19 @@ func DefaultClassifiers() []binutils.Classifier {
|
||||
{
|
||||
Class: "consul-binary",
|
||||
FileGlob: "**/consul",
|
||||
EvidenceMatcher: m.FileContentsVersionMatcher(
|
||||
// NOTE: This is brittle and may not work for past or future versions
|
||||
`CONSUL_VERSION: (?P<version>\d+\.\d+\.\d+)`,
|
||||
EvidenceMatcher: binutils.MatchAny(
|
||||
m.FileContentsVersionMatcher(
|
||||
// NOTE: This is brittle and may not work for past or future versions
|
||||
`CONSUL_VERSION: (?P<version>\d+\.\d+\.\d+)`,
|
||||
),
|
||||
m.FileContentsVersionMatcher(
|
||||
// GitDescribe=1.12.9"
|
||||
`GitDescribe=(?P<version>\d+\.\d+\.\d+)\"`,
|
||||
),
|
||||
m.FileContentsVersionMatcher(
|
||||
// [NUL][NUL][NUL]v1.7.14[NUL][NUL][NUL]
|
||||
`\x00+v(?P<version>\d+\.\d+\.\d+)\x00+`,
|
||||
),
|
||||
),
|
||||
Package: "consul",
|
||||
PURL: mustPURL("pkg:golang/github.com/hashicorp/consul@version"),
|
||||
|
||||
14
syft/pkg/cataloger/binary/testdata/classifiers/snippets/consul/1.12.9/linux-amd64/consul
vendored
Normal file
14
syft/pkg/cataloger/binary/testdata/classifiers/snippets/consul/1.12.9/linux-amd64/consul
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
name: consul
|
||||
offset: 52534344
|
||||
length: 220
|
||||
snippetSha256: ca576f5ee181015359ecf2a2d3b7431593816d510cb1fd03014998128ebfd54c
|
||||
fileSha256: fc2840fe55664ccc8c197debca3a2f09e907ef0a55cbf3d239d8ea63f66fc96d
|
||||
|
||||
### byte snippet to follow ###
|
||||
|
||||
build -compiler=gc
|
||||
build -ldflags="-X github.com/hashicorp/consul/version.GitCommit=96505027 -X github.com/hashicorp/consul/version.GitDescribe=1.12.9"
|
||||
build CGO_ENABLED=0
|
||||
build GOARCH=amd64
|
||||
build GOOS=linux
|
||||
build GOAMD
|
||||
BIN
syft/pkg/cataloger/binary/testdata/classifiers/snippets/consul/1.7.14/linux-amd64/consul
vendored
Normal file
BIN
syft/pkg/cataloger/binary/testdata/classifiers/snippets/consul/1.7.14/linux-amd64/consul
vendored
Normal file
Binary file not shown.
14
syft/pkg/cataloger/binary/testdata/config.yaml
vendored
14
syft/pkg/cataloger/binary/testdata/config.yaml
vendored
@ -797,6 +797,20 @@ from-images:
|
||||
paths:
|
||||
- /bin/consul
|
||||
|
||||
- version: 1.12.9
|
||||
images:
|
||||
- ref: hashicorp/consul:1.12.9@sha256:609cce8f5e22953c89e284ca3a763e1dfff0bae6a6169e4e0a0ce23dce82faa2
|
||||
platform: linux/amd64
|
||||
paths:
|
||||
- /bin/consul
|
||||
|
||||
- version: 1.7.14
|
||||
images:
|
||||
- ref: hashicorp/consul:1.7.14@sha256:882bbcef624bd9b7d37228d891a5d9b2698be2a55b5a658fd1c4ffb643d1f30d
|
||||
platform: linux/amd64
|
||||
paths:
|
||||
- /bin/consul
|
||||
|
||||
- version: 1.21.0-rc1
|
||||
images:
|
||||
- ref: hashicorp/vault:1.21.0-rc1@sha256:67523b1e97acc26b050bb74abd251effe728bc3c1d7e80af19d251a511aa68ad
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user