Skip to content

Commit

Permalink
fix: improve nghttp2 checker
Browse files Browse the repository at this point in the history
Improve nghttp2 checker to avoid false positives with node and
wireshark binaries which links dynamically with nghttp2 library (and
saves the associated version number)

Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
  • Loading branch information
ffontaine committed May 10, 2023
1 parent 9bdba0c commit d9657ed
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cve_bin_tool/checkers/nghttp2.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ class Nghttp2Checker(Checker):
FILENAME_PATTERNS: list[str] = []
VERSION_PATTERNS = [
r"nghttp2/([0-9]+\.[0-9]+\.[0-9]+)",
r"([0-9]+\.[0-9]+\.[0-9]+)\r?\nnghttp2",
r"([0-9]+\.[0-9]+\.[0-9]+)\r?\nnghttp2[-_]",
]
VENDOR_PRODUCT = [("nghttp2", "nghttp2")]
6 changes: 5 additions & 1 deletion test/test_data/nghttp2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

mapping_test_data = [
{"product": "nghttp2", "version": "1.50.0", "version_strings": ["nghttp2/1.50.0"]},
{"product": "nghttp2", "version": "1.18.1", "version_strings": ["1.18.1\nnghttp2"]},
{
"product": "nghttp2",
"version": "1.18.1",
"version_strings": ["1.18.1\nnghttp2-"],
},
]
package_test_data = [
{
Expand Down
2 changes: 1 addition & 1 deletion test/test_data/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
"package_name": "node_v8.16.1-1_x86_64.ipk",
"product": "node.js",
"version": "8.16.1",
"other_products": ["nghttp2", "openssl"],
"other_products": ["openssl"],
},
]
2 changes: 1 addition & 1 deletion test/test_data/wireshark.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
"package_name": "libwireshark16_4.0.3-1_amd64.deb",
"product": "wireshark",
"version": "4.0.3",
"other_products": ["lua", "nghttp2"],
"other_products": ["lua"],
},
]

0 comments on commit d9657ed

Please sign in to comment.