From 692380d94589d00bddf7a805ccdebeccf73b14a9 Mon Sep 17 00:00:00 2001 From: Feroz Salam Date: Mon, 15 Jan 2024 11:05:13 +0530 Subject: [PATCH] Fix vulnerability duplicate filtering On the latest iteration of the Action, SARIF uploads fail when a container has zero vulnerabilities. The error is: `Failed formatting SARIF: Cannot read properties of undefined (reading 'filter')` This change ensures that the vulnerabilities variable is always defined, so that this error does not occur. Signed-off-by: Feroz Salam --- dist/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 8bdd278..49ab1d2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -14490,7 +14490,7 @@ function formatSarifToolDriverRules(results) { const vulnerabilities = result.vulnerabilities; const compliances = result.compliances; - const vulnerabilitiesFiltered = vulnerabilities.filter( + const vulnerabilitiesFiltered = (vulnerabilities || []).filter( (thing, index, self) => index === self.findIndex((t) => t.id === thing.id ) @@ -14731,4 +14731,4 @@ if (require.main === require.cache[eval('__filename')]) { module.exports = __webpack_exports__; /******/ })() -; \ No newline at end of file +;