From 367bd2d65c5b748635652898c04ebfe9ba8e8cf5 Mon Sep 17 00:00:00 2001 From: Carles Capell <107924659+CarlesDD@users.noreply.github.com> Date: Fri, 8 Nov 2024 13:54:26 +0100 Subject: [PATCH] Discard non-web traces when searching for a vulnerability not being present (#4871) --- packages/dd-trace/test/appsec/iast/utils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/dd-trace/test/appsec/iast/utils.js b/packages/dd-trace/test/appsec/iast/utils.js index 7ceb7d5d5bd..6e427bcb629 100644 --- a/packages/dd-trace/test/appsec/iast/utils.js +++ b/packages/dd-trace/test/appsec/iast/utils.js @@ -136,6 +136,7 @@ function endResponse (res, appResult) { function checkNoVulnerabilityInRequest (vulnerability, config, done, makeRequest) { agent .use(traces => { + if (traces[0][0].type !== 'web') throw new Error('Not a web span') // iastJson == undefiend is valid const iastJson = traces[0][0].meta['_dd.iast.json'] || '' expect(iastJson).to.not.include(`"${vulnerability}"`)