Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: probability word spellling #3274

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cve_bin_tool/output_engine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,25 +479,25 @@ def output_pdf(
"CVE Number",
"CVSS_version",
"CVSS_score",
"EPSS_propability",
"EPSS_probability",
"EPSS_percentile",
]
# group cve_data by its remarks and separately by paths
for product_info, cve_data in all_cve_data.items():
for cve in cve_data["cves"]:
propability = "-"
probability = "-"
percentile = "-"
for metric, field in cve.metric.items():
if metric == "EPSS":
propability = round(field[0] * 100, 4)
probability = round(field[0] * 100, 4)
percentile = field[1]

cve_by_metrics[cve.remarks].append(
{
"cve_number": cve.cve_number,
"cvss_version": str(cve.cvss_version),
"cvss_score": str(cve.score),
"epss_propability": str(propability),
"epss_probability": str(probability),
"epss_percentile": str(percentile),
"severity": cve.severity,
}
Expand All @@ -515,7 +515,7 @@ def output_pdf(
cve["cve_number"],
cve["cvss_version"],
str(cve["cvss_score"]),
str(cve["epss_propability"]),
str(cve["epss_probability"]),
str(cve["epss_percentile"]),
]
pdfdoc.addrow(
Expand Down
20 changes: 10 additions & 10 deletions cve_bin_tool/output_engine/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ def _output_console_nowrap(
# group cve_data by its remarks and separately by paths
for product_info, cve_data in all_cve_data.items():
for cve in cve_data["cves"]:
propability = "-"
probability = "-"
percentile = "-"
for metric, field in cve.metric.items():
if metric == "EPSS":
propability = str(round(field[0] * 100, 4))
probability = str(round(field[0] * 100, 4))
percentile = str(field[1])
cve_by_remarks[cve.remarks].append(
{
Expand All @@ -120,7 +120,7 @@ def _output_console_nowrap(
"severity": cve.severity,
"score": cve.score,
"cvss_version": cve.cvss_version,
"epss_propability": propability,
"epss_probability": probability,
"epss_percentile": percentile,
}
)
Expand Down Expand Up @@ -157,7 +157,7 @@ def _output_console_nowrap(
table.add_column("Source")
table.add_column("Severity")
table.add_column("Score (CVSS Version)")
table.add_column("EPSS propability")
table.add_column("EPSS probability")
table.add_column("EPSS percentile")
if affected_versions != 0:
table.add_column("Affected Versions")
Expand All @@ -178,7 +178,7 @@ def _output_console_nowrap(
Text.styled(cve_data["source"], color),
Text.styled(cve_data["severity"], color),
Text.styled(cvss_text, color),
Text.styled(cve_data["epss_propability"], color),
Text.styled(cve_data["epss_probability"], color),
Text.styled(cve_data["epss_percentile"], color),
]
if affected_versions != 0:
Expand Down Expand Up @@ -278,26 +278,26 @@ def validate_cell_length(cell_name, cell_type):
table.add_column("CVE")
table.add_column("CVSS_version")
table.add_column("CVSS_score")
table.add_column("EPSS_propability")
table.add_column("EPSS_probability")
table.add_column("EPSS_percentile")
color = "green"

cve_by_metrics: defaultdict[Remarks, list[dict[str, str]]] = defaultdict(list)
# group cve_data by its remarks and separately by paths
for product_info, cve_data in all_cve_data.items():
for cve in cve_data["cves"]:
propability = "-"
probability = "-"
percentile = "-"
for metric, field in cve.metric.items():
if metric == "EPSS":
propability = round(field[0] * 100, 4)
probability = round(field[0] * 100, 4)
percentile = field[1]
cve_by_metrics[cve.remarks].append(
{
"cve_number": cve.cve_number,
"cvss_version": str(cve.cvss_version),
"cvss_score": str(cve.score),
"epss_propability": str(propability),
"epss_probability": str(probability),
"epss_percentile": str(percentile),
"severity": cve.severity,
}
Expand All @@ -311,7 +311,7 @@ def validate_cell_length(cell_name, cell_type):
Text.styled(cve["cve_number"], color),
Text.styled(cve["cvss_version"], color),
Text.styled(str(cve["cvss_score"]), color),
Text.styled(cve["epss_propability"], color),
Text.styled(cve["epss_probability"], color),
Text.styled(cve["epss_percentile"], color),
]
table.add_row(*cells)
Expand Down
8 changes: 4 additions & 4 deletions cve_bin_tool/output_engine/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,20 +214,20 @@ def output_html(
cve_by_metrics: defaultdict[Remarks, list[dict[str, str]]] = defaultdict(list)
for product_info, cve_data in all_cve_data.items():
for cve in cve_data["cves"]:
propability = "-"
probability = "-"
percentile = "-"

for metric, field in cve.metric.items():
if metric == "EPSS":
propability = round(field[0] * 100, 4)
probability = round(field[0] * 100, 4)
percentile = field[1]

cve_by_metrics[cve.remarks].append(
{
"cve_number": cve.cve_number,
"cvss_version": str(cve.cvss_version),
"cvss_score": str(cve.score),
"epss_propability": str(propability),
"epss_probability": str(probability),
"epss_percentile": str(percentile),
"severity": cve.severity,
}
Expand All @@ -249,7 +249,7 @@ def output_html(
<th scope="row">{cve["cve_number"]}</th>
<td>{cve["cvss_version"]}</td>
<td>{cve["cvss_score"]}</td>
<td>{cve["epss_propability"]}</td>
<td>{cve["epss_probability"]}</td>
<td>{cve["epss_percentile"]}</td>
</tr>
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ <h6>CVE metric</h6>
<th scope="col">CVE number</th>
<th scope="col">CVSS version</th>
<th scope="col">CVSS score</th>
<th scope="col">EPSS propability</th>
<th scope="col">EPSS probability</th>
<th scope="col">EPSS percentile</th>
</tr>
</thead>
Expand Down
6 changes: 3 additions & 3 deletions cve_bin_tool/output_engine/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ def format_output(
if isinstance(cve, str):
continue
# If EPSS values are not available for a given CVE, assign them a value of "-"
propability = "-"
probability = "-"
percentile = "-"
for metric, field in cve.metric.items():
if metric == "EPSS":
propability = round(field[0] * 100, 4)
probability = round(field[0] * 100, 4)
percentile = field[1]
details = {
"vendor": product_info.vendor,
Expand All @@ -160,7 +160,7 @@ def format_output(
"cvss_version": str(cve.cvss_version),
"cvss_vector": cve.cvss_vector,
# converting epss score (probability) 0-1 to 0-100
"epss_probability": str(propability),
"epss_probability": str(probability),
"epss_percentile": str(percentile),
"paths": ", ".join(cve_data["paths"]),
"remarks": cve.remarks.name,
Expand Down
2 changes: 1 addition & 1 deletion test/test_output_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ class TestOutputEngine(unittest.TestCase):
"CVE Number"
"CVSS_version"
"CVSS_score"
"EPSS_propability"
"EPSS_probability"
"EPSS_percentile"
"CVE-1234-1234"
"2"
Expand Down