Skip to content

Commit 0f102df

Browse files
authored
Merge pull request #154 from darkbitio/build
Build
2 parents 9e1107a + 8c2d86c commit 0f102df

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

lib/aws_recon/collectors/ecr.rb

+22-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,25 @@ def collect
2323
struct.policy = @client
2424
.get_repository_policy({ repository_name: repo.repository_name }).policy_text.parse_policy
2525

26+
struct.images = []
27+
#
28+
# describe images
29+
#
30+
@client.list_images( {repository_name: repo.repository_name}).image_ids.each_with_index do | image, page |
31+
log(response.context.operation_name, 'list_images', page)
32+
image_hash = image.to_h
33+
#
34+
# describe image scan results
35+
#
36+
result = @client.describe_image_scan_findings({ repository_name: repo.repository_name, image_id: { image_digest: image.image_digest, image_tag: image.image_tag } })
37+
image_hash["image_scan_status"] = result.image_scan_status.to_h
38+
image_hash["image_scan_findings"] = result.image_scan_findings.to_h
39+
40+
rescue Aws::ECR::Errors::ScanNotFoundException => e
41+
# No scan result for this image. No action needed
42+
ensure
43+
struct.images << image_hash
44+
end
2645
rescue Aws::ECR::Errors::ServiceError => e
2746
log_error(e.code)
2847

@@ -40,7 +59,8 @@ def collect
4059
# not an error
4160
def suppressed_errors
4261
%w[
43-
RepositoryPolicyNotFoundException
44-
]
62+
RepositoryPolicyNotFoundException,
63+
ScanNotFoundException
64+
]
4565
end
4666
end

lib/aws_recon/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module AwsRecon
2-
VERSION = "0.5.25"
2+
VERSION = "0.5.26"
33
end

0 commit comments

Comments
 (0)