Docs › ECR scanning

ECR scanning

Teams configure Amazon ECR differently: basic or enhanced scanning, on push or continuous. mrsentry reads the effective configuration for each repository and decides how far to trust the findings.

Enhanced · Continuous

Amazon Inspector re-evaluates the image whenever a new CVE is published.

Findings areAlways fresh

Enhanced · On push

Scanned once, when the image was pushed. ECR can't re-run the scan.

If older than freshness_max_ageScan locally with Trivy / Grype

Basic · On push / manual

Mostly OS packages. Scanned on push or on demand.

If older than freshness_max_ageRe-scan in ECR, then local

How the scan profile is detected

  1. ecr:GetRegistryScanningConfiguration gives the registry scan type (BASIC or ENHANCED) and its rules.
  2. ecr:BatchGetRepositoryScanningConfiguration gives the frequency that actually applies to this repository (SCAN_ON_PUSH, CONTINUOUS_SCAN or MANUAL) and the filter that matched.
  3. The legacy repository setting imageScanningConfiguration.scanOnPush from DescribeRepositories is used when nothing else is configured.

Run mrsentry ecr status --image <repo> to see the result:

mrsentry doctor and ecr status output in a terminal

Freshness rules

Scan typeFrequencyFresh whenIf stale
Enhanced (Inspector)ContinuousAlways. Inspector re-evaluates images when new CVEs are published, unless the status is SCAN_ELIGIBILITY_EXPIRED.local scan
Enhanced (Inspector)On pushLast scan is younger than ecr.freshness_max_ageECR can't re-trigger it, so local (Trivy/Grype), warn or fail
BasicOn push / manualLast scan is younger than ecr.freshness_max_ageStartImageScan (ECR allows one per image every 24h), then local if that isn't possible

A missing scan, or a status of FAILED or UNSUPPORTED_IMAGE, is handled the same way as stale data. Choose the behaviour with ecr.on_stale:

ValueBehaviour
rescan (default)Basic: trigger StartImageScan and wait up to ecr.rescan_wait_s. If that's not possible, or the repository uses enhanced scanning, run the local scanner.
localPull the image with ECR credentials and scan it with ecr.local_scanner (trivy or grype).
warnUse the stale findings and say so prominently in the report.
failExit with code 7.

Basic scanning mostly covers OS packages. To find application dependencies (jars, node_modules, Python site-packages), use enhanced scanning or the local Trivy fallback, which the full Docker image includes.

Choosing the image

What is collected

From enhanced findings mrsentry collects the package name, version, package manager, file path inside the image (for example /app/lib/jackson-databind-2.13.3.jar), fixed version, CVSS and whether an exploit is available. The file path tells your application's dependencies apart from base-image packages. Only findings at or above ecr.min_severity (default high) are acted on.

OS and base-image packages are listed in the report with a hint to rebuild on a patched base image (ecr.include_os_packages: report), or left out (ignore).

Accepted risks

ecr:
  ignore:
    - id: CVE-2023-0286
      reason: "Not reachable: we never load X.400 certificates (SEC-1182)"
      expires: 2027-03-31
      package: cryptography       # optional: only for this package

An entry stops applying after expires, and every report lists what was ignored. Repositories can add their own entries in .mrsentry.yml.