More Info:
This rule verifies whether encryption is enabled for all artifacts of an AWS CodeBuild project. Enabling encryption for artifacts helps protect sensitive data stored in the artifacts from unauthorized access or tampering. It ensures that artifacts are encrypted while stored, providing an additional layer of security.Risk Level
MediumAddress
SecurityCompliance Standards
- APRA CPS 234 (Australia)
- BSI C5 (Germany)
- Brazil LGPD
- CCPA / CPRA (California)
- CIS Critical Security Controls v8
- CMMC 2.0
- CSA Cloud Controls Matrix v4
- Cloudanix Best Practice
- DPDPA
- Digital Operational Resilience Act (EU)
- ISO/IEC 27017
- ISO/IEC 27018
- ISO/IEC 27701
- KSA PDPL
- MAS Technology Risk Management (Singapore)
- MITRE ATT&CK (Cloud)
- NIS2 Directive
- NIST SP 800-171
- NYDFS 23 NYCRR 500
- Reserve Bank of India (RBI) Cyber Security Framework
- SWIFT Customer Security Controls Framework
- Sarbanes-Oxley IT General Controls
- Securities and Exchange Board of India (SEBI) - Cloud Security Adoption Framework
- UK NCSC Cyber Assessment Framework
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
Here’s how to enable artifact encryption for an AWS CodeBuild project using the AWS Management Console:
If you share the exact scanner/tool (e.g., Security Hub, Checkov, etc.), I can tailor the final check to what that tool expects.
1. Identify the CodeBuild project
- Sign in to the AWS Management Console.
- Go to CodeBuild:
Services → CodeBuild. - In the left menu, click Build projects.
- Click the name of the project you need to fix.
2. Edit the project
- On the project details page, click Edit in the upper-right corner.
- Scroll down to the Artifacts section.
3. Ensure artifact type and location are set
- Under Artifacts, make sure:
- Type is Amazon S3 (or another artifact type that supports encryption).
- Bucket name is set to the S3 bucket where artifacts are stored.
4. Configure encryption
In the Artifacts section:- Find Encryption key (sometimes labeled KMS key or similar).
- Choose one of:
- Default AWS managed key for S3:
Selectaws/s3or the default option shown, or - Customer managed key (CMK):
- From the dropdown, select your KMS key ARN,
- or paste the full key ARN from AWS KMS.
- Default AWS managed key for S3:
kms:Encrypt, kms:Decrypt, kms:GenerateDataKey at minimum for the project role).5. Save changes
- Scroll to the bottom of the page.
- Click Update artifacts (if present) and/or Update / Save to apply the changes to the project.
6. (Optional) Verify in S3
- Go to S3 → select the bucket used for artifacts.
- Open Properties → Default encryption:
- Ensure it is set to AWS KMS (or at least SSE-S3), and
- Confirm it matches your expected encryption settings.
If you share the exact scanner/tool (e.g., Security Hub, Checkov, etc.), I can tailor the final check to what that tool expects.
Using CLI
Using CLI
Below are the minimal steps to turn on artifact encryption for an AWS CodeBuild project using the AWS CLI.
This file will be used as a base for the update.
3. Edit
Open
You must supply the full configuration blocks required byKey parts for encryption:
You should see:
1. Identify the project and KMS key
Pick the project name and the KMS key you want to use (either an alias or key ARN):2. Get the current project configuration
3. Edit project.json to enable artifact encryption
Open project.json in an editor and construct an update-project payload.You must supply the full configuration blocks required by
update-project, not just the changed fields.Create a new file update-project.json with content like:"encryptionDisabled": false"encryptionKey": "YOUR_KMS_KEY_ARN_OR_ALIAS"
project.json.If you previously had multiple artifacts (secondaryArtifacts), repeat the same properties for each artifact that should be encrypted.4. Apply the update
5. Verify configuration
encryptionDisabled=falseencryptionKey= your KMS key ARN/alias
Using Python
Using Python
To remediate “Artifact Encryption Should Be Enabled” for an AWS CodeBuild project using Python, you need to:
You can then use either:
- Have (or create) a KMS key.
- Update the CodeBuild project’s
artifacts(and anysecondaryArtifacts) to:encryptionDisabled = False(or omit it)encryptionKey = <KMS key ARN or alias>
1. Prerequisites
boto3installed:- AWS credentials configured (via
aws configure, environment variables, or IAM role).
2. (Optional) Create a KMS Key in Python
If you don’t already have a KMS key you want to use:- ARN of the key, or
alias/codebuild-artifactsas the encryption key value.
3. Update an Existing CodeBuild Project to Enable Artifact Encryption
This script:- Gets the current project configuration.
- Reuses all existing fields.
- Updates
artifactsto enable encryption and set a KMS key. - Does the same for any
secondaryArtifactsif present.
4. Notes / Checks
- Ensure the CodeBuild service role has permission to use the KMS key:
- KMS key policy should allow
codebuild.amazonaws.comor the specific role ARNkms:Encrypt,kms:Decrypt,kms:GenerateDataKey*,kms:DescribeKey.
- KMS key policy should allow
- Verify encryption is enabled:
- In the console: CodeBuild → Project → Artifacts → check KMS key configured.
- Or via
batch_get_projectsand inspectartifacts["encryptionKey"]andartifacts["encryptionDisabled"].
Using Terraform
Using Terraform
encryption_disabled is set to false on the primary artifacts block (and any secondary_artifacts blocks) in Terraform instead of via aws codebuild update-project. This change is in-place and does not force replacement of the CodeBuild project.For verification, terraform plan should show the aws_codebuild_project update changing artifacts[*].encryption_disabled (and any secondary_artifacts[*].encryption_disabled) from true (or omitted) to false.
