mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-20 16:24:11 +01:00
added code to remove additional false positives
Former-commit-id: 1a15cccd4790fee2044de40843305762cfbefe96
This commit is contained in:
@@ -102,6 +102,7 @@ public class FalsePositiveAnalyzer extends AbstractAnalyzer {
|
|||||||
*/
|
*/
|
||||||
public void analyze(Dependency dependency, Engine engine) throws AnalysisException {
|
public void analyze(Dependency dependency, Engine engine) throws AnalysisException {
|
||||||
removeJreEntries(dependency);
|
removeJreEntries(dependency);
|
||||||
|
removeBadMatches(dependency);
|
||||||
boolean deepScan = false;
|
boolean deepScan = false;
|
||||||
try {
|
try {
|
||||||
deepScan = Settings.getBoolean(Settings.KEYS.PERFORM_DEEP_SCAN);
|
deepScan = Settings.getBoolean(Settings.KEYS.PERFORM_DEEP_SCAN);
|
||||||
@@ -182,7 +183,10 @@ public class FalsePositiveAnalyzer extends AbstractAnalyzer {
|
|||||||
final Iterator<Identifier> itr = identifiers.iterator();
|
final Iterator<Identifier> itr = identifiers.iterator();
|
||||||
while (itr.hasNext()) {
|
while (itr.hasNext()) {
|
||||||
final Identifier i = itr.next();
|
final Identifier i = itr.next();
|
||||||
|
|
||||||
if ((i.getValue().startsWith("cpe:/a:sun:java:")
|
if ((i.getValue().startsWith("cpe:/a:sun:java:")
|
||||||
|
|| i.getValue().startsWith("cpe:/a:sun:java_se")
|
||||||
|
|| i.getValue().startsWith("cpe:/a:oracle:java_se")
|
||||||
|| i.getValue().startsWith("cpe:/a:oracle:jre")
|
|| i.getValue().startsWith("cpe:/a:oracle:jre")
|
||||||
|| i.getValue().startsWith("cpe:/a:oracle:jdk"))
|
|| i.getValue().startsWith("cpe:/a:oracle:jdk"))
|
||||||
&& !dependency.getFileName().toLowerCase().endsWith("rt.jar")) {
|
&& !dependency.getFileName().toLowerCase().endsWith("rt.jar")) {
|
||||||
@@ -210,4 +214,18 @@ public class FalsePositiveAnalyzer extends AbstractAnalyzer {
|
|||||||
}
|
}
|
||||||
return cpe;
|
return cpe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void removeBadMatches(Dependency dependency) {
|
||||||
|
final Set<Identifier> identifiers = dependency.getIdentifiers();
|
||||||
|
final Iterator<Identifier> itr = identifiers.iterator();
|
||||||
|
while (itr.hasNext()) {
|
||||||
|
final Identifier i = itr.next();
|
||||||
|
//TODO move this startswith expression to a configuration file?
|
||||||
|
if (i.getValue().startsWith("cpe:/a:apache:xerces-c++:")
|
||||||
|
&& dependency.getFileName().toLowerCase().endsWith(".jar")) {
|
||||||
|
itr.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user