UNPKG

@hclsoftware/secagent

Version:

IAST agent

35 lines (30 loc) 1.2 kB
//IASTIGNORE // iterate stack and return the first 10 items which are not iast code. /* * **************************************************** * Licensed Materials - Property of HCL. * (c) Copyright HCL Technologies Ltd. 2017, 2025. * Note to U.S. Government Users *Restricted Rights. * **************************************************** */ const globals = require("../Globals"); module.exports.getStackTraceArray = (rawStack) => { let processedStack = [] let rawStackItems = rawStack.origSplit('\n') // for loop starting from 1 till end of the array to skip the first line which is the just Error for(let i = 1; i < rawStackItems.length; i++){ let stackItem = rawStackItems[i].origTrim() if (!(stackItem.origStringIncludes(globals.IastRootDir) || stackItem.origStringIncludes('Array.forEach (<anonymous>)') || stackItem === 'at new Promise (<anonymous>)' || stackItem === 'at <anonymous>')) { processedStack.push(stackItem) if (processedStack.length === 10) { break } } } return processedStack }