Check ID:
Provider: AWS
Service:
Severity: CRITICAL
Categories:
Resource type:
codebuild_project_no_secrets_in_variablesProvider: AWS
Service:
codebuildSeverity: CRITICAL
Categories:
secrets, ci-cdResource type:
AwsCodeBuildProjectWhat this check verifies
AWS CodeBuild projects are inspected for plaintext environment variables (PLAINTEXT) that resemble secrets (keys, tokens, passwords).
Such values indicate sensitive data is stored directly in environment variables instead of being sourced securely.
Risk
Plaintext secrets in environment variables reduce confidentiality: values can be viewed in consoles/CLI and may leak into build logs or public outputs. Compromised credentials enable unauthorized AWS actions, artifact tampering, and lateral movement, causing data exfiltration and CI/CD supply-chain compromise.Recommendation
Store secrets outside the build and reference them via AWS Secrets Manager or AWS Systems Manager Parameter Store instead ofPLAINTEXT variables.
- Enforce least privilege on the build role
- Rotate secrets; prefer short-lived credentials
- Avoid logging or exporting secret values and never embed them in artifacts
Remediation
- Terraform
- Native IaC
- Dashboard steps
References
- https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html
- https://www.learnaws.org/2022/11/18/aws-codebuild-secrets-manager/
- https://www.learnaws.org/2023/08/23/codebuild-env-vars/
- https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-environmentvariable.html
- https://docs.aws.amazon.com/codebuild/latest/userguide/change-project.html
- https://docs.aws.amazon.com/securityhub/latest/userguide/codebuild-controls.html#codebuild-2
- https://pasmichal.medium.com/how-to-handle-secrets-in-aws-codebuild-6e1b96013712
- https://medium.com/@odofing/aws-codepipeline-how-to-securely-store-environment-variables-in-ssm-paramater-store-and-aws-9a96d7083b3c
Where this check fires
This check runs on every scheduled scan against your AWS account. Findings appear at Cloud Security → Findings filterable byCheck ID = codebuild_project_no_secrets_in_variables. To re-evaluate after a fix, hit Run now on the account’s schedule under Cloud Security → Schedules — the next scan re-checks this control and marks the finding fixed or keeps it persistent.
← Back to AWS checks