terraform.aws.security.aws-imagebuilder-component-encrypted-with-cmk.aws-imagebuilder-component-encrypted-with-cmk
semgrep
Author
unknown
Download Count*
License
Ensure ImageBuilder component is encrypted at rest using KMS CMKs. CMKs gives you control over the encryption key in terms of access and rotation.
Run Locally
Run in CI
Defintion
rules:
- id: aws-imagebuilder-component-encrypted-with-cmk
patterns:
- pattern: |
resource "aws_imagebuilder_component" $ANYTHING {
...
}
- pattern-not-inside: |
resource "aws_imagebuilder_component" $ANYTHING {
...
kms_key_id = ...
...
}
message: Ensure ImageBuilder component is encrypted at rest using KMS CMKs. CMKs
gives you control over the encryption key in terms of access and rotation.
metadata:
category: security
technology:
- terraform
- aws
owasp:
- A03:2017 - Sensitive Data Exposure
cwe:
- "CWE-320: CWE CATEGORY: Key Management Errors"
references:
- https://owasp.org/Top10/A02_2021-Cryptographic_Failures
subcategory:
- audit
likelihood: LOW
impact: LOW
confidence: LOW
license: Commons Clause License Condition v1.0[LGPL-2.1-only]
vulnerability_class:
- Cryptographic Issues
languages:
- hcl
severity: WARNING
Examples
aws-imagebuilder-component-encrypted-with-cmk.tf
# ruleid: aws-imagebuilder-component-encrypted-with-cmk
resource "aws_imagebuilder_component" "fail" {
data = yamlencode({
phases = [{
name = "build"
steps = [{
action = "ExecuteBash"
inputs = {
commands = ["echo 'hello world'"]
}
name = "example"
onFailure = "Continue"
}]
}]
schemaVersion = 1.0
})
name = "examplea"
platform = "Linux"
version = "1.0.0"
}
resource "aws_imagebuilder_component" "pass" {
data = yamlencode({
phases = [{
name = "build"
steps = [{
action = "ExecuteBash"
inputs = {
commands = ["echo 'hello world'"]
}
name = "example"
onFailure = "Continue"
}]
}]
schemaVersion = 1.0
})
kms_key_id = aws_kms_key.test.arn
name = "examplea"
platform = "Linux"
version = "1.0.0"
}
Short Link: https://sg.run/9vdY