Skip to content

Commit 5bc97bb

Browse files
committed
feat(checker): add protobuf-c checker
Signed-off-by: Fabrice Fontaine <[email protected]>
1 parent 098a96f commit 5bc97bb

File tree

6 files changed

+53
-0
lines changed

6 files changed

+53
-0
lines changed

cve_bin_tool/checkers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@
263263
"privoxy",
264264
"procps_ng",
265265
"proftpd",
266+
"protobuf_c",
266267
"pspp",
267268
"pure_ftpd",
268269
"putty",

cve_bin_tool/checkers/protobuf_c.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (C) 2023 Orange
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
5+
"""
6+
CVE checker for protobuf-c
7+
8+
https://www.cvedetails.com/product/116953/Protobuf-c-Project-Protobuf-c.html?vendor_id=27533
9+
10+
"""
11+
from __future__ import annotations
12+
13+
from cve_bin_tool.checkers import Checker
14+
15+
16+
class ProtobufCChecker(Checker):
17+
CONTAINS_PATTERNS: list[str] = []
18+
FILENAME_PATTERNS: list[str] = []
19+
VERSION_PATTERNS = [
20+
r"protobuf-c[a-zA-Z0-9@`&_:.()<>= \-\t\r\n]*\r?\n([0-9]+\.[0-9]+\.[0-9]+)"
21+
]
22+
VENDOR_PRODUCT = [("protobuf-c_project", "protobuf-c")]
Binary file not shown.
Binary file not shown.
Binary file not shown.

test/test_data/protobuf_c.py

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

0 commit comments

Comments
 (0)