π AWS CodeBuild Project Bitbucket Source Location URL contains credentials π’
- Contextual name: π Project Bitbucket Source Location URL contains credentials π’
- ID:
/ce/ca/aws/codebuild/project-bitbucket-source-url-contains-creds
- Located in: π AWS CodeBuild
Flagsβ
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
Our Metadataβ
- Policy Type:
COMPLIANCE_POLICY
- Policy Category:
SECURITY
Similar Policiesβ
- AWS Security Hub
- [[CodeBuild.1] CodeBuild Bitbucket source repository URLs should not contain sensitive credentials]([CodeBuild.1] CodeBuild Bitbucket source repository URLs should not contain sensitive credentials (https://docs.aws.amazon.com/securityhub/latest/userguide/codebuild-controls.html#codebuild-1)]
- Internal
dec-x-cc74149f
Similar Internal Rulesβ
Rule | Policies | Flags |
---|---|---|
βοΈ dec-x-cc74149f | 1 |
Logicβ
- π§ prod.logic.yaml π’
Descriptionβ
Descriptionβ
This policy checks that AWS CodeBuild projects that use Bitbucket as a source repository do not embed credentials within the repository URL.
Rationaleβ
Storing credentials directly in repository URLs is a critical security risk. These credentials can be inadvertently captured in build logs, command line history, or intercepted in transit, leading to unauthorized access to the source code repository. The recommended and more secure method for granting CodeBuild access to Bitbucket repositories is using OAuth.
Auditβ
This policy marks an AWS CodeBuild Project as
INCOMPLIANT
if the project'sSource Type
is set to BITBUCKET and theSource Location
URL has an @ character embedded credentials in the URL.Projects with any other
Source Type
are flagged asINAPPLICABLE
.
Remediationβ
Remediationβ
From Consoleβ
To eliminate embedded credentials and configure
OAuth
authentication for your AWS CodeBuild Project:
- Locate and select the build project that currently references credentials in its source URL.
Edit
Source Configuration Under Source, chooseDisconnect from Bitbucket
to remove the existing basicβauth or Personal Access Token linkage.- Click
Connect using OAuth
. SelectConnect to Bitbucket
. When prompted, grant the required OAuth permissions to allow CodeBuild secure, tokenβbased access.- Enter or confirm your repository URL (omit any embedded credentials).
- Adjust any additional sourceβconfiguration parameters (e.g., buildβββspec path, webhook triggers).
- Click
Update
source to apply the new OAuthβbased authentication and complete remediation.