@hclsoftware/secagent
Version:
IAST agent
49 lines (41 loc) • 1.44 kB
JavaScript
//IASTIGNORE
/*
* ****************************************************
* Licensed Materials - Property of HCL.
* (c) Copyright HCL Technologies Ltd. 2017, 2025.
* Note to U.S. Government Users *Restricted Rights.
* ****************************************************
*/
'use strict'
const TaskType = require('./TaskType')
const ObjectHasher = require('object-hash')
module.exports = class ValidateByValidatorsTask {
constructor (originalReturn, param, stack, parameters, origMethod) {
this.origMethod = origMethod
this.originalReturn = originalReturn
this.taskInfo = { stack: stack, parameters: parameters }
this.taskType = TaskType.VALIDATION
this.isVerified = true
}
get parameters(){
return this.taskInfo.parameters
}
get stack(){
return this.taskInfo.stack
}
performAction(exploit){
const validationAgainstExploit = this.origMethod.apply(exploit,this.parameters.methodArguments)
this.isVerified = validationAgainstExploit === this.originalReturn
return exploit
}
taskInfoDescription () {
return `${this.origMethod.name} : ${this.parameters.methodArguments}`
}
getSignature (){
const hashinput = { taskname : this.origMethod.name , value : this.parameters.methodArguments , origreturn : this.originalReturn}
return ObjectHasher(hashinput)
}
isVerified (){
return this.isVerified
}
}