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) {
79
79
// New npm audit json format introduced in npm v8.
80
80
for ( const vulnerablePackage of Object . keys ( auditReport . vulnerabilities ) ) {
81
81
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
+ } , [ ] ) ;
82
94
83
95
if ( item . via . every ( ( via ) => exceptions . includes ( via . url ) ) ) {
84
96
ignoredIssues . push ( item ) ;
You can’t perform that action at this time.
0 commit comments