Skip to content

Commit d838ff4

Browse files
ffontaineinosmeet
authored andcommitted
feat(checker): add jq checker (intel#3636)
Signed-off-by: Fabrice Fontaine <[email protected]>
1 parent 0e7e93f commit d838ff4

File tree

6 files changed

+48
-0
lines changed

6 files changed

+48
-0
lines changed

cve_bin_tool/checkers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
"jacksondatabind",
133133
"janus",
134134
"jhead",
135+
"jq",
135136
"json_c",
136137
"kbd",
137138
"keepalived",

cve_bin_tool/checkers/jq.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (C) 2023 Orange
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
5+
"""
6+
CVE checker for jq
7+
8+
https://www.cvedetails.com/product/33780/Jq-Project-JQ.html?vendor_id=15837
9+
https://www.cvedetails.com/product/166422/Jqlang-JQ.html?vendor_id=33921
10+
11+
"""
12+
from __future__ import annotations
13+
14+
from cve_bin_tool.checkers import Checker
15+
16+
17+
class JqChecker(Checker):
18+
CONTAINS_PATTERNS: list[str] = []
19+
FILENAME_PATTERNS: list[str] = []
20+
VERSION_PATTERNS = [r"([0-9]+\.[0-9]+)[a-zA-Z0-9:\-\r\n]*jq"]
21+
VENDOR_PRODUCT = [("jq_project", "jq"), ("jqlang", "jq")]
Binary file not shown.
Binary file not shown.
Binary file not shown.

test/test_data/jq.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright (C) 2023 Orange
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
mapping_test_data = [
5+
{"product": "jq", "version": "1.5", "version_strings": ["1.5\njq:"]}
6+
]
7+
package_test_data = [
8+
{
9+
"url": "http://rpmfind.net/linux/fedora/linux/development/rawhide/Everything/aarch64/os/Packages/j/",
10+
"package_name": "jq-1.6-17.fc39.aarch64.rpm",
11+
"product": "jq",
12+
"version": "1.6",
13+
},
14+
{
15+
"url": "http://ftp.fr.debian.org/debian/pool/main/j/jq/",
16+
"package_name": "jq_1.5+dfsg-2+b1_amd64.deb",
17+
"product": "jq",
18+
"version": "1.5",
19+
},
20+
{
21+
"url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/",
22+
"package_name": "jq_1.6-1_x86_64.ipk",
23+
"product": "jq",
24+
"version": "1.6",
25+
},
26+
]

0 commit comments

Comments
 (0)