Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

added policy to check image scan enable or not for ecr #1075

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
13 changes: 13 additions & 0 deletions avd_docs/aws/ecr/AVD-AWS-0191/docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

Ensure ECR repository has image scans disabled.

### Impact
<!-- Add Impact here -->

<!-- DO NOT CHANGE -->
{{ remediationActions }}

### Links
- https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html


Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# METADATA
# title: "ECR Image Scans"
# description: "Ensure ECR repository has image scans disabled."
# scope: package
# schemas:
# - input: schema.input
# related_resources:
# - https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html
# custom:
# avd_id: AVD-AWS-0191
# provider: aws
# service: ecr
# severity: HIGH
# short_code: enable-image-scans
# recommended_action: "Repository image scans should be enabled to ensure vulnerable software can be discovered and remediated as soon as possible."
# input:
# selector:
# - type: cloud
package builtin.aws.ecr.aws0191

deny[res] {
repo := input.aws.ecr.repositories[_]
not repo.imagescanning.scanonpush.value
res := result.new("Image scanning is not enabled.", repo.imagescanning.scanonpush)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package builtin.aws.ecr.aws0191

test_detects_when_disabled {
r := deny with input as {"aws": {"ecr": {"repositories": [{"imagescanning": {"scanonpush": {"value": false}}}]}}}
count(r) == 1
}

test_when_enabled {
r := deny with input as {"aws": {"ecr": {"repositories": [{"imagescanning": {"scanonpush": {"value": true}}}]}}}
count(r) == 0
}