From 2341adc8fe7625cf758ff7bc7bbe5c79ad88f3e0 Mon Sep 17 00:00:00 2001 From: Natan Date: Wed, 20 May 2026 10:26:49 +0200 Subject: [PATCH 1/4] Implemented the requested logging improvements. --- scanner/parser.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scanner/parser.py b/scanner/parser.py index a86e241..a5760fc 100644 --- a/scanner/parser.py +++ b/scanner/parser.py @@ -231,6 +231,15 @@ def scan_directory(path, scanner_type='regex', framework='terraform', download_e framework = detect_framework(path, files=resolved_files) print(f"Detected framework: {framework}") + if resolved_files: + print("Found files to scan:") + for file_path in sorted(resolved_files): + try: + relative_path = os.path.relpath(file_path, path) + except ValueError: + relative_path = file_path + print(f" - {relative_path}") + # Count resources for reporting resource_count = count_resources(path, framework, files=resolved_files) From 135d32a4fc6f2916098b4f38df7da07067228534 Mon Sep 17 00:00:00 2001 From: Natan Date: Wed, 20 May 2026 10:30:44 +0200 Subject: [PATCH 2/4] Implemented the requested logging improvements. --- scanner/docker_scout_scanner.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scanner/docker_scout_scanner.py b/scanner/docker_scout_scanner.py index 1a5f4e1..1071855 100644 --- a/scanner/docker_scout_scanner.py +++ b/scanner/docker_scout_scanner.py @@ -286,6 +286,16 @@ def run_docker_scout_scan(directory_path: str, files: List[str] = None) -> Tuple return findings, extra_recommendations, False print(f"Found {len(compose_files)} Docker Compose file(s) and {len(k8s_files)} Kubernetes file(s) to scan") + + if compose_files: + print("Docker Compose files:") + for compose_file in compose_files: + print(f" - {os.path.relpath(compose_file, directory_path)}") + + if k8s_files: + print("Kubernetes files:") + for k8s_file in k8s_files: + print(f" - {os.path.relpath(k8s_file, directory_path)}") # Collect ALL images from ALL files first all_images_map = {} # image -> source_file @@ -310,7 +320,10 @@ def run_docker_scout_scan(directory_path: str, files: List[str] = None) -> Tuple # Check if image exists locally before scanning image_existed_before = check_image_exists(image) - print(f"Scanning image: {image}") + print( + f"Scanning image: {image} " + f"(from {os.path.relpath(compose_file, directory_path)})" + ) try: image_findings, image_auth_failed = scan_image(image, compose_file, directory_path) From 42fec2aadb9ed4cb2852fea3fc0784668cc4b257 Mon Sep 17 00:00:00 2001 From: Natan Date: Tue, 26 May 2026 13:08:30 +0200 Subject: [PATCH 3/4] fix: gracefully handle missing Docker Scout scanner --- scanner/docker_scout_scanner.py | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/scanner/docker_scout_scanner.py b/scanner/docker_scout_scanner.py index 1071855..217e202 100644 --- a/scanner/docker_scout_scanner.py +++ b/scanner/docker_scout_scanner.py @@ -268,7 +268,6 @@ def run_docker_scout_scan(directory_path: str, files: List[str] = None) -> Tuple findings = [] extra_recommendations = [] auth_failed = False - scanned_images = set() # Cache to avoid scanning same image multiple times images_to_cleanup = set() # Track images pulled during scan for cleanup # Check if cleanup is enabled (default: yes) @@ -282,20 +281,15 @@ def run_docker_scout_scan(directory_path: str, files: List[str] = None) -> Tuple # Find Kubernetes files k8s_files = find_kubernetes_files(directory_path) - if not compose_files and not k8s_files: - return findings, extra_recommendations, False - - print(f"Found {len(compose_files)} Docker Compose file(s) and {len(k8s_files)} Kubernetes file(s) to scan") - if compose_files: - print("Docker Compose files:") - for compose_file in compose_files: - print(f" - {os.path.relpath(compose_file, directory_path)}") - + print("[INFO] Found Docker Compose files:") + for file in compose_files: + print(f" - {os.path.relpath(file, directory_path)}") + if k8s_files: - print("Kubernetes files:") - for k8s_file in k8s_files: - print(f" - {os.path.relpath(k8s_file, directory_path)}") + print("[INFO] Found Kubernetes files:") + for file in k8s_files: + print(f" - {os.path.relpath(file, directory_path)}") # Collect ALL images from ALL files first all_images_map = {} # image -> source_file @@ -320,11 +314,14 @@ def run_docker_scout_scan(directory_path: str, files: List[str] = None) -> Tuple # Check if image exists locally before scanning image_existed_before = check_image_exists(image) + relative_file = os.path.relpath(compose_file, directory_path) + print( - f"Scanning image: {image} " - f"(from {os.path.relpath(compose_file, directory_path)})" + f"[INFO] Scanning image '{image}' " + f"from file: {os.path.relpath(compose_file, directory_path)}" ) - + print(f" Source file: {relative_file}") + try: image_findings, image_auth_failed = scan_image(image, compose_file, directory_path) findings.extend(image_findings) From fc65e56e915c149bd6c3826be146ef21562fe8ed Mon Sep 17 00:00:00 2001 From: Natan Date: Tue, 26 May 2026 13:10:07 +0200 Subject: [PATCH 4/4] gracefully handle missing Docker Scout scanner --- scanner/parser.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scanner/parser.py b/scanner/parser.py index a5760fc..84d65ba 100644 --- a/scanner/parser.py +++ b/scanner/parser.py @@ -231,17 +231,13 @@ def scan_directory(path, scanner_type='regex', framework='terraform', download_e framework = detect_framework(path, files=resolved_files) print(f"Detected framework: {framework}") - if resolved_files: - print("Found files to scan:") - for file_path in sorted(resolved_files): - try: - relative_path = os.path.relpath(file_path, path) - except ValueError: - relative_path = file_path - print(f" - {relative_path}") - # Count resources for reporting resource_count = count_resources(path, framework, files=resolved_files) + # Log discovered files + if resolved_files: + print("Files passed to Checkov:") + for file in resolved_files: + print(f" - {os.path.relpath(file, path)}") # Run cost-focused regex scanner if 'regex' in active_scanners: @@ -258,6 +254,7 @@ def scan_directory(path, scanner_type='regex', framework='terraform', download_e # Scan all files and collect results for file_path in all_files: + print(f"[INFO] Scanning Terraform file: {os.path.relpath(file_path, path)}") file_results = scan_file(file_path) if file_results: results.extend(file_results) @@ -270,6 +267,10 @@ def scan_directory(path, scanner_type='regex', framework='terraform', download_e if 'checkov' in active_scanners: if is_checkov_available(): try: + if resolved_files: + print("[INFO] Files passed to Checkov:") + for file in resolved_files: + print(f" - {os.path.relpath(file, path)}") checkov_results = run_checkov_scan( path, framework,