diff --git a/prowler/lib/outputs/html/html.py b/prowler/lib/outputs/html/html.py
index 779fa2d776..26ee798021 100644
--- a/prowler/lib/outputs/html/html.py
+++ b/prowler/lib/outputs/html/html.py
@@ -930,6 +930,56 @@ class HTML(Output):
)
return ""
+ @staticmethod
+ def get_image_assessment_summary(provider: Provider) -> str:
+ """
+ get_image_assessment_summary gets the HTML assessment summary for the Image provider
+
+ Args:
+ provider (Provider): the Image provider object
+
+ Returns:
+ str: the HTML assessment summary
+ """
+ try:
+ if provider.registry:
+ target_info = f"Registry URL: {provider.registry}"
+ else:
+ target_info = f'Images: {", ".join(provider.images)}'
+
+ return f"""
+
+
+
+
+
+ -
+ Image authentication method: {provider.auth_method}
+
+
+
+
"""
+ except Exception as error:
+ logger.error(
+ f"{error.__class__.__name__}[{error.__traceback__.tb_lineno}] -- {error}"
+ )
+ return ""
+
@staticmethod
def get_llm_assessment_summary(provider: Provider) -> str:
"""
diff --git a/tests/lib/outputs/html/html_test.py b/tests/lib/outputs/html/html_test.py
index 727138d4b1..09e3038744 100644
--- a/tests/lib/outputs/html/html_test.py
+++ b/tests/lib/outputs/html/html_test.py
@@ -1,7 +1,7 @@
import sys
from io import StringIO
-from mock import patch
+from mock import MagicMock, patch
from prowler.config.config import prowler_version, timestamp
from prowler.lib.logger import logger
@@ -350,6 +350,62 @@ mongodbatlas_html_assessment_summary = """
"""
+image_registry_html_assessment_summary = """
+
+
+
+
+ -
+ Registry URL: myregistry.io
+
+
+
+
+
+
+
+
+ -
+ Image authentication method: Docker login
+
+
+
+
"""
+
+image_list_html_assessment_summary = """
+
+
+
+
+ -
+ Images: nginx:latest, alpine:3.18
+
+
+
+
+
+
+
+
+ -
+ Image authentication method: No auth
+
+
+
+
"""
+
def get_aws_html_header(args: list) -> str:
"""
@@ -854,6 +910,36 @@ class TestHTML:
assert summary == mongodbatlas_html_assessment_summary
+ def test_image_get_assessment_summary_with_registry(self):
+ """Test Image HTML assessment summary with registry URL."""
+ findings = [generate_finding_output()]
+ output = HTML(findings)
+
+ provider = MagicMock()
+ provider.type = "image"
+ provider.registry = "myregistry.io"
+ provider.images = ["nginx:latest", "alpine:3.18"]
+ provider.auth_method = "Docker login"
+
+ summary = output.get_assessment_summary(provider)
+
+ assert summary == image_registry_html_assessment_summary
+
+ def test_image_get_assessment_summary_with_images(self):
+ """Test Image HTML assessment summary with image list."""
+ findings = [generate_finding_output()]
+ output = HTML(findings)
+
+ provider = MagicMock()
+ provider.type = "image"
+ provider.registry = None
+ provider.images = ["nginx:latest", "alpine:3.18"]
+ provider.auth_method = "No auth"
+
+ summary = output.get_assessment_summary(provider)
+
+ assert summary == image_list_html_assessment_summary
+
def test_process_markdown_bold_text(self):
"""Test that **text** is converted to text"""
test_text = "This is **bold text** and this is **also bold**"