From 7a35de04ee9537fe4ba6cfc57dc04c68d16a014a Mon Sep 17 00:00:00 2001 From: Laurent Goderre Date: Thu, 20 Jun 2024 11:11:03 -0400 Subject: [PATCH] fix: detection of arangodb 3.12 (#2979) Signed-off-by: Laurent Goderre --- .../cataloger/binary/classifier_cataloger_test.go | 11 +++++++++++ syft/pkg/cataloger/binary/classifiers.go | 2 +- .../arangodb/3.12.0-2/linux-amd64/arangosh | Bin 0 -> 351 bytes .../cataloger/binary/test-fixtures/config.yaml | 7 +++++++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/arangodb/3.12.0-2/linux-amd64/arangosh diff --git a/syft/pkg/cataloger/binary/classifier_cataloger_test.go b/syft/pkg/cataloger/binary/classifier_cataloger_test.go index e0f71998d..595bbd0f6 100644 --- a/syft/pkg/cataloger/binary/classifier_cataloger_test.go +++ b/syft/pkg/cataloger/binary/classifier_cataloger_test.go @@ -48,6 +48,17 @@ func Test_Cataloger_PositiveCases(t *testing.T) { Metadata: metadata("arangodb-binary"), }, }, + { + logicalFixture: "arangodb/3.12.0-2/linux-amd64", + expected: pkg.Package{ + Name: "arangodb", + Version: "3.12.0-2", + Type: "binary", + PURL: "pkg:generic/arangodb@3.12.0-2", + Locations: locations("arangosh"), + Metadata: metadata("arangodb-binary"), + }, + }, { logicalFixture: "postgres/15beta4/linux-amd64", expected: pkg.Package{ diff --git a/syft/pkg/cataloger/binary/classifiers.go b/syft/pkg/cataloger/binary/classifiers.go index 229c51339..fb17f0ff2 100644 --- a/syft/pkg/cataloger/binary/classifiers.go +++ b/syft/pkg/cataloger/binary/classifiers.go @@ -272,7 +272,7 @@ func DefaultClassifiers() []Classifier { Class: "arangodb-binary", FileGlob: "**/arangosh", EvidenceMatcher: FileContentsVersionMatcher( - `(?m)ArangoDB\s\x00*(?P[0-9]+\.[0-9]+\.[0-9]+)\s\[linux\]`), + `(?m)\x00*(?P[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+)?)\s\[linux\]`), Package: "arangodb", PURL: mustPURL("pkg:generic/arangodb@version"), CPEs: singleCPE("cpe:2.3:a:arangodb:arangodb:*:*:*:*:*:*:*:*"), diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/arangodb/3.12.0-2/linux-amd64/arangosh b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/arangodb/3.12.0-2/linux-amd64/arangosh new file mode 100644 index 0000000000000000000000000000000000000000..da68e07d810738691bb737e902a8964cca69a545 GIT binary patch literal 351 zcmXxeyH3O~6a-M$`3g(hK#|CAI}sff9ReW=L~(6jZ;V15CEjKC?+FOnGn&!N@QDM3 z73O2v#-^mSVI8OzTru8EI3MdcP%c=r&3Rd{K93-@8K?u{c<_-a-U|p!D=A;P05sZu+Qb<0^-UoEjFwvwu;s2ObXuMZkI;D+8D}z?D=axtCy+s*4?&y+b zd}oePrzk?OAWW2wrKUL?4%A;O(!ZOu7MjX5l`pzSO~*yYIzfLL!Whtr5&4U)pl?&2 zPnUP{aQ{L{+kU_qwy@@!XsWDA+JOx$0PB1 OhV}Zo=889WTm1%jxn?y0 literal 0 HcmV?d00001 diff --git a/syft/pkg/cataloger/binary/test-fixtures/config.yaml b/syft/pkg/cataloger/binary/test-fixtures/config.yaml index 3930bfe39..559b36e63 100644 --- a/syft/pkg/cataloger/binary/test-fixtures/config.yaml +++ b/syft/pkg/cataloger/binary/test-fixtures/config.yaml @@ -285,6 +285,13 @@ from-images: platform: linux/amd64 paths: - /usr/bin/arangosh + - name: arangodb + version: 3.12.0-2 + images: + - ref: arangodb:3.12.0.2@sha256:6ba2e4284cd0f4835e3ef034be90fb947c3d61225d65d07e3b2d2d893e47de25 + platform: linux/amd64 + paths: + - /usr/bin/arangosh - version: 15.1 images: - ref: postgres:15.1@sha256:b4140dd3a62f364f16a82c1bd88d28b9887ecb47f07dbe2941237d073574d428