Add graph contains vertex check to avoid exception
@@ -144,6 +144,7 @@ public class VulnerabilityCacheProcessorPlugin extends Plugin {
return vulnerablePaths;
}
visited.add(source);
+ if (graph.containsVertex(source)) {
for (var node : graph.successors(source)) {
if (!visited.contains(node)) {
path.add(node);
@@ -151,6 +152,7 @@ public class VulnerabilityCacheProcessorPlugin extends Plugin {
path.remove(node);
}
}
+ }
visited.remove(source);
return vulnerablePaths;
}
@@ -349,7 +351,7 @@ public class VulnerabilityCacheProcessorPlugin extends Plugin {
for (var vulnerable : vulnerabilities.keySet()) {
for (var internal : internalCallables) {
List<List<Long>> listLists = getPathsToVulnerableNode(graph, internal, vulnerable, new HashSet<>(), new ArrayList<>(), new ArrayList<>());
- if (listLists.size() > 0) {
+ if (listLists.size() > 0 && listLists.get(0).size() > 0) {
vulnerablePaths.add(listLists.get(0));
logger.info("Vulnerable path was added to the set.");
break;
