Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions scanner/docker_scout_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions scanner/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand All @@ -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,
Expand Down