UNPKG

@hclsoftware/secagent

Version:

IAST agent

42 lines (36 loc) 1.29 kB
//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 ValidateByRegexTestTask { constructor (originalReturn, regex, parameters, origMethod) { this.origMethod = origMethod this.originalReturn = originalReturn this.regex = regex this.parameters = parameters this.taskType = TaskType.VALIDATION this.isVerified = true } performAction(exploit){ const validationAgainstExploit = this.origMethod.call(this.regex,exploit) this.isVerified = validationAgainstExploit === this.originalReturn return exploit } taskInfoDescription () { return `${this.origMethod.name} : ${this.regex} , ${this.parameters}` } getSignature (){ const hashinput = { taskname : this.origMethod.name , regex : this.regex , parameters :this.parameters, origreturn : this.originalReturn} return ObjectHasher(hashinput) } isVerified (){ return this.isVerified } }