Add haskell binaries cataloger (#3078)

Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
This commit is contained in:
Laurent Goderre 2024-09-10 10:58:20 -04:00 committed by GitHub
parent fce14fd537
commit dbc4238f63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 68 additions and 0 deletions

View file

@ -961,6 +961,28 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
Metadata: metadata("swipl-binary"), Metadata: metadata("swipl-binary"),
}, },
}, },
{
logicalFixture: "haskell-ghc/9.6.5/linux-amd64",
expected: pkg.Package{
Name: "haskell/ghc",
Version: "9.6.5",
Type: "binary",
PURL: "pkg:generic/haskell/ghc@9.6.5",
Locations: locations("ghc-9.6.5"),
Metadata: metadata("haskell-ghc-binary"),
},
},
{
logicalFixture: "haskell-cabal/3.10.3.0/linux-amd64",
expected: pkg.Package{
Name: "haskell/cabal",
Version: "3.10.3.0",
Type: "binary",
PURL: "pkg:generic/haskell/cabal@3.10.3.0",
Locations: locations("cabal"),
Metadata: metadata("haskell-cabal-binary"),
},
},
{ {
logicalFixture: "nginx/1.25.1/linux-amd64", logicalFixture: "nginx/1.25.1/linux-amd64",
expected: pkg.Package{ expected: pkg.Package{

View file

@ -447,6 +447,36 @@ func DefaultClassifiers() []Classifier {
PURL: mustPURL("pkg:generic/swipl@version"), PURL: mustPURL("pkg:generic/swipl@version"),
CPEs: singleCPE("cpe:2.3:a:erlang:erlang\\/otp:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource), CPEs: singleCPE("cpe:2.3:a:erlang:erlang\\/otp:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource),
}, },
{
Class: "haskell-ghc-binary",
FileGlob: "**/ghc*",
EvidenceMatcher: FileContentsVersionMatcher(
`(?m)\x00GHC (?P<version>[0-9]+\.[0-9]+\.[0-9]+)\x00`,
),
Package: "haskell/ghc",
PURL: mustPURL("pkg:generic/haskell/ghc@version"),
CPEs: singleCPE("cpe:2.3:a:haskell:ghc:*:*:*:*:*:*:*:*"),
},
{
Class: "haskell-cabal-binary",
FileGlob: "**/cabal",
EvidenceMatcher: FileContentsVersionMatcher(
`(?m)\x00Cabal-(?P<version>[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?)-`,
),
Package: "haskell/cabal",
PURL: mustPURL("pkg:generic/haskell/cabal@version"),
CPEs: singleCPE("cpe:2.3:a:haskell:cabal:*:*:*:*:*:*:*:*"),
},
{
Class: "haskell-stack-binary",
FileGlob: "**/stack",
EvidenceMatcher: FileContentsVersionMatcher(
`(?m)Version\s*(?P<version>[0-9]+\.[0-9]+\.[0-9]+),\s*Git`,
),
Package: "haskell/stack",
PURL: mustPURL("pkg:generic/haskell/stack@version"),
CPEs: singleCPE("cpe:2.3:a:haskell:stack:*:*:*:*:*:*:*:*"),
},
{ {
Class: "consul-binary", Class: "consul-binary",
FileGlob: "**/consul", FileGlob: "**/consul",

View file

@ -78,6 +78,22 @@ from-images:
paths: paths:
- /usr/lib/swipl/bin/x86_64-linux/swipl - /usr/lib/swipl/bin/x86_64-linux/swipl
- name: haskell-ghc
version: 9.6.5
images:
- ref: haskell:9.6.5-slim-buster@sha256:04a7293eb792b82335dffa7f08532657517ed9b4f01d52c1b499ad22deb3c6b1
platform: linux/amd64
paths:
- /opt/ghc/9.6.5/lib/ghc-9.6.5/bin/ghc-9.6.5
- name: haskell-cabal
version: 3.10.3.0
images:
- ref: haskell:9.6.5-slim-buster@sha256:04a7293eb792b82335dffa7f08532657517ed9b4f01d52c1b499ad22deb3c6b1
platform: linux/amd64
paths:
- /usr/local/bin/cabal
- version: 1.21.3 - version: 1.21.3
images: images:
- ref: golang:1.21.3@sha256:3ce8313c3513515040870c55e0c041a2b94f3576a58cfd3948633604214aa811 - ref: golang:1.21.3@sha256:3ce8313c3513515040870c55e0c041a2b94f3576a58cfd3948633604214aa811