Skip to content

Commit

Permalink
Enable metrics if epss-{percentile,probability} is set
Browse files Browse the repository at this point in the history
Enable metrics if epss-percentile or epss-probability is set by the user
(i.e. is above 0). This commit also fix this following broken logic
which allowed negative epss values:

if float(args["epss_percentile"]) > 0 or float(args["epss_percentile"]) < 100:

replaced by:

if float(args["epss_percentile"]) > 0 and float(args["epss_percentile"]) <= 100:

Tentative fix for intel#3625

Signed-off-by: Fabrice Fontaine <[email protected]>
  • Loading branch information
ffontaine committed Dec 19, 2023
1 parent 9b74bf7 commit be7f042
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cve_bin_tool/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,13 +589,16 @@ def main(argv=None):
if int(args["cvss"]) > 0:
score = int(args["cvss"])

metrics = args["metrics"]
epss_percentile = 0
if float(args["epss_percentile"]) > 0 or float(args["epss_percentile"]) < 100:
if float(args["epss_percentile"]) > 0 and float(args["epss_percentile"]) <= 100:
metrics = True
epss_percentile = float(args["epss_percentile"]) / 100
LOGGER.debug(f"epss percentile stored {epss_percentile}")

epss_probability = 0
if float(args["epss_probability"]) > 0 or float(args["epss_probability"]) < 100:
if float(args["epss_probability"]) > 0 and float(args["epss_probability"]) <= 100:
metrics = True
epss_probability = float(args["epss_probability"]) / 100
LOGGER.debug(f"epss probability stored {epss_probability}")

Expand Down Expand Up @@ -899,7 +902,7 @@ def main(argv=None):

with CVEScanner(
score=score,
check_metrics=args["metrics"],
check_metrics=metrics,
epss_percentile=epss_percentile,
epss_probability=epss_probability,
check_exploits=args["exploits"],
Expand Down Expand Up @@ -1024,7 +1027,7 @@ def main(argv=None):
merge_report=merged_reports,
affected_versions=args["affected_versions"],
exploits=args["exploits"],
metrics=args["metrics"],
metrics=metrics,
detailed=args["detailed"],
vex_filename=args["vex"],
sbom_filename=args["sbom_output"],
Expand Down

0 comments on commit be7f042

Please sign in to comment.