@hclsoftware/secagent
Version:
IAST agent
59 lines (49 loc) • 1.56 kB
JavaScript
//IASTIGNORE
/*
* ****************************************************
* Licensed Materials - Property of HCL.
* (c) Copyright HCL Technologies Ltd. 2017, 2025.
* Note to U.S. Government Users *Restricted Rights.
* ****************************************************
*/
const SinkReport = require("./SinkReport")
const Utils = require("../Utils/Utils");
class DastResponseData {
constructor() {
this.sinkReports = new Map();
this.routeTemplate = null
}
static generateHash(url, entity, vulnerability) {
const hash = Utils.createHashObject();
hash.update(url);
hash.update(entity.name);
hash.update(entity.type);
hash.update(vulnerability);
return hash.produce();
}
addSinkReport(url, entity, stack, vulnerability, isExtra)
{
const reportHash = DastResponseData.generateHash(url, entity, vulnerability);
const sinkReport = this.sinkReports.get(reportHash);
if (sinkReport != null)
{
sinkReport.addStack(stack);
}
else
{
this.sinkReports.set(reportHash, new SinkReport(url, entity.name, entity.type, stack, vulnerability, isExtra));
}
}
getSinkReports()
{
return this.sinkReports;
}
setRouteTemplate(routeTemplate) {
this.routeTemplate = routeTemplate;
}
getRouteTemplate() {
return this.routeTemplate;
}
}
module.exports = DastResponseData