Skip to content

Commit f1069c8

Browse files
authored
Update entrypoint.js
1 parent f5c1d6b commit f1069c8

1 file changed

Lines changed: 20 additions & 16 deletions

File tree

entrypoint.js

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -408,23 +408,27 @@ const processReport = function () {
408408
try {
409409
if (cmdOPS === 'REPORT') {
410410
const vulnerabilities = securityReports.vulnerabilities || []
411-
utilities.printTableWithJSON(vulnerabilities.map((v, idx) => {
412-
securityServerity.critical += v.severity == 'Critical' ? 1 : 0
413-
securityServerity.high += v.severity == 'High' ? 1 : 0
414-
securityServerity.medium += v.severity == 'Medium' ? 1 : 0
415-
securityServerity.low += v.severity == 'Low' ? 1 : 0
416-
securityServerity.info += v.severity == 'Unknown' ? 1 : 0
417-
return {
418-
index: idx + 1,
419-
name: v.name.truncateLeft(30),
420-
severity: v.severity == 'Unknown' ? 'Information' : (v.severity || ''),
421-
category: v.category || '',
422-
identifier: (v.identifiers || []).map(i => i.type == 'cwe' ? undefined : i.value).filter(o => o),
423-
location: v.location.file.truncateLeft(30)
411+
if (vulnerabilities.length) {
412+
utilities.printTableWithJSON(vulnerabilities.map((v, idx) => {
413+
securityServerity.critical += v.severity == 'Critical' ? 1 : 0
414+
securityServerity.high += v.severity == 'High' ? 1 : 0
415+
securityServerity.medium += v.severity == 'Medium' ? 1 : 0
416+
securityServerity.low += v.severity == 'Low' ? 1 : 0
417+
securityServerity.info += v.severity == 'Unknown' ? 1 : 0
418+
return {
419+
index: idx + 1,
420+
name: v.name.truncateLeft(30),
421+
severity: v.severity == 'Unknown' ? 'Information' : (v.severity || ''),
422+
category: v.category || '',
423+
identifier: (v.identifiers || []).map(i => i.type == 'cwe' ? undefined : i.value).filter(o => o),
424+
location: v.location.file.truncateLeft(30)
425+
}
426+
}))
427+
if (securityServerity.critical || securityServerity.high) {
428+
throw (`${RED}ERROR ${RESET}from ${RESET}${configInputFile}${RESET} - There are ${securityServerity.critical} ${VIOLET}(CRITICAL)${RESET} and ${securityServerity.high} ${YELLOW}(HIGH)${RESET} severity findings.${RESET}`)
424429
}
425-
}))
426-
if (securityServerity.critical || securityServerity.high) {
427-
throw (`${RED}ERROR ${RESET}from ${RESET}${configInputFile}${RESET} - There are ${securityServerity.critical} ${VIOLET}(CRITICAL)${RESET} and ${securityServerity.high} ${YELLOW}(HIGH)${RESET} severity findings.${RESET}`)
430+
} else {
431+
simplify.consoleWithMessage(`${opName}-Report`, `There was no finding has been found yet.`)
428432
}
429433
}
430434
} catch (err) {

0 commit comments

Comments
 (0)