From 6326513c631aa09e32f2e5311a73d5de269a961d Mon Sep 17 00:00:00 2001 From: Jeremy Long Date: Wed, 21 Sep 2016 14:04:21 -0400 Subject: [PATCH] improved suppression capability within the report --- .../main/resources/templates/HtmlReport.vsl | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/dependency-check-core/src/main/resources/templates/HtmlReport.vsl b/dependency-check-core/src/main/resources/templates/HtmlReport.vsl index 4bdc1ffba..b62cd39b4 100644 --- a/dependency-check-core/src/main/resources/templates/HtmlReport.vsl +++ b/dependency-check-core/src/main/resources/templates/HtmlReport.vsl @@ -122,8 +122,26 @@ Copyright (c) 2012 Jeremy Long. All Rights Reserved. function setCopyText(name, matchType, matchValue, suppressType, suppressVal) { xml = '\n'; xml += ' \n'; - xml += ' <'+matchType+'>' + matchValue + '\n'; - xml += ' <'+suppressType+'>' + suppressVal + '\n'; + if (matchType=='gav') { + v = matchValue.match(/^[^:]+:[^:]+:/); + if (v && v[0]) { + xml += ' <'+matchType+' regex="true">^' + v[0].replace(/\./g,'\\.') + '.*$\n'; + } else { + xml += ' <'+matchType+'>' + matchValue + '\n'; + } + } else { + xml += ' <'+matchType+'>' + matchValue + '\n'; + } + if (suppressType=='cpe') { + v = suppressVal.match(/^cpe:\/a:[^:]+:[^:]+/); + if (v && v[0]) { + xml += ' <'+suppressType+'>' + v[0] + '\n'; + } else { + xml += ' <'+suppressType+'>' + suppressVal + '\n'; + } + } else { + xml += ' <'+suppressType+'>' + suppressVal + '\n'; + } xml += ''; $('#modal-text').text(xml); $('#modal-content,#modal-background').addClass('active');