This quickstart explains how to set up the Black Duck Security Scan Template to run a pipeline that integrates with Polaris to run a full scan and Merge Request scan. Merge Request review comments are only created for new issues created that are detected on the feature branch but not the target branch.
Prerequisites
-
The following reading is recommended before starting this quickstart:
- A GitLab Personal Access Token with at least
Developerprivileges andapiaccess is required to allow the pipeline to inject review comments into GitLab Merge Requests. - For security reasons, it is advisable not to store credentials directly in the workflow. The recommended approach is to use masked and hidden variables. Important: It is adviseable that these are added as project variables. Group variable inheritance can cause scans to fail under certain conditions. Be sure to set the mask variable flag for
POLARIS_ACCESSTOKENandGITLAB_USER_TOKENto avoid exposure in the CI logs. - The following Black Duck Security Scan Template parameters are required to enable injecting review comments into Merge Requests and raise Fix Merge Requests. The parameters have been included in the quickstart example: Important: Merge Request comments will not be injected and Fix Merge Requests will not be raised if these parameters and the prerequisites are not configured.
Parameter Description Example BRIDGE_POLARIS_APPLICATION_NAMEThe name of the Polaris application. $CI_PROJECT_NAMEBRIDGE_POLARIS_PRCOMMENT_ENABLEDWhen true, this enables PR comments."true"BRIDGE_POLARIS_FIXPR_ENABLEDEnable Fix Merge Request creation for SCA vulnerabilities. Creates Merge Requests with dependency upgrades to fix security issues. "true"BRIDGE_GITLAB_USER_TOKENA GitLab Personal Access Token with at least Developerprivileges andapiaccess. Required to inject review comments. The value should be a masked and hidden CI pipeline variable.$GITLAB_USER_TOKENNote: The Black Duck Security Scan Template 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. -
Add the following secrets and variables ():
Variable Type Description Example POLARIS_SERVERURLMasked Polaris Server URL https://polaris.blackduck.comPOLARIS_ACCESSTOKENMasked and hidden Polaris Access Token. You can use either a user access token (created in the Polaris UI) or a service account token here. REPLACE_WITH_YOUR_TOKENBRIDGECLI_LINUX64Variable Bridge CLI URL https://repo.blackduck.com/bds-integrations-release/com/blackduck/integration/bridge/binaries/bridge-cli-bundle/latest/bridge-cli-bundle-linux64.zip GITLAB_USER_TOKENMasked and hidden GitLab Personal Access Token with at least Developerprivileges andapiaccess. Required to inject review comments in Merge Requests.REPLACE_WITH_YOUR_TOKEN - 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 pipeline, consult create an application in Polaris.
If a pipeline error is encountered similar to the example below, then it is likely that organization firewall rules maybe restricting access to the template.
- Arrange access with the organization's IT department.
- Use a GitLab self managed runner.