Explains how to set up a Black Duck Security Scan Action for a Polaris project that will run a full scan and Pull Request scan. Pull request review comments are created only for new issues detected in the feature branch but not in the target branch.
The full scan will be triggered by push and merge events on specified branches. GitHub issues will be created from scan findings. 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 on the Pull Request. For full scans Fix Pull Requests will be created to upgrade dependencies. After the scan completes, appropriate security reports and diagnostic logs will be exported as GitHub artifacts.
To find out more about the Black Duck Security Scan Action and what it can do, take a look at the overview page.
Note: The Bridge CLI can be used directly inside workflows. For further details, view the quickstart guide here: Quickstart: Polaris Bridge CLI in a GitHub workflow
Prerequisites
- The following reading is recommended before starting this quickstart:
- A GitHub Token is required for injecting Pull Request comments, raising Fix Pull Requests and creating GitHub issues from scan findings. See Polaris: Using the Black Duck Security Scan Action if need instructions. Important: Confirm that the token has workflow read and write permissions. In GitHub, navigate to .
- For security reasons, it is advisable not to store credentials directly in the workflow. The recommended approach is to use variables.
- The following Black Duck Security Scan Action parameters are required to enable injecting review comments into Pull Requests, raise Fix Pull Requests and create GitHub Issues. These parameters have been included in the quickstart example: Important: Pull Request comments will not be injected, Fix Pull Requests will not be raised and issues will not be created from scan findings if these parameters and the required prerequisites are not configured.
Parameter Description Example polaris_prComment_enabledWhen true, this enables PR comments.truepolaris_fixpr_enabledWhen true, this raises Fix PRs.truepolaris_externalIssues_createWhen true, this enables creation of GitHub issues from scan findings.truegithub_tokenA GitHub Personal Access Token with workflow read and write permissions. Required to inject review comments. ${{ secrets.GITHUB_TOKEN }}if using the built inGITHUB_TOKENor${{ secrets.MY_PAT_TOKEN }}to reference a custom token.Note: Black Duck Security Scan Action integrates with Polaris via Bridge CLI. Additional scan configuration options not available through the action's parameter set can be specified by defining relevant Bridge CLI environment variables within the workflow job.Note: Thepolaris_applicationandpolaris_project_nameboth default to the repository name. Furthermore,polaris_branch_nameandpolaris_branch_parent_nameuse the default values ofgithub.branch.nameandgithub.branch.parent.namerespectively. -
Add the following secrets and variables ():
Variable Type Description Example POLARIS_SERVER_URLVariable Polaris Server URL https://polaris.blackduck.comPOLARIS_ACCESS_TOKENSecret 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_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
Follow the steps below to integrate Polaris with the GitHub workflow for SAST and SCA scans:
Troubleshooting and support
If a workflow 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.
Important: Request Validation Failed: No concurrent entitlements found for the tenant
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.