Check provider logo

CodeBuild project using GitHub uses an allowed GitHub organization

codebuild_project_uses_allowed_github_organizations

Severityhigh
Servicecodebuild
by Prowler

CodeBuild projects sourcing from GitHub/GitHub Enterprise with a service role that trusts CodeBuild are evaluated by deriving the repository's organization from its URL and comparing it to an allowed organizations list.

Risk

Using repos from untrusted GitHub orgs can let external workflows assume the project role and obtain AWS credentials.

  • Confidentiality: data/secrets exfiltration
  • Integrity: unauthorized changes
  • Availability: build abuse or service disruption
Run this check with Prowler CLI

prowler aws --checks codebuild_project_uses_allowed_github_organizations

Recommendation

Limit sources to approved GitHub organizations via an explicit allowlist. Enforce least privilege on the CodeBuild service role and avoid admin rights. Apply separation of duties for allowlist changes and add defense in depth (branch protections, reviews, monitoring) to prevent workflow abuse.

Remediation

CLI

aws codebuild update-project --name <example_resource_name> --source type=GITHUB,location=https://github.com/<ALLOWED_GITHUB_ORG>/<REPO>

Native IaC
Terraform
Other
  1. Open the AWS Console and go to CodeBuild > Build projects
  2. Select the project and click Edit
  3. In Source, set Repository URL to https://github.com/<ALLOWED_GITHUB_ORG>/<REPO>
  4. Click Update to save

Source Code

Resource Type

AwsCodeBuildProject

References