diff --git a/cve_bin_tool/checkers/__init__.py b/cve_bin_tool/checkers/__init__.py index c1b9387a0b..a5f85a4703 100644 --- a/cve_bin_tool/checkers/__init__.py +++ b/cve_bin_tool/checkers/__init__.py @@ -44,6 +44,7 @@ "collectd", "commons_compress", "connman", + "coreutils", "cpio", "cronie", "cryptsetup", diff --git a/cve_bin_tool/checkers/coreutils.py b/cve_bin_tool/checkers/coreutils.py new file mode 100644 index 0000000000..8a1af68deb --- /dev/null +++ b/cve_bin_tool/checkers/coreutils.py @@ -0,0 +1,23 @@ +# Copyright (C) 2023 Orange +# SPDX-License-Identifier: GPL-3.0-or-later + + +""" +CVE checker for coreutils + +https://www.cvedetails.com/product/5075/GNU-Coreutils.html?vendor_id=72 + +""" +from __future__ import annotations + +from cve_bin_tool.checkers import Checker + + +class CoreutilsChecker(Checker): + CONTAINS_PATTERNS: list[str] = [] + FILENAME_PATTERNS: list[str] = [] + VERSION_PATTERNS = [ + r"coreutils-([0-9]+\.[0-9]+)", + r"coreutils[a-zA-Z0-9:%'<>_/=!, \.\-\(\)\r\n]*\r?\n([0-9]+\.[0-9]+)", + ] + VENDOR_PRODUCT = [("gnu", "coreutils")] diff --git a/test/condensed-downloads/coreutils-9.3-1.2.i586.rpm.tar.gz b/test/condensed-downloads/coreutils-9.3-1.2.i586.rpm.tar.gz new file mode 100644 index 0000000000..2f0e418657 Binary files /dev/null and b/test/condensed-downloads/coreutils-9.3-1.2.i586.rpm.tar.gz differ diff --git a/test/condensed-downloads/coreutils-base64_8.30-2_x86_64.ipk.tar.gz b/test/condensed-downloads/coreutils-base64_8.30-2_x86_64.ipk.tar.gz new file mode 100644 index 0000000000..94c3af9a0d Binary files /dev/null and b/test/condensed-downloads/coreutils-base64_8.30-2_x86_64.ipk.tar.gz differ diff --git a/test/condensed-downloads/coreutils_8.30-3_amd64.deb.tar.gz b/test/condensed-downloads/coreutils_8.30-3_amd64.deb.tar.gz new file mode 100644 index 0000000000..28a5f1412f Binary files /dev/null and b/test/condensed-downloads/coreutils_8.30-3_amd64.deb.tar.gz differ diff --git a/test/test_data/coreutils.py b/test/test_data/coreutils.py new file mode 100644 index 0000000000..fcd78ddf10 --- /dev/null +++ b/test/test_data/coreutils.py @@ -0,0 +1,27 @@ +# Copyright (C) 2023 Orange +# SPDX-License-Identifier: GPL-3.0-or-later + +mapping_test_data = [ + {"product": "coreutils", "version": "8.30", "version_strings": ["coreutils-8.30"]}, + {"product": "coreutils", "version": "8.30", "version_strings": ["coreutils\n8.30"]}, +] +package_test_data = [ + { + "url": "http://rpmfind.net/linux/opensuse/ports/i586/tumbleweed/repo/oss/i586/", + "package_name": "coreutils-9.3-1.2.i586.rpm", + "product": "coreutils", + "version": "9.3", + }, + { + "url": "http://ftp.fr.debian.org/debian/pool/main/c/coreutils/", + "package_name": "coreutils_8.30-3_amd64.deb", + "product": "coreutils", + "version": "8.30", + }, + { + "url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/", + "package_name": "coreutils-base64_8.30-2_x86_64.ipk", + "product": "coreutils", + "version": "8.30", + }, +]