Skip to content

Commit 2295848

Browse files
committed
fix: update jq checker
Update jq pattern to avoid false positives with the following strings: 0.2 jqPzsA Moreover, add a new pattern to detect jq 1.7.1 Signed-off-by: Fabrice Fontaine <[email protected]>
1 parent eb8da07 commit 2295848

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

cve_bin_tool/checkers/jq.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@
1717
class JqChecker(Checker):
1818
CONTAINS_PATTERNS: list[str] = []
1919
FILENAME_PATTERNS: list[str] = []
20-
VERSION_PATTERNS = [r"([0-9]+\.[0-9]+)[a-zA-Z0-9:\-\r\n]*jq"]
20+
VERSION_PATTERNS = [
21+
r"jq-([0-9]+\.[0-9]+\.[0-9]+)",
22+
r"([0-9]+\.[0-9]+)[a-zA-Z0-9:\-\r\n]*jq[ :]",
23+
]
2124
VENDOR_PRODUCT = [("jq_project", "jq"), ("jqlang", "jq")]
Binary file not shown.

test/test_data/jq.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# SPDX-License-Identifier: GPL-3.0-or-later
33

44
mapping_test_data = [
5-
{"product": "jq", "version": "1.5", "version_strings": ["1.5\njq:"]}
5+
{"product": "jq", "version": "1.5", "version_strings": ["1.5\njq:"]},
6+
{"product": "jq", "version": "1.7.1", "version_strings": ["jq-1.7.1"]},
67
]
78
package_test_data = [
89
{
@@ -17,6 +18,12 @@
1718
"product": "jq",
1819
"version": "1.5",
1920
},
21+
{
22+
"url": "http://ftp.fr.debian.org/debian/pool/main/j/jq/",
23+
"package_name": "jq_1.7.1-3_arm64.deb",
24+
"product": "jq",
25+
"version": "1.7.1",
26+
},
2027
{
2128
"url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/",
2229
"package_name": "jq_1.6-1_x86_64.ipk",

0 commit comments

Comments
 (0)