Skip to main content
HIGHECRSecurity

ECR Scan-on-Push Disabled

ecr-scan-on-push-disabled

What this rule checks

Detects ECR repositories without image vulnerability scanning on push.

How to fix it

  1. 1Enable ScanOnPush in ImageScanningConfiguration
  2. 2Or use enhanced scanning at the registry level
FlaggedImages pushed to this repository are never scanned for vulnerabilities because scan-on-push is disabled.
import * as ecr from 'aws-cdk-lib/aws-ecr';

const repo = new ecr.Repository(this, 'Repo', {
  repositoryName: 'app-images',
  imageScanOnPush: false,
});
FixedEnabling scan-on-push triggers a vulnerability scan automatically for every image pushed.
import * as ecr from 'aws-cdk-lib/aws-ecr';

const repo = new ecr.Repository(this, 'Repo', {
  repositoryName: 'app-images',
  imageScanOnPush: true,
});

CDK Insights pinpoints the exact file and line in your CDK source for every finding, so you can jump straight to the fix.

Affected resource types

AWS::ECR::Repository

Compliance frameworks

SOC2HIPAAPCI-DSSNIST

AWS documentation

Read the AWS guidance

Intentional? Suppress this finding

Sometimes a flag is deliberate โ€” a genuinely public endpoint, say. You can dismiss ecr-scan-on-push-disabled and the reason is kept in the report, not silently hidden.

In .cdk-insights.json:

{
  "ignoreRules": [
    { "id": "ecr-scan-on-push-disabled", "reason": "Why this is intentional" }
  ]
}

Or inline in your CDK code:

Validations.of(scope).acknowledge({
  id: 'cdk-insights::ecr-scan-on-push-disabled',
  reason: 'Why this is intentional',
});

Use the rule ID ecr-scan-on-push-disabled shown above โ€” not the CDK-* ID from SARIF / GitHub code scanning. To dismiss every finding on one construct instead, use ignorePaths. Suppression docs โ†’

Catch this in your stack

$ npx cdk-insights scan

CDK Insights runs this and 118+ other rules locally against your synthesised CDK app โ€” free, no account, your code never leaves your machine.

More ECR rules