diff --git a/lib/nr-security-agent/lib/core/connections/websocket/response/fuzz-request-handler.js b/lib/nr-security-agent/lib/core/connections/websocket/response/fuzz-request-handler.js index 91ccc195..e421eda4 100644 --- a/lib/nr-security-agent/lib/core/connections/websocket/response/fuzz-request-handler.js +++ b/lib/nr-security-agent/lib/core/connections/websocket/response/fuzz-request-handler.js @@ -17,6 +17,7 @@ const https = require('https'); const IASTUtil = require('./IASTUtils'); require('dns').setDefaultResultOrder('ipv4first') +const PolicyManager = require('../../../Policy'); const { IS_LAMBDA_ENV, @@ -42,6 +43,16 @@ function startIASTSchedular() { if (iastIntervalConst) { clearInterval(iastIntervalConst); } + let probingInterval = 5; + + const policyInstance = PolicyManager.getInstance(); + if (policyInstance.data) { + probingInterval = policyInstance.data.vulnerabilityScan.iastScan.probing.interval; + } + if (isNaN(probingInterval)) { + probingInterval = 5; + } + iastIntervalConst = setInterval(() => { let data = IASTUtil.generateIASTDataRequest(); let currentTime = Date.now(); @@ -55,7 +66,7 @@ function startIASTSchedular() { if (timeDiffInSeconds > 5 && additionalCoolDownTime == 0) { Agent.getAgent().client.dispatcher(data); } - }, 5000); + }, probingInterval * 1000); } /** @@ -65,7 +76,7 @@ function startIASTSchedular() { function logScannedApiId(fuzzHeader, requestURL) { try { let apiId = fuzzHeader.split(CSEC_SEP)[0] - if (apiId && !fuzzedApiIDSet.has(apiId) ) { + if (apiId && !fuzzedApiIDSet.has(apiId)) { fuzzedApiIDSet.add(apiId); logger.info("IAST Scan for API %s with ID : %s started.", requestURL, apiId); } @@ -132,10 +143,10 @@ function handleFuzzRequest(fuzzDetails) { IASTUtil.completedRequestsMapInit(fuzzRequest.id); - if(fuzzRequest.headers && fuzzRequest.headers[NR_CSEC_FUZZ_REQUEST_ID]){ + if (fuzzRequest.headers && fuzzRequest.headers[NR_CSEC_FUZZ_REQUEST_ID]) { logScannedApiId(fuzzRequest.headers[NR_CSEC_FUZZ_REQUEST_ID], fuzzRequest.requestURI) } - + logger.info('Firing http request:: URL: ' + config.url); @@ -181,7 +192,7 @@ function handleFuzzResponse(response, fuzzDetails) { function parseAxiosHttpRequestToFuzz(requestObject) { let serverName = requestObject.serverName ? requestObject.serverName : LOCALHOST; let host = serverName + COLON + requestObject.serverPort; - if(requestObject.headers && requestObject.headers['content-length']){ + if (requestObject.headers && requestObject.headers['content-length']) { delete requestObject.headers['content-length']; } return {