Guided Walkthroughs

Configuration Packages

By Implementation

Service Control PoliciesConfig RulesAuto Remediation RulesConformance PacksAmazon GuardDutyAmazon InspectorAWS Security HubAWS Network FirewallRoute53 Resolver SecurityAmazon MacieS3 Bucket PoliciesCloudWatch Alarms and Event RulesAWS WAFAWS Secrets ManagerAWS Systems ManagerSecurity Groups & NACLsAWS KMSAWS SSOIAM PoliciesVPC Endpoint PoliciesCloudFormation Guard RulesLoad BalancersRDS Event SubscriptionsAWS Resource Access Manager (RAM)

By Service Protected

Reference Guides

Other

CloudFormation Guard Rules

Cloudformation Guard Rules for CodeBuild

CloudFormation guard rules template for AWS CodeBuild resources

The following rules are included: 

  • No Clear Text Credentials in Environment Variables
  • GitHub or Bitbucket Source Repository URLs use OAuth
CloudFormation Validation Tool: Syntax and Security validation for your templates online

let codebuild_projects = Resources.*[
	Type == "AWS::CodeBuild::Project"
]

let codebuild_sourcecredentials = Resources.*[
	Type == "AWS::CodeBuild::SourceCredential"
]

rule codebuild_env_variables_clear_text_value when %codebuild_projects !empty {
	%codebuild_projects {
		Properties {
			Environment !exists OR
			Environment exists
			when Environment exists {
				Environment {
					EnvironmentVariables !exists OR
					EnvironmentVariables exists
					when EnvironmentVariables exists {
						EnvironmentVariables.* {
							Type != "PLAINTEXT" OR
							Type == "PLAINTEXT"
							when Type == "PLAINTEXT" {
								Name NOT IN ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "PASSWORD"] <<Clear text credentials are used.>>
							}
						}
					}
				}
			}
		}
	}
}

rule github_bitbucket_oauth when %codebuild_sourcecredentials !empty {
	%codebuild_sourcecredentials {
		Properties {
			when ServerType in ["BITBUCKET","GITHUB","GITHUB_ENTERPRISE"] {
				AuthType == "OAUTH" <<OAuth credentials not used.>>
			}
		}
	}
}


Actions



Customize Template

* Required field

Upgrade to Premium for More Features
Sign up

Guided Walkthroughs
Step-by-step configuration wizards for your environment
Dedicated Security Account
AWS Backup Strategy
VPC Connectivity Setup
Automated Patching
All Guides
Configuration Packages
Pre-built packages for common configuration
Common SCPs
CloudFormation Guard Rules
Auto Remediation Rules
IAM Monitoring & Compliance
All Packages
Automated Assessments
  • 350+ security checks
  • Well-architected reviews
  • Detailed compliance reports
  • Remediation templates
  • Email summaries
  • Learn more