Skip to content

Commit

Permalink
feat: detect jq binaries
Browse files Browse the repository at this point in the history
Signed-off-by: Krystian Gorny <[email protected]>
  • Loading branch information
Krystian Gorny committed Sep 19, 2024
1 parent 2b1370b commit a059939
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions syft/pkg/cataloger/binary/classifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,16 @@ func DefaultClassifiers() []Classifier {
PURL: mustPURL("pkg:generic/sqlcipher@version"),
CPEs: singleCPE("cpe:2.3:a:zetetic:sqlcipher:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource),
},
{
Class: "jq-binary",
FileGlob: "**/jq",
EvidenceMatcher: FileContentsVersionMatcher(
`\x00(?P<version>[0-9]{1,3}\.[0-9]{1,3}(\.[0-9]+)?)\x00`,
),
Package: "jq",
PURL: mustPURL("pkg:generic/jq@version"),
CPEs: singleCPE("cpe:2.3:a:jqlang:jq:*:*:*:*:*:*:*:*", cpe.NVDDictionaryLookupSource),
},
}
}

Expand Down
7 changes: 7 additions & 0 deletions syft/pkg/cataloger/binary/test-fixtures/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -658,3 +658,10 @@ from-images:
paths:
- /usr/local/bin/sqlcipher

- name: jq
version: 1.7.1
images:
- ref: efrecon/jq:1.7.1@sha256:0ad05e2e6d1dea5fe0852ecc23114eb768d60c4ce0985d729eb958809e7f31dd
platform: linux/amd64
paths:
- /usr/local/bin/jq

0 comments on commit a059939

Please sign in to comment.