Description
Use the ECR registry’s scan type, frequency and repository filters to select the images to scan.
Potential impact
An unscanned image, or one with unreviewed findings, can reach deployment with known vulnerabilities.
Remediation
Retain other required registry rules when setting scan frequency and filters. Check the results for a newly pushed image and use them to decide whether to patch or deploy.
Examples
The second template configures BASIC registry scanning with SCAN_ON_PUSH in place of the deprecated repository ImageScanningConfiguration. The filter test-repository contains no asterisk, so it also matches other repository names containing that text.
Before
yaml
Resources:
MyRepository3:
Type: AWS::ECR::Repository
Properties:
RepositoryName: "test-repository"
After
yaml
Resources:
MyRepository3:
Type: AWS::ECR::Repository
Properties:
RepositoryName: "test-repository"
RegistryScanning:
Type: AWS::ECR::RegistryScanningConfiguration
Properties:
ScanType: BASIC
Rules:
- ScanFrequency: SCAN_ON_PUSH
RepositoryFilters:
- Filter: test-repository
FilterType: WILDCARD