diff --git a/scanner/docker_scout_scanner.py b/scanner/docker_scout_scanner.py index 1a5f4e1..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,10 +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 + if compose_files: + print("[INFO] Found Docker Compose files:") + for file in compose_files: + print(f" - {os.path.relpath(file, directory_path)}") - print(f"Found {len(compose_files)} Docker Compose file(s) and {len(k8s_files)} Kubernetes file(s) to scan") + if k8s_files: + 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 @@ -310,8 +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) - print(f"Scanning image: {image}") - + relative_file = os.path.relpath(compose_file, directory_path) + + print( + 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) diff --git a/scanner/parser.py b/scanner/parser.py index a86e241..84d65ba 100644 --- a/scanner/parser.py +++ b/scanner/parser.py @@ -233,6 +233,11 @@ def scan_directory(path, scanner_type='regex', framework='terraform', download_e # 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: @@ -249,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) @@ -261,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,