Amazon CodeBuild project environment variables should not contain credentials such as AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in clear text because these would be accessible to anyone with access to the CodeBuild console and AWS CLI, posing a security risk and making it easier for unauthorized personnel to access sensitive information.
To ensure the security of your secret access information and protect it from unauthorized personnel, the best practice is to avoid passing credentials via plaintext environment variables in CodeBuild project environments. Instead, opt for a more secure approach by storing sensitive data in the AWS Systems Manager Parameter Store or AWS Secrets Manager. This provides a safe and protected location to keep your credentials. Subsequently, you can retrieve these credentials from your build specification (buildspec) when needed, ensuring a secure way to pass sensitive information to your build projects.
Audit
To determine if CodeBuild project environment variables use clear text credentials, perform the following operations:
Remediation / Resolution
To remove environment variables with clear text credentials from your Amazon CodeBuild build projects, perform the following operations:
References
- AWS Documentation
- AWS CodeBuild FAQs
- Change a build project's settings in AWS CodeBuild
- Change a build project's settings (console)
- Change a build project's settings (AWS CLI)
- AWS Command Line Interface (CLI) Documentation
- list-projects
- batch-get-projects
- update-project