This component was detected but no CVE analysis was performed. The component identification data is shown below.
+
+
+
+ {% elif remarks == "no_cves" %}
+
+
+
+
+
No CVEs Found
+
This component was scanned for vulnerabilities but no known CVEs were found. The component identification data is shown below.
+
+
+
+ {% else %}
@@ -116,6 +150,7 @@
Severity Analysis of {{ name }} {{ version }}
+ {% endif %}
{% if paths %}
diff --git a/test/pages/html_report.py b/test/pages/html_report.py
index 2a04b9492d..3b39e8753c 100644
--- a/test/pages/html_report.py
+++ b/test/pages/html_report.py
@@ -19,6 +19,7 @@ def __init__(
page: Page,
all_cve_data: dict[ProductInfo, CVEData],
has_intermediate_report: bool = True,
+ no_scan: bool = False,
):
self.html_output = NamedTemporaryFile(
"w+", delete=False, suffix=".html", encoding="utf-8"
@@ -52,6 +53,7 @@ def __init__(
merge_report=intermediate_report,
logger=logger,
outfile=self.html_output,
+ no_scan=no_scan,
)
self.page = page
diff --git a/test/test_html.py b/test/test_html.py
index d78a735a2c..cc9e5f1982 100644
--- a/test/test_html.py
+++ b/test/test_html.py
@@ -358,7 +358,13 @@ def test_without_intermediate_report(self) -> None:
expect(product_rows).to_have_count(8)
def test_empty_cve_list(self) -> None:
- """Test that the HTML report renders correctly with an empty cve_data["cves"] list."""
+ """Test that the HTML report renders correctly with an empty cve_data["cves"] list.
+
+ Note: With the current implementation, products without CVEs are still displayed
+ in the HTML report. This is the correct behavior as it shows component identification
+ even when no vulnerabilities are found. The product will show a "No CVEs" badge
+ to indicate that it was scanned but no CVEs were detected.
+ """
empty_output = {
ProductInfo("vendor0", "product0", "1.0", "usr/local/bin/product"): CVEData(
@@ -371,7 +377,55 @@ def test_empty_cve_list(self) -> None:
self.html_report_page.load()
product_rows = self.html_report_page.product_rows
- expect(product_rows).to_have_count(0)
+ # Products without CVEs are still displayed
+ # This is the correct behavior as it shows component identification
+ expect(product_rows).to_have_count(1)
+
+ # Check that the product shows "No CVEs" badge
+ expect(product_rows.nth(0)).to_contain_text("No CVEs")
+
+ def test_no_scan_mode(self) -> None:
+ """Test that the HTML report renders correctly in no-scan mode.
+
+ This test verifies that when the HTML report is generated in no-scan mode,
+ it properly displays all detected products with their component identification
+ information, while hiding CVE-related content. Products should show "No CVE Analysis"
+ badges to indicate that no vulnerability scanning was performed.
+ """
+
+ # Create a test case with products but no CVEs (simulating no-scan mode)
+ no_scan_output = {
+ ProductInfo("vendor0", "product0", "1.0", "usr/local/bin/product"): CVEData(
+ cves=[], paths={"/path/to/file1", "/path/to/file2"}
+ ),
+ ProductInfo("vendor1", "product1", "2.0"): CVEData(
+ cves=[], paths={"/path/to/file3"}
+ ),
+ }
+
+ if hasattr(self, "html_report_page") and self.html_report_page is not None:
+ self.html_report_page.cleanup() # Clean up the previous page
+
+ # Create HTMLReport with no-scan mode
+ self.html_report_page = HTMLReport(self.page, no_scan_output, no_scan=True)
+ self.html_report_page.load()
+ product_rows = self.html_report_page.product_rows
+
+ # In no-scan mode, all detected products should be displayed
+ expect(product_rows).to_have_count(2)
+
+ # Check that products show "No CVE Analysis" badges
+ expect(product_rows.nth(0)).to_contain_text("No CVE Analysis")
+ expect(product_rows.nth(1)).to_contain_text("No CVE Analysis")
+
+ # Check that product information is displayed
+ expect(product_rows.nth(0)).to_contain_text("vendor0")
+ expect(product_rows.nth(0)).to_contain_text("product0")
+ expect(product_rows.nth(0)).to_contain_text("1.0")
+
+ expect(product_rows.nth(1)).to_contain_text("vendor1")
+ expect(product_rows.nth(1)).to_contain_text("product1")
+ expect(product_rows.nth(1)).to_contain_text("2.0")
def test_get_intermediate_label_with_tag():
diff --git a/test/test_output_engine.py b/test/test_output_engine.py
index dd07caadab..38dd4a99bc 100644
--- a/test/test_output_engine.py
+++ b/test/test_output_engine.py
@@ -1581,6 +1581,7 @@ def test_html_output_with_non_standard_severity(self):
logger=logger,
outfile=outfile,
affected_versions=0,
+ no_scan=False,
)
html_content = outfile.getvalue()