Hardcode artifact for Vuln Cache Proc plugin; to be reverted
@@ -276,15 +276,24 @@ public class VulnerabilityCacheProcessorPlugin extends Plugin {
}
try {
- var artifacts = json.getJSONArray("artifacts");
-
- for (int i = 0; i < json.length(); i++) {
- var revisionObj = artifacts.getJSONObject(i);
- var id = revisionObj.optLong("id", -1);
- var groupId = revisionObj.getString("groupId");
- var artifactId = revisionObj.getString("artifactId");
- var version = revisionObj.getString("version");
- var timestamp = revisionObj.optLong("createdAt", -1);
+// var artifacts = json.getJSONArray("artifacts");
+
+// for (int i = 0; i < json.length(); i++) {
+// var revisionObj = artifacts.getJSONObject(i);
+// var id = revisionObj.optLong("id", -1);
+// var groupId = revisionObj.getString("groupId");
+// var artifactId = revisionObj.getString("artifactId");
+// var version = revisionObj.getString("version");
+// var timestamp = revisionObj.optLong("createdAt", -1);
+// var revision = new Revision(id, groupId, artifactId, version, new Timestamp(timestamp));
+// logger.info("Processing revision: " + revision.toString());
+
+// var revisionObj = artifacts.getJSONObject(i);
+ var id = 0L;
+ var groupId = "cn.onekit.x2x.cloud";
+ var artifactId = "thekit";
+ var version = "1.3.0";
+ var timestamp = -1;
var revision = new Revision(id, groupId, artifactId, version, new Timestamp(timestamp));
logger.info("Processing revision: " + revision.toString());
@@ -298,7 +307,7 @@ public class VulnerabilityCacheProcessorPlugin extends Plugin {
} else {
logger.info("Failed to retrieve correct revision id from DB. Skipping the process...");
persistOutput(revision, "{}");
- continue;
+// continue;
}
}
@@ -311,7 +320,7 @@ public class VulnerabilityCacheProcessorPlugin extends Plugin {
if (vulnerableDependencies.size() == 0) {
logger.info("No Vulnerabilities Found. Skipping processing of revision.");
persistOutput(revision, "{}");
- continue;
+// continue;
} else {
logger.info("Vulnerable IDs: " + vulnerableDependencies.toString());
}
@@ -322,11 +331,12 @@ public class VulnerabilityCacheProcessorPlugin extends Plugin {
if (graph == null || graph.numNodes() == 0) {
logger.info("Empty Graph for: " + revision.toString());
persistOutput(revision, "{}");
- continue;
+// continue;
} else {
logger.info("Graph exists for: " + revision.toString());
}
+ assert graph != null;
var vulnerabilities = kbDao.findVulnerableCallables(vulnerableDependencies, graph.nodes());
logger.info("Graph contains vulnerable callables: " + vulnerabilities.keySet().size());
@@ -373,7 +383,7 @@ public class VulnerabilityCacheProcessorPlugin extends Plugin {
}
output.put("vulnerabilities", pathsJson);
persistOutput(revision, output.toString());
- }
+// }
} catch (JSONException e) {
logger.error("Failed to parse json payload", e);
setPluginError(new RuntimeException("Failed to parse json payload", e));
