From 0d184b28ffd7921e30c1b154d17be5d6a8932aab Mon Sep 17 00:00:00 2001 From: "Andoni A." <14891798+andoniaf@users.noreply.github.com> Date: Fri, 20 Feb 2026 09:09:29 +0100 Subject: [PATCH] fix(api): detect registry URL vs image reference for Image provider The Image provider UID was always passed as images=[uid], causing registry URLs like docker.io/andoniaf to be treated as a single image. Reuse the same heuristic from test_connection to pass registry URLs as registry= instead, enabling image enumeration. --- api/src/backend/api/utils.py | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/api/src/backend/api/utils.py b/api/src/backend/api/utils.py index 0db540f493..9fb98009f8 100644 --- a/api/src/backend/api/utils.py +++ b/api/src/backend/api/utils.py @@ -228,12 +228,32 @@ def get_prowler_provider_kwargs( # Keystone API is unavailable on public clouds. pass elif provider.provider == Provider.ProviderChoices.IMAGE.value: - # Image provider uses uid as the image reference; registry credentials - # come from the secret (all optional). - prowler_provider_kwargs = { - "images": [provider.uid], - **{k: v for k, v in prowler_provider_kwargs.items() if v}, - } + # Detect whether uid is a registry URL (e.g. "docker.io/andoniaf") or + # a concrete image reference (e.g. "docker.io/andoniaf/myimage:latest"). + # Uses the same heuristic as ImageProvider.test_connection. + from prowler.providers.image.image_provider import ImageProvider + + image_uid = provider.uid + registry_host = ImageProvider._extract_registry(image_uid) + if registry_host: + repo_and_tag = image_uid[len(registry_host) + 1 :] + else: + repo_and_tag = image_uid + + is_registry_url = ( + registry_host and "/" not in repo_and_tag and ":" not in repo_and_tag + ) + + if is_registry_url: + prowler_provider_kwargs = { + "registry": image_uid, + **{k: v for k, v in prowler_provider_kwargs.items() if v}, + } + else: + prowler_provider_kwargs = { + "images": [image_uid], + **{k: v for k, v in prowler_provider_kwargs.items() if v}, + } if mutelist_processor: mutelist_content = mutelist_processor.configuration.get("Mutelist", {})