UNPKG

@hclsoftware/secagent

Version:

IAST agent

52 lines (42 loc) 1.35 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 ValidateByMatchTask { constructor (originalReturn, param, stack, parameters, origMethod) { this.origMethod = origMethod this.originalReturn = originalReturn !== null this.param = param 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 hasMatch = this.origMethod.call(exploit, this.param) !== null this.isVerified = hasMatch === this.originalReturn return exploit } taskInfoDescription () { return `match: \"${this.param}\"` } getSignature () { const hashInput = { taskName: 'match', value: this.param , origreturn :this.originalReturn} return ObjectHasher(hashInput) } isVerified () { return this.isVerified } }