Skip to content

Commit 9930b80

Browse files
committed
Don't fail when no vulnerabilities were detected
This allows setting fail-threshold to -1 which will result in a failure in case only vulnerabilities with a score of 0 were detected. This is a pertty common occurrence these days as the NVD struggles to keep up with assigning scores to newly reported CVEs in a timely manner.
1 parent a284ab5 commit 9930b80

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: src/nvd/report.clj

+4-2
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,11 @@
123123

124124
(defn fail-build? [project]
125125
(let [^Engine engine (:engine project)
126-
highest-score (long (apply max 0 (scores engine)))
126+
all-scores (scores engine)
127+
highest-score (long (apply max 0 all-scores))
127128
fail-threshold (long (get-in project [:nvd :fail-threshold] 0))]
128129
(->
129130
project
130131
(assoc-in [:nvd :highest-score] highest-score)
131-
(assoc :failed? (> highest-score fail-threshold)))))
132+
(assoc :failed? (and (seq all-scores)
133+
(> highest-score fail-threshold))))))

0 commit comments

Comments
 (0)