UNPKG

@hclsoftware/secagent

Version:

IAST agent

45 lines (36 loc) 1.21 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 SanitizeByReplaceTask { constructor (oldValue, stack, parameters, replacement) { this.oldValue = oldValue this.taskInfo = { stack: stack, parameters: parameters } this.newValue = replacement this.taskType = TaskType.SANITIZATION } get parameters () { return this.taskInfo.parameters } get stack () { return this.taskInfo.stack } performAction (exploit) { return exploit.origReplaceAll(this.oldValue, this.newValue) } taskInfoDescription () { return `replaceAll: \"${this.oldValue}\"->\"${this.newValue}\"` } getSignature () { // need object-hasher here since the replace parameters can be regexp or function. const hashInput = { taskName: 'replaceAll', oldVal: this.oldValue, newVal: this.newValue } return ObjectHasher(hashInput) } }