Skip to content

Commit

Permalink
Fix vulnerability duplicate filtering
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ferozsalam committed Jan 15, 2024
1 parent cd5348a commit 692380d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -14731,4 +14731,4 @@ if (require.main === require.cache[eval('__filename')]) {

module.exports = __webpack_exports__;
/******/ })()
;
;

0 comments on commit 692380d

Please sign in to comment.