File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,18 @@ if (auditReport) {
7979 // New npm audit json format introduced in npm v8.
8080 for ( const vulnerablePackage of Object . keys ( auditReport . vulnerabilities ) ) {
8181 const item = auditReport . vulnerabilities [ vulnerablePackage ] ;
82+ // `item.via` can be either objects or (string) names of vulnerable
83+ // packages in the audit json report. We need to normalize the data so
84+ // that we always deal with a list of objects.
85+ item . via = item . via . reduce ( ( acc , via ) => {
86+ if ( typeof via === 'object' ) {
87+ acc . push ( via ) ;
88+ } else {
89+ acc . push ( ...auditReport . vulnerabilities [ via ] . via ) ;
90+ }
91+
92+ return acc ;
93+ } , [ ] ) ;
8294
8395 if ( item . via . every ( ( via ) => exceptions . includes ( via . url ) ) ) {
8496 ignoredIssues . push ( item ) ;
You can’t perform that action at this time.
0 commit comments