From 22958484dc72892335bd4aaa7be2701175b313cf Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Thu, 29 Aug 2024 12:13:01 +0200 Subject: [PATCH] fix: update jq checker Update jq pattern to avoid false positives with the following strings: 0.2 jqPzsA Moreover, add a new pattern to detect jq 1.7.1 Signed-off-by: Fabrice Fontaine --- cve_bin_tool/checkers/jq.py | 5 ++++- .../jq_1.7.1-3_arm64.deb.tar.gz | Bin 0 -> 3038 bytes test/test_data/jq.py | 9 ++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 test/condensed-downloads/jq_1.7.1-3_arm64.deb.tar.gz diff --git a/cve_bin_tool/checkers/jq.py b/cve_bin_tool/checkers/jq.py index 7338a8f56c..d7c43f33c7 100644 --- a/cve_bin_tool/checkers/jq.py +++ b/cve_bin_tool/checkers/jq.py @@ -17,5 +17,8 @@ class JqChecker(Checker): CONTAINS_PATTERNS: list[str] = [] FILENAME_PATTERNS: list[str] = [] - VERSION_PATTERNS = [r"([0-9]+\.[0-9]+)[a-zA-Z0-9:\-\r\n]*jq"] + VERSION_PATTERNS = [ + r"jq-([0-9]+\.[0-9]+\.[0-9]+)", + r"([0-9]+\.[0-9]+)[a-zA-Z0-9:\-\r\n]*jq[ :]", + ] VENDOR_PRODUCT = [("jq_project", "jq"), ("jqlang", "jq")] diff --git a/test/condensed-downloads/jq_1.7.1-3_arm64.deb.tar.gz b/test/condensed-downloads/jq_1.7.1-3_arm64.deb.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..4d60c783b75e039d4fae4ead21d54e7a493e62f0 GIT binary patch literal 3038 zcmbux=OYx3!vOFz&fZjfjc_u~-mC1rb!S{iS!a(UWSoeTog7YNo|$!a&e?lqMr1}I zE1QhpAMm_)5#o+%cq7@np%;wf!Ae}**Aw&m(ojF;YL%ZJtwa3HWdHW+$r5PK{ejWZ z+WyXt2}I<-)04%MlYnzqgS4P4^QkXw$Ri&QVORD)f3CH%L#x|uzhgSV7r*-ZM+6X? z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.py index 1545764e2a..9baf6ccfa9 100644 --- a/test/test_data/jq.py +++ b/test/test_data/jq.py @@ -2,7 +2,8 @@ # SPDX-License-Identifier: GPL-3.0-or-later mapping_test_data = [ - {"product": "jq", "version": "1.5", "version_strings": ["1.5\njq:"]} + {"product": "jq", "version": "1.5", "version_strings": ["1.5\njq:"]}, + {"product": "jq", "version": "1.7.1", "version_strings": ["jq-1.7.1"]}, ] package_test_data = [ { @@ -17,6 +18,12 @@ "product": "jq", "version": "1.5", }, + { + "url": "http://ftp.fr.debian.org/debian/pool/main/j/jq/", + "package_name": "jq_1.7.1-3_arm64.deb", + "product": "jq", + "version": "1.7.1", + }, { "url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/", "package_name": "jq_1.6-1_x86_64.ipk",