@hclsoftware/secagent
Version:
IAST agent
43 lines (36 loc) • 1.28 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 ValidateByIndexOfTask {
constructor (originalReturn, param, stack, parameters, origMethod) {
this.origMethod = origMethod
this.originalReturn = originalReturn !== -1
this.param = param
this.parameters= parameters
this.taskType = TaskType.VALIDATION
this.isVerified = true
}
performAction (exploit) {
const validationAgainstExploit = this.origMethod.apply(exploit,this.parameters.methodArguments) !== -1
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
}
}