ECR private repositories should have image scanning configured
Verifies that private ECR repositories are covered by a scan on push or continuous scanning rule (manual scanning does not count), so images are checked for known vulnerabilities without anyone starting a scan. The rules are registry-wide, so one rule can clear every repository's finding in the Region.
- service
- ECR
- severity
- High
- scope
- evaluated in every region
How to fix it
- Overwrites existing settings: The CLI and Terraform routes replace the registry's whole scanning configuration with Basic and one rule, so keep any existing rules, and Enhanced if it is on.
In the console
Elastic Container Registry → Private registry → Features & Settings → Scanning → Configure
- Scan type
- Basic scanning or Enhanced scanning (either passes)
- Scan on push filters
- A filter matching this repository, such as * for every repository
With the AWS CLI
aws ecr put-registry-scanning-configuration --scan-type BASIC --rules '[{"scanFrequency":"SCAN_ON_PUSH","repositoryFilters":[{"filter":"*","filterType":"WILDCARD"}]}]' --region <region>With Terraform
resource "aws_ecr_registry_scanning_configuration" "this" {
scan_type = "BASIC"
rule {
scan_frequency = "SCAN_ON_PUSH"
repository_filter {
filter = "*"
filter_type = "WILDCARD"
}
}
}
See which of your accounts this check is failing on.
Book a live scan