diff --git a/syft/pkg/cataloger/binary/capabilities.yaml b/syft/pkg/cataloger/binary/capabilities.yaml index 6a1ef1d2d..baebe2c93 100644 --- a/syft/pkg/cataloger/binary/capabilities.yaml +++ b/syft/pkg/cataloger/binary/capabilities.yaml @@ -342,6 +342,16 @@ catalogers: cpes: - cpe:2.3:a:dart:dart_software_development_kit:*:*:*:*:*:*:*:* type: BinaryPkg + - method: glob + criteria: + - '**/deno' + packages: + - class: deno-binary + name: deno + purl: pkg:generic/deno + cpes: + - cpe:2.3:a:deno:deno:*:*:*:*:*:*:*:* + type: BinaryPkg - method: glob criteria: - '**/ghc*' diff --git a/syft/pkg/cataloger/binary/classifier_cataloger_test.go b/syft/pkg/cataloger/binary/classifier_cataloger_test.go index bc49f22b3..b17a4e08c 100644 --- a/syft/pkg/cataloger/binary/classifier_cataloger_test.go +++ b/syft/pkg/cataloger/binary/classifier_cataloger_test.go @@ -1254,6 +1254,39 @@ func Test_Cataloger_PositiveCases(t *testing.T) { Metadata: metadata("dart-binary"), }, }, + { + logicalFixture: "deno/1.41.0/linux-amd64", + expected: pkg.Package{ + Name: "deno", + Version: "1.41.0", + Type: "binary", + PURL: "pkg:generic/deno@1.41.0", + Locations: locations("deno"), + Metadata: metadata("deno-binary"), + }, + }, + { + logicalFixture: "deno/2.0.0/linux-amd64", + expected: pkg.Package{ + Name: "deno", + Version: "2.0.0", + Type: "binary", + PURL: "pkg:generic/deno@2.0.0", + Locations: locations("deno"), + Metadata: metadata("deno-binary"), + }, + }, + { + logicalFixture: "deno/2.6.3/linux-amd64", + expected: pkg.Package{ + Name: "deno", + Version: "2.6.3", + Type: "binary", + PURL: "pkg:generic/deno@2.6.3", + Locations: locations("deno"), + Metadata: metadata("deno-binary"), + }, + }, { logicalFixture: "haskell-ghc/9.6.5/linux-amd64", expected: pkg.Package{ diff --git a/syft/pkg/cataloger/binary/classifiers.go b/syft/pkg/cataloger/binary/classifiers.go index 4f394828e..35acc85f1 100644 --- a/syft/pkg/cataloger/binary/classifiers.go +++ b/syft/pkg/cataloger/binary/classifiers.go @@ -424,6 +424,17 @@ func DefaultClassifiers() []binutils.Classifier { PURL: mustPURL("pkg:generic/dart@version"), CPEs: singleCPE("cpe:2.3:a:dart:dart_software_development_kit:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource), }, + { + Class: "deno-binary", + FileGlob: "**/deno", + EvidenceMatcher: m.FileContentsVersionMatcher( + // Deno/2.6.3 + // Deno/1.41.0 + `Deno/(?P[0-9]+\.[0-9]+\.[0-9]+)`), + Package: "deno", + PURL: mustPURL("pkg:generic/deno@version"), + CPEs: singleCPE("cpe:2.3:a:deno:deno:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource), + }, { Class: "haskell-ghc-binary", FileGlob: "**/ghc*", diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/deno/1.41.0/linux-amd64/deno b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/deno/1.41.0/linux-amd64/deno new file mode 100644 index 000000000..bb92bb27e --- /dev/null +++ b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/deno/1.41.0/linux-amd64/deno @@ -0,0 +1,9 @@ +name: deno +offset: 17775514 +length: 100 +snippetSha256: 1bf995efbcf158531b2cde0a0213b348e189550a45d1db127b54eded4c520d0a +fileSha256: b0877de86c74027327fca3ca37a5ac3780bcc9c70579ecf6c7c9a55d22147aef + +### byte snippet to follow ### +t recognize flag '' +Deno/1.41.0cli/worker.rsmain_module deno::worker[ext:cli/worker.rs:191:37][ext:c \ No newline at end of file diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/deno/2.0.0/linux-amd64/deno b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/deno/2.0.0/linux-amd64/deno new file mode 100644 index 000000000..336c010ad --- /dev/null +++ b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/deno/2.0.0/linux-amd64/deno @@ -0,0 +1,8 @@ +name: deno +offset: 19199775 +length: 100 +snippetSha256: a5411a3e2856c4351f97e9d5f50f78227da85640f50e436913b0bcb0f12d3216 +fileSha256: 097ca199e64f5cd67318cdd3750ab3da9374edeaa205032b74c905f8c99901a6 + +### byte snippet to follow ### +denover2.0.0+a62c7e0Deno/2.0.0Deno/2.0.0+a62c7e0a62c7e036ab6851c0293f407ead635a7331445b75.6.2cli/wor \ No newline at end of file diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/deno/2.6.3/linux-amd64/deno b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/deno/2.6.3/linux-amd64/deno new file mode 100644 index 000000000..eb893b072 --- /dev/null +++ b/syft/pkg/cataloger/binary/test-fixtures/classifiers/snippets/deno/2.6.3/linux-amd64/deno @@ -0,0 +1,8 @@ +name: deno +offset: 21186310 +length: 100 +snippetSha256: b6dd3f1b71effaba81c4d1aa77a7769d1cafbd5857564e2f3529e293c7f0db80 +fileSha256: 644b733f21383c5eea7b27dcb5d81c3e2a94d18287c6b11e9771335b51e8438d + +### byte snippet to follow ### +ts2.6.32.6.3+3fbb1daDeno/2.6.3Deno/2.6.3+3fbb1da3fbb1daddbc9333cddf0d8c0735811717dd70f7a5.9.2Missing \ No newline at end of file diff --git a/syft/pkg/cataloger/binary/testdata/config.yaml b/syft/pkg/cataloger/binary/testdata/config.yaml index cbf3d71f1..1edf43698 100644 --- a/syft/pkg/cataloger/binary/testdata/config.yaml +++ b/syft/pkg/cataloger/binary/testdata/config.yaml @@ -123,6 +123,30 @@ from-images: paths: - /usr/lib/dart/bin/dart + - name: deno + version: 1.41.0 + images: + - ref: denoland/deno:1.41.0 + platform: linux/amd64 + paths: + - /usr/bin/deno + + - name: deno + version: 2.0.0 + images: + - ref: denoland/deno:2.0.0 + platform: linux/amd64 + paths: + - /usr/bin/deno + + - name: deno + version: 2.6.3 + images: + - ref: denoland/deno:2.6.3 + platform: linux/amd64 + paths: + - /usr/bin/deno + - name: haskell-ghc version: 9.6.5 images: