Skip to content

Commit

Permalink
fix: improve nghttp2 checker (#2991)
Browse files Browse the repository at this point in the history
* fix: improve nghttp2 checker

Improve nghttp2 checker to avoid false positives with node and
wireshark binaries which link dynamically with nghttp2 library (and
save the associated version number)

Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>

* chore: merge conflict resolution

---------

Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
Co-authored-by: Terri Oda <terri.oda@intel.com>
  • Loading branch information
ffontaine and terriko authored Jun 21, 2023
1 parent ff7f1cc commit 2bb8032
Show file tree
Hide file tree
Showing 4 changed files with 7 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
1 change: 0 additions & 1 deletion test/test_data/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@
"package_name": "node_v8.16.1-1_x86_64.ipk",
"product": "node.js",
"version": "8.16.1",
"other_products": ["nghttp2"],
},
]
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 2bb8032

Please sign in to comment.