This quickstart explains how to set up the Black Duck Security Scan Pipe for Bitbucket to run a pipeline that integrates with Polaris to run a full scan and Pull Request scan. Pull Request review comments are only created for new issues created that are detected on the feature branch but not the target branch.
The full scan will be triggered by push and merge events on specified branches. Conversely, the Pull Request scan will be triggered by push events to Pull Requests that target those branches. Any new security issues introduced by a Pull Request will be added as review comments. After the scan completes, appropriate security reports and diagnostic logs will be exported as build artifacts. For full scans Fix Pull Requests will be created to upgrade dependencies.
Prerequisites
- The following reading is recommended before starting this quickstart:
- A Bitbucket Access Token is required to allow the pipeline to inject Pull Request review comments, raise Fix PR and upload SARIF reports.
- For security reasons, it is advisable not to store credentials and access tokens directly in the pipeline. The recommended approach is to use Bitbucket variables with the
securedoption checked. - The following Black Duck Security Scan Pipe parameters are required to enable injecting review comments into Pull Requests, raise Fix Pull Requests and upload SARIF reports. These have been included in the quickstart example:Important: Pull Request comments will not be injected, Fix Pull Requests will not be raised and SARIF reports will not be uploaded if these parameters and the required prerequisites are not correctly configured.
Parameter Description Example BRIDGE_POLARIS_PRCOMMENT_ENABLEDWhen true, this enables PR comments."true"BRIDGE_POLARIS_FIXPRR_ENABLEDWhen true, this enables raising Fix PRs."true"BRIDGE_POLARIS_REPORTS_SARIF_CREATEWhen true, for full scans this creates and uploads SARIF reports as a pipeline artifact, accessible from theArtifacttab of the pipeline job output."true"BRIDGE_POLARIS_SERVERURLURL of Polaris server instance. $POLARIS_SERVER_URLBRIDGE_POLARIS_ACCESSTOKENPolaris Access Token to enable integration with Polaris server. $POLARIS_ACCESS_TOKENBRIDGE_BITBUCKET_API_TOKENA Bitbucket Access Token. Required to inject review comments and upload SARIF reports. $BITBUCKET_REPO_ACCESS_TOKEN - Add the following variables and secured variables at the repository level () or workspace level ():
Variable Type Description Example POLARIS_SERVER_URLVariable Polaris Server URL https://polaris.blackduck.comPOLARIS_ACCESS_TOKENSecured Variable Polaris Access Token REPLACE_WITH_YOUR_TOKENBITBUCKET_REPO_ACCESS_TOKENSecured Variable A Bitbucket Access Token. Required to inject review comments, raise Fix PRs and upload SARIF reports. REPLACE_WITH_BITBUCKET_ACCESS_TOKENNote: The Black Duck Security Scan Pipe integrates with Polaris via Bridge CLI. Additional scan configuration options not available through the template's parameter set can be specified by defining relevant Bridge CLI environment variables within the workflow job.Polaris uses Coverity to perform SAST assessments. Coverity requires additional configuration for compiled languages. For languages that use a build system (such as C++, Java, etc.), Coverity must be configured with build and clean commands to capture and analyze the build.- The instructions below use pipeline parameters to specify build and clean commands.
- See Using Bridge with compiled languages for an explanation of the various methods available for configuring Bridge to integrate with Coverity to capture and analyze the build for compiled languages.
Instructions
Troubleshooting and support
If a pipeline error is encountered similar to the example below, then it is likely that the user credentials used to integrate with the Polaris server do not have a concurrent subscription.
Automatic application creation will fail for users with a parallel subscription. To create the application manually before running the workflow, consult create an application in Polaris.