CodeBuild report groups with export type S3 are evaluated to confirm their exported test results are encrypted at rest with a KMS key.
Report groups configured with NO_EXPORT are out of scope.
Risk
Unencrypted S3 exports leave report data in plaintext, weakening confidentiality.
If a bucket is misconfigured, compromised, or accessed by insiders, attackers can harvest test outputs for secrets, tokens, build paths, and system details, enabling credential theft and lateral movement.
prowler aws --checks codebuild_report_group_export_encrypted
Recommendation
Enable at-rest encryption for report exports using KMS (prefer customer managed keys).
Apply least privilege: restrict key usage to the CodeBuild role and required principals, enable rotation, and audit key usage. Combine with S3 bucket policies for defense in depth.
Remediation
aws codebuild update-report-group --arn <report-group-arn> --export-config "exportConfigType=S3,s3Destination={bucket=<bucket-name>,encryptionDisabled=false}"
- Open the AWS Console and go to CodeBuild > Report groups
- Select the report group and click Edit
- Ensure Export to Amazon S3 is enabled and a bucket is set
- Expand Additional configuration and enable encryption by choosing Default AWS managed key (or select a KMS key)
- Ensure Disable artifact encryption is NOT selected
- Save changes
Source Code
Resource Type
AwsCodeBuildProject
References
- https://docs.aws.amazon.com/securityhub/latest/userguide/codebuild-controls.html#codebuild-7
- https://www.pulumi.com/registry/packages/aws/api-docs/codebuild/reportgroup/
- https://docs.aws.amazon.com/codebuild/latest/userguide/report-group-export-settings.html
- https://docs.aws.amazon.com/codebuild/latest/userguide/security-encryption.html
- https://docs.aws.amazon.com/securityhub/latest/userguide/codebuild-controls.html
- https://docs.amazonaws.cn/en_us/codebuild/latest/userguide/report-group-export-settings.html
- https://docs.aws.amazon.com/codebuild/latest/userguide/test-report-group-create-console.html
- https://docs.aws.amazon.com/codebuild/latest/userguide/update-report-group-console.html
- https://docs.aws.amazon.com/codebuild/latest/userguide/report-group-create.html
- https://docs.amazonaws.cn/en_us/codebuild/latest/userguide/test-report-group-create-console.html