From 1781aadab07182876caf254ba55f1a65c051ff1b Mon Sep 17 00:00:00 2001 From: Steve Springett Date: Fri, 12 Jan 2018 22:46:25 -0600 Subject: [PATCH] Added support for cpeStartsWithFilter to scan agent --- .../agent/DependencyCheckScanAgent.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java index a0e9e6fe3..ee056caed 100644 --- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java +++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java @@ -155,6 +155,10 @@ public class DependencyCheckScanAgent { * The password to use when connecting to the database. */ private String databasePassword; + /** + * The starting string that identifies CPEs that are qualified to be imported. + */ + private String cpeStartsWithFilter; /** * Whether or not the Maven Central analyzer is enabled. */ @@ -560,6 +564,22 @@ public class DependencyCheckScanAgent { this.showSummary = showSummary; } + /** + * Sets starting string that identifies CPEs that are qualified to be imported. + * @param cpeStartsWithFilter filters CPEs based on this starting string (i.e. cpe:/a: ) + */ + public void setCpeStartsWithFilter(String cpeStartsWithFilter) { + this.cpeStartsWithFilter = cpeStartsWithFilter; + } + + /** + * Returns the starting string that identifies CPEs that are qualified to be imported. + * @return the CPE starting filter (i.e. cpe:/a: ) + */ + public String getCpeStartsWithFilter() { + return cpeStartsWithFilter; + } + /** * Get the value of centralAnalyzerEnabled. * @@ -948,6 +968,7 @@ public class DependencyCheckScanAgent { settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PASSWORD, proxyPassword); settings.setStringIfNotEmpty(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); settings.setStringIfNotEmpty(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); + settings.setStringIfNotEmpty(Settings.KEYS.CVE_CPE_STARTS_WITH_FILTER, cpeStartsWithFilter); settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled); settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_CENTRAL_URL, centralUrl); settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled);