Skip to content

Files

Latest commit

 

History

History
37 lines (26 loc) · 772 Bytes

aws-ecr-enforce-immutable-repository.md

File metadata and controls

37 lines (26 loc) · 772 Bytes

Pattern: Use of mutable AWS ECR image

Issue: -

Description

ECR images should be set to IMMUTABLE to prevent code injection through image mutation. This can be done by setting image_tab_mutability to IMMUTABLE.

Resolution: Only use immutable images in ECR.

Examples

Example of incorrect code:

resource "aws_ecr_repository" "bad_example" {
  name                 = "bar"
  image_tag_mutability = "MUTABLE"

  image_scanning_configuration {
    scan_on_push = true
  }
}

Example of correct code:

resource "aws_ecr_repository" "good_example" {
  name                 = "bar"
  image_tag_mutability = "IMMUTABLE"

  image_scanning_configuration {
    scan_on_push = true
  }
}