From 683909d104ed499a74d2ad2d556cf50092b27edb Mon Sep 17 00:00:00 2001 From: Dustin Born Date: Thu, 4 Apr 2024 22:30:35 +0200 Subject: [PATCH] Fix bug in export to respect general vuln display config --- web_server_files/static/js/search_vulns.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/web_server_files/static/js/search_vulns.js b/web_server_files/static/js/search_vulns.js index ce24e1e..0af1fa7 100644 --- a/web_server_files/static/js/search_vulns.js +++ b/web_server_files/static/js/search_vulns.js @@ -269,6 +269,11 @@ function createVulnsMarkDownTable() { for (var i = 0; i < vulns.length; i++) { if (selectedVulns != null && selectedVulns.length > 0 && !selectedVulns.includes(vulns[i]["id"])) continue; + if (ignoreGeneralCpeVulns && vulns[i].vuln_match_reason == "general_cpe") + continue; + if (!showSingleVersionVulns && vulns[i].vuln_match_reason == "single_higher_version_cpe") + continue; + if (vulns[i].exploits !== undefined && vulns[i].exploits.length > 0) { if (!onlyShowEDBExploits || reduceToEDBUrls(vulns[i].exploits).length > 0) { has_exploits = true; @@ -313,6 +318,10 @@ function createVulnsMarkDownTable() { for (var i = 0; i < vulns.length; i++) { if (selectedVulns != null && selectedVulns.length > 0 && !selectedVulns.includes(vulns[i]["id"])) continue; + if (ignoreGeneralCpeVulns && vulns[i].vuln_match_reason == "general_cpe") + continue; + if (!showSingleVersionVulns && vulns[i].vuln_match_reason == "single_higher_version_cpe") + continue; cur_vuln_has_exploits = false; vulns_md += '|'; @@ -365,6 +374,11 @@ function createVulnsCSV() { for (var i = 0; i < vulns.length; i++) { if (selectedVulns != null && selectedVulns.length > 0 && !selectedVulns.includes(vulns[i]["id"])) continue; + if (ignoreGeneralCpeVulns && vulns[i].vuln_match_reason == "general_cpe") + continue; + if (!showSingleVersionVulns && vulns[i].vuln_match_reason == "single_higher_version_cpe") + continue; + if (vulns[i].exploits !== undefined && vulns[i].exploits.length > 0) { if (!onlyShowEDBExploits || reduceToEDBUrls(vulns[i].exploits).length > 0) { has_exploits = true; @@ -396,6 +410,10 @@ function createVulnsCSV() { for (var i = 0; i < vulns.length; i++) { if (selectedVulns != null && selectedVulns.length > 0 && !selectedVulns.includes(vulns[i]["id"])) continue; + if (ignoreGeneralCpeVulns && vulns[i].vuln_match_reason == "general_cpe") + continue; + if (!showSingleVersionVulns && vulns[i].vuln_match_reason == "single_higher_version_cpe") + continue; if (selectedColumns.length < 1 || selectedColumns.includes('cve')) vulns_csv += `${vulns[i]["id"]},`