Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Rule: CodeBuild GitHub or Bitbucket Source Repository URLs Should Use OAuth

This rule ensures that CodeBuild project source repository URLs are configured to use OAuth for GitHub or Bitbucket.

RuleCodeBuild GitHub or Bitbucket source repository URLs should use OAuth
FrameworkFederal Financial Institutions Examination Council (FFIEC)
Severity
Critical

Rule Description:

According to the policy of the Federal Financial Institutions Examination Council (FFIEC), CodeBuild GitHub or Bitbucket source repository URLs should use OAuth for authentication. This ensures secure access to the repositories and protects sensitive code and data.

Using OAuth (Open Authorization) for authentication allows CodeBuild to securely connect to the source repositories without directly handling or storing user credentials. OAuth enables the use of access tokens, ensuring that only authorized users can access the repositories.

Troubleshooting Steps:

If you encounter any issues with OAuth authentication for CodeBuild GitHub or Bitbucket source repositories, follow these troubleshooting steps:

  1. 1.

    Verify OAuth Setup:

    • Check if your GitHub or Bitbucket account is properly configured to use OAuth.
    • Ensure you have generated and stored the necessary OAuth tokens for CodeBuild.
  2. 2.

    Review Token Permissions:

    • Confirm that the OAuth token being used has the required permissions to access the repositories.
    • Check if the necessary read or write permissions are enabled for the token.
  3. 3.

    Validate Repository Access:

    • Ensure that the repository you are trying to access through CodeBuild is configured correctly.
    • Verify that CodeBuild has the necessary permissions to access the repository using OAuth.
  4. 4.

    Check Token Expiration:

    • OAuth tokens have an expiration time. If the token has expired, generate a new one and update it in the CodeBuild configuration.
  5. 5.

    Review CodeBuild Configuration:

    • Double-check the CodeBuild configuration to ensure that the repository URL is correct and the OAuth token is properly provided.
  6. 6.

    Verify Network Connectivity:

    • Confirm that CodeBuild has proper network connectivity to reach the GitHub or Bitbucket OAuth APIs.
    • Check for any network restrictions or firewall rules that might be blocking the communication.
  7. 7.

    Review Error Messages:

    • Pay attention to any error messages or logs provided by CodeBuild during the OAuth authentication process.
    • Analyze the error messages to identify the root cause of the issue.

Necessary Codes:

In most cases, setting up OAuth for CodeBuild GitHub or Bitbucket repository URLs will require configuration changes within the respective platform's settings. Below are some example codes to configure OAuth authentication for both GitHub and Bitbucket repositories:

GitHub OAuth Configuration:

  1. 1.

    Generate an OAuth token for CodeBuild:

    • Go to your GitHub account settings.
    • Navigate to "Developer settings" > "Personal access tokens".
    • Click on "Generate new token" and provide a meaningful note.
    • Select the appropriate scopes for repository access.
    • Click "Generate token" and make sure to copy the generated token.
  2. 2.

    Configure CodeBuild with the OAuth token:

    • Update your CodeBuild project's buildspec or configuration file.
    • Add the generated OAuth token in the appropriate field for the GitHub repository URL.
    • Save and commit the changes to the CodeBuild configuration.

Bitbucket OAuth Configuration:

  1. 1.

    Generate an OAuth token for CodeBuild:

    • Go to your Bitbucket account settings.
    • Navigate to "Access Management" > "OAuth".
    • Click on "Add consumer" and provide the necessary details.
    • Specify the appropriate permissions for repository access.
    • Click "Save" and make sure to copy the generated OAuth key and secret.
  2. 2.

    Configure CodeBuild with the OAuth credentials:

    • Update your CodeBuild project's buildspec or configuration file.
    • Add the generated OAuth key and secret in the appropriate fields for the Bitbucket repository URL.
    • Save and commit the changes to the CodeBuild configuration.

Step-by-step Guide for Remediation:

To ensure that your CodeBuild GitHub or Bitbucket source repository URLs use OAuth authentication, follow these step-by-step instructions:

  1. 1.

    Determine the repository URL:

    • Identify the GitHub or Bitbucket repository URL you want to configure for CodeBuild.
  2. 2.

    Generate OAuth token or credentials:

    • For GitHub: a. Go to your GitHub account settings. b. Navigate to "Developer settings" > "Personal access tokens". c. Click on "Generate new token" and provide a meaningful note. d. Select the appropriate scopes for repository access. e. Click "Generate token" and copy the generated token.
    • For Bitbucket: a. Go to your Bitbucket account settings. b. Navigate to "Access Management" > "OAuth". c. Click on "Add consumer" and provide the necessary details. d. Specify the appropriate permissions for repository access. e. Click "Save" and copy the generated OAuth key and secret.
  3. 3.

    Configure CodeBuild with OAuth credentials:

    • Update your CodeBuild project's buildspec or configuration file.
    • Locate the respective field for the GitHub or Bitbucket repository URL.
    • Add the OAuth token or credentials in the appropriate fields.
    • Save and commit the changes to the CodeBuild configuration.
  4. 4.

    Validate the OAuth configuration:

    • Trigger a build in CodeBuild that requires accessing the repository.
    • Monitor the build logs for any OAuth-related errors.
    • If the build succeeds without any authentication issues, the OAuth configuration is successfully applied.

By following these steps, you will ensure that your CodeBuild GitHub or Bitbucket source repositories adhere to the FFIEC policy, utilizing OAuth for secure authentication.

Is your System Free of Underlying Vulnerabilities?
Find Out Now