@hclsoftware/secagent
Version:
IAST agent
27 lines (22 loc) • 797 B
JavaScript
//IASTIGNORE
/*
* ****************************************************
* Licensed Materials - Property of HCL.
* (c) Copyright HCL Technologies Ltd. 2017, 2025.
* Note to U.S. Government Users *Restricted Rights.
* ****************************************************
*/
const BeforeRule = require('./BeforeRule')
module.exports = class skipOrigMethodRule extends BeforeRule {
doRule (hookValues) {
hookValues.runOrigMethod = false
if (hookValues.methodName === 'eval') {
// original return value is added to arguments during our AST changes, so we store it and then remove it from args:
hookValues.ret = hookValues.args[1]
hookValues.args = [hookValues.args[0]]
}
}
runWhenInactive(){
return true;
}
}