Project: KICS (Provisioning / Security & Compliance)
File: d7467bb6-3ed1-4c82-8095-5e7a818d0aad.md

title: CodeBuild Not Encrypted hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: d7467bb6-3ed1-4c82-8095-5e7a818d0aad Query name: CodeBuild Not Encrypted Platform: CloudFormation Severity: <span style="color:#ff7213">Medium</span> Category: Encryption URL: CodeBuild Project should be encrypted, which means 'EncryptionKey' should be defined<br> ```yaml title="Positive test num. 1 - yaml file" hl_lines="7" AWSTemplateFormatVersion: 2010-09-09 Description: A sample template Resources: CodeBuildProject: Project: Type: AWS::CodeBuild::Project Properties: Name: myProjectName Description: A description about my project ServiceRole: !GetAtt ServiceRole.Arn Artifacts: Type: no_artifacts Environment: Type: LINUX_CONTAINER ComputeType: BUILDGENERAL1SMALL Image: aws/codebuild/java:openjdk-8 EnvironmentVariables: Name: varName Type: varType Value: varValue Source: Location: codebuild-demo-test/0123ab9a371ebf0187b0fe5614fbb72c Type: S3 TimeoutInMinutes: 10 Tags: Key: Key1 Value: Value1 Key: Key2 Value: Value2 ``` ```json title="Positive test num. 2 - json file" hl_lines="8" { "AWSTemplateFormatVersion": "2010-09-09T00:00:00Z", "Description": "A sample template", "Resources": { "CodeBuildProject": { "Project": { "Type": "AWS::CodeBuild::Project", "Properties": { "Description": "A description about my project", "ServiceRole": "ServiceRole.Arn", "Artifacts": { "Type": "no_artifacts" }, "Environment": { "Image": "aws/codebuild/java:openjdk-8", "EnvironmentVariables": [ { "Name": "varName", "Type": "varType", "Value": "varValue" } ], "Type": "LINUX_CONTAINER", "ComputeType": "BUILDGENERAL1SMALL" }, "Source": { "Location": "codebuild-demo-test/0123ab9a371ebf0187b0fe5614fbb72c", "Type": "S3" }, "TimeoutInMinutes": 10, "Tags": [ { "Key": "Key1", "Value": "Value1" }, { "Key": "Key2", "Value": "Value2" } ], "Name": "myProjectName" } } } } } ``` ```yaml title="Negative test num. 1 - yaml file" AWSTemplateFormatVersion: 2010-09-09 Description: A sample template Resources: CodeBuildProject: Project: Type: AWS::CodeBuild::Project Properties: Name: myProjectName Description: A description about my project EncryptionKey: "alias/alias-name" ServiceRole: !GetAtt ServiceRole.Arn Artifacts: Type: no_artifacts Environment: Type: LINUX_CONTAINER ComputeType: BUILDGENERAL1SMALL Image: aws/codebuild/java:openjdk-8 EnvironmentVariables: Name: varName Type: varType Value: varValue Source: Location: codebuild-demo-test/0123ab9a371ebf0187b0fe5614fbb72c Type: S3 TimeoutInMinutes: 10 Tags: Key: Key1 Value: Value1 Key: Key2 Value: Value2 ``` ```json title="Negative test num. 2 - json file" { "AWSTemplateFormatVersion": "2010-09-09T00:00:00Z", "Description": "A sample template", "Resources": { "CodeBuildProject": { "Project": { "Type": "AWS::CodeBuild::Project", "Properties": { "Name": "myProjectName", "Description": "A description about my project", "TimeoutInMinutes": 10, "EncryptionKey": "alias/alias-name", "ServiceRole": "ServiceRole.Arn", "Artifacts": { "Type": "no_artifacts" }, "Environment": { "Type": "LINUX_CONTAINER", "ComputeType": "BUILDGENERAL1SMALL", "Image": "aws/codebuild/java:openjdk-8", "EnvironmentVariables": [ { "Name": "varName", "Type": "varType", "Value": "varValue" } ] }, "Source": { "Location": "codebuild-demo-test/0123ab9a371ebf0187b0fe5614fbb72c", "Type": "S3" }, "Tags": [ { "Key": "Key1", "Value": "Value1" }, { "Key": "Key2", "Value": "Value2" } ] } } } } } ```