extended callable search to previous versions
@@ -189,6 +189,17 @@ public class VulnerabilityConsumer extends Plugin {
});
});
+ // temp-workaround to deal with small number of records
+ var i = pkgVersionIds.size() - 2;
+ while (fastenUris.size() == 0 && i >= 0) {
+ var pkgVersionId = pkgVersionIds.get(i);
+ v.getPatches().forEach(p -> {
+ logger.info("Searching for callables in " + p.getFileName() + " for Package Version ID: " + pkgVersionId);
+ fastenUris.addAll(metadataUtility.getFastenUrisForPatch(p, pkgVersionId, context));
+ });
+ i -= 1;
+ }
+
logger.info("Collected " + fastenUris.size() + " vulnerable fasten_uris ids");
var fullFastenUris = new HashSet<String>();
@@ -233,8 +244,13 @@ public class VulnerabilityConsumer extends Plugin {
public DSLContext getVulnerabilityEcosystem(Vulnerability v) {
assert v.getPurls().size() > 0;
var purl = v.getPurls().iterator().next();
+ try {
var purlObj = PURLPackage.getObjectFromPurl(purl);
return contexts.get(purlObj.getType());
+ } catch (Exception e) {
+ logger.error("PURL was not formatted correctly");
+ return null;
+ }
}
/**
