diff --git a/cve_bin_tool/checkers/__init__.py b/cve_bin_tool/checkers/__init__.py index 7d7f8ecab1..907ebe7d7e 100644 --- a/cve_bin_tool/checkers/__init__.py +++ b/cve_bin_tool/checkers/__init__.py @@ -263,6 +263,7 @@ "privoxy", "procps_ng", "proftpd", + "protobuf_c", "pspp", "pure_ftpd", "putty", diff --git a/cve_bin_tool/checkers/protobuf_c.py b/cve_bin_tool/checkers/protobuf_c.py new file mode 100644 index 0000000000..087194f083 --- /dev/null +++ b/cve_bin_tool/checkers/protobuf_c.py @@ -0,0 +1,22 @@ +# Copyright (C) 2023 Orange +# SPDX-License-Identifier: GPL-3.0-or-later + + +""" +CVE checker for protobuf-c + +https://www.cvedetails.com/product/116953/Protobuf-c-Project-Protobuf-c.html?vendor_id=27533 + +""" +from __future__ import annotations + +from cve_bin_tool.checkers import Checker + + +class ProtobufCChecker(Checker): + CONTAINS_PATTERNS: list[str] = [] + FILENAME_PATTERNS: list[str] = [] + VERSION_PATTERNS = [ + r"protobuf-c[a-zA-Z0-9@`&_:.()<>= \-\t\r\n]*\r?\n([0-9]+\.[0-9]+\.[0-9]+)" + ] + VENDOR_PRODUCT = [("protobuf-c_project", "protobuf-c")] diff --git a/test/condensed-downloads/libprotobuf-c1_1.3.1-1+b1_amd64.deb.tar.gz b/test/condensed-downloads/libprotobuf-c1_1.3.1-1+b1_amd64.deb.tar.gz new file mode 100644 index 0000000000..40bc27c1a6 Binary files /dev/null and b/test/condensed-downloads/libprotobuf-c1_1.3.1-1+b1_amd64.deb.tar.gz differ diff --git a/test/condensed-downloads/libprotobuf-c_1.3.1-2_x86_64.ipk.tar.gz b/test/condensed-downloads/libprotobuf-c_1.3.1-2_x86_64.ipk.tar.gz new file mode 100644 index 0000000000..f37e3e5af4 Binary files /dev/null and b/test/condensed-downloads/libprotobuf-c_1.3.1-2_x86_64.ipk.tar.gz differ diff --git a/test/condensed-downloads/protobuf-c-1.4.1-4.fc38.aarch64.rpm.tar.gz b/test/condensed-downloads/protobuf-c-1.4.1-4.fc38.aarch64.rpm.tar.gz new file mode 100644 index 0000000000..086eb13f01 Binary files /dev/null and b/test/condensed-downloads/protobuf-c-1.4.1-4.fc38.aarch64.rpm.tar.gz differ diff --git a/test/test_data/protobuf_c.py b/test/test_data/protobuf_c.py new file mode 100644 index 0000000000..22ffaf2dff --- /dev/null +++ b/test/test_data/protobuf_c.py @@ -0,0 +1,30 @@ +# Copyright (C) 2023 Orange +# SPDX-License-Identifier: GPL-3.0-or-later + +mapping_test_data = [ + { + "product": "protobuf-c", + "version": "1.3.1", + "version_strings": ["protobuf-c\n1.3.1"], + } +] +package_test_data = [ + { + "url": "http://rpmfind.net/linux/fedora/linux/development/rawhide/Everything/aarch64/os/Packages/p/", + "package_name": "protobuf-c-1.4.1-4.fc38.aarch64.rpm", + "product": "protobuf-c", + "version": "1.4.1", + }, + { + "url": "http://ftp.fr.debian.org/debian/pool/main/p/protobuf-c/", + "package_name": "libprotobuf-c1_1.3.1-1+b1_amd64.deb", + "product": "protobuf-c", + "version": "1.3.1", + }, + { + "url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/", + "package_name": "libprotobuf-c_1.3.1-2_x86_64.ipk", + "product": "protobuf-c", + "version": "1.3.1", + }, +] diff --git a/test/test_data/sudo.py b/test/test_data/sudo.py index 209d2c65b4..bc2c4692d5 100644 --- a/test/test_data/sudo.py +++ b/test/test_data/sudo.py @@ -28,6 +28,7 @@ "package_name": "sudo-1.9.5p2-1.5.x86_64.rpm", "product": "sudo", "version": "1.9.5p2", + "other_products": ["protobuf-c"], }, { "url": "http://ftp.fr.debian.org/debian/pool/main/s/sudo/",