Skip to content

Commit 62941eb

Browse files
ffontaineterriko
andauthored
feat(checker): add xz checker (#4728)
Signed-off-by: Fabrice Fontaine <[email protected]> Co-authored-by: Terri Oda <[email protected]>
1 parent 56a5fc7 commit 62941eb

9 files changed

+68
-0
lines changed

cve_bin_tool/checkers/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@
385385
"xml2",
386386
"xscreensaver",
387387
"xwayland",
388+
"xz",
388389
"yasm",
389390
"zabbix",
390391
"zchunk",

cve_bin_tool/checkers/xz.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright (C) 2025 Orange
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
5+
"""
6+
CVE checker for xz
7+
8+
https://www.cvedetails.com/product/38995/Tukaani-XZ.html?vendor_id=16730
9+
10+
"""
11+
from __future__ import annotations
12+
13+
from cve_bin_tool.checkers import Checker
14+
15+
16+
class XzChecker(Checker):
17+
CONTAINS_PATTERNS: list[str] = []
18+
FILENAME_PATTERNS: list[str] = []
19+
VERSION_PATTERNS = [
20+
r"xz \(XZ Utils\) ([0-9]+\.[0-9]+\.[0-9]+)",
21+
r"([0-9]+\.[0-9]+\.[0-9]+)[A-Za-z0-9,'_=:*&!? \-\.\[\]\"\(\)\r\n]*7zXZ[a-zA-z0-9\r\n]* @@@",
22+
]
23+
VENDOR_PRODUCT = [("tukaani", "xz")]
Binary file not shown.
Binary file not shown.
7.56 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

test/test_data/xz.py

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright (C) 2025 Orange
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
mapping_test_data = [
5+
{"product": "xz", "version": "5.2.5", "version_strings": ["xz (XZ Utils) 5.2.5"]}
6+
]
7+
package_test_data = [
8+
{
9+
"url": "http://rpmfind.net/linux/fedora/linux/development/rawhide/Everything/aarch64/os/Packages/x/",
10+
"package_name": "xz-5.6.3-3.fc42.aarch64.rpm",
11+
"product": "xz",
12+
"version": "5.6.3",
13+
},
14+
{
15+
"url": "http://ftp.fr.debian.org/debian/pool/main/x/xz-utils/",
16+
"package_name": "xz-utils_5.2.4-1+deb10u1_amd64.deb",
17+
"product": "xz",
18+
"version": "5.2.4",
19+
},
20+
{
21+
"url": "http://ftp.fr.debian.org/debian/pool/main/x/xz-utils/",
22+
"package_name": "liblzma5_5.6.3-1+b1_arm64.deb",
23+
"product": "xz",
24+
"version": "5.6.3",
25+
},
26+
{
27+
"url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/",
28+
"package_name": "xz_5.2.5-1_x86_64.ipk",
29+
"product": "xz",
30+
"version": "5.2.5",
31+
},
32+
{
33+
"url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/",
34+
"package_name": "liblzma_5.2.5-1_x86_64.ipk",
35+
"product": "xz",
36+
"version": "5.2.5",
37+
},
38+
{
39+
"url": "https://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/",
40+
"package_name": "xz-5.2.4-r0.apk",
41+
"product": "xz",
42+
"version": "5.2.4",
43+
},
44+
]

0 commit comments

Comments
 (0)