Bitbucket
Setting up Corgea with Bitbucket
Corgea integrates seamlessly with Bitbucket to provide comprehensive vulnerability detection and remediation as part of your CI/CD pipeline. This guide walks you through setting up the integration to automatically scan your code, upload results to Corgea, and display findings directly in your pull requests.
Overview
The integration follows this workflow:
- Developer pushes code or opens a PR in Bitbucket
- Bitbucket Pipeline runs build, tests, and security scans
- Security scanner (e.g., Fortify SAST, Snyk, etc.) performs analysis and generates findings
- Corgea CLI uploads and processes the security results
- Results are posted back to Bitbucket as Code Insights
Prerequisites
Before setting up the integration, ensure you have:
- Administrative access to your Bitbucket repository
- A security scanning tool configured (e.g., Fortify SAST, Snyk, etc.)
- A Corgea API token (available in your account settings)
- Appropriate permissions to configure Bitbucket Pipelines
Integration Steps
Configure Repository Variables
In your Bitbucket repository settings, add the following repository variables:
CORGEA_API_TOKEN
: Your Corgea API tokenBITBUCKET_USERNAME
: A Bitbucket user with API accessBITBUCKET_APP_PASSWORD
: An app password with appropriate permissions
These variables will be securely used by the pipeline to authenticate with both Corgea and Bitbucket APIs.
Configure Bitbucket Pipelines
Create or update your bitbucket-pipelines.yml
file in the root of your repository. This file defines the CI/CD pipeline that will run your build, tests, and security scans.
How It Works
-
Trigger: When a developer pushes code or opens a PR, Bitbucket Pipelines automatically runs the configured pipeline.
-
Security Scan: The pipeline runs your chosen security scanner to analyze your code and generate results containing potential vulnerabilities.
-
Corgea Processing: The Corgea CLI uploads the results to Corgea’s cloud platform, which:
- Parses the security findings
- Deduplicates findings
- Uses AI to triage issues (BLAST)
- Optionally generates Git-diff fixes
-
Results Integration: The pipeline fetches the processed results from Corgea and posts them to Bitbucket Code Insights, making them visible directly in the PR.
-
Developer Feedback: Developers see security issues as inline comments in their code, with severity indicators and detailed explanations.
Viewing Results
After the pipeline completes, you can view the security findings in several ways:
- Pull Request View: Security annotations appear directly in the PR diff view
- Code Insights Tab: A summary report is available in the PR’s Code Insights tab
- Corgea Dashboard: Comprehensive analysis and fix suggestions are available in your Corgea dashboard
Troubleshooting
If you encounter issues with the integration, check the following:
- Ensure all repository variables are correctly set
- Verify that your security scan is completing successfully
- Check the Bitbucket Pipeline logs for any error messages
- Confirm that your Corgea API token has not expired