Skip to content

Files

Latest commit

 

History

History
39 lines (27 loc) · 744 Bytes

AWS078.md

File metadata and controls

39 lines (27 loc) · 744 Bytes

Pattern: ECR images tags shouldn't be mutable

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
  }
}