As a Bitbucket Pipe user, you can use Bridge CLI to automate Polaris scanning in your CI pipeline. You can use Bridge CLI with Polaris in the following ways:
- Automate SCA scans
- Automate SAST scans
- Add Pull Request comments to Bitbucket
- Raise Fix Pull Requests for SAST and SCA vulnerabilities
- Export SARIF files
Before running a pipe with the Black Duck Security Scan Pipe, please read the Black Duck documentation on Bitbucket prerequisites.
Client scan tools can be configured using the Bridge CLI environment variables within the Black Duck Security Scan Pipe. For SAST scans the Coverity version can be selected using the BRIDGE_COVERITY_VERSION environment variable. Please refer to Complete List Of Bridge Commands for further details.
For an overview about using PR Comments, please see the following documentation page: Pull request (PR) comments
For an overview about Fix Pull Requests, please see the following documentation page: Fix pull requests (Fix PRs).
After completing the prerequisites, you may add the following code blocks to your bitbucket-pipelines.yml, and then run your pipe. A list of mandatory and optional parameters is provided below the code examples.
Simplified example:
security-scan: &blackduck-security-scan step: name: Black Duck Security Scan script: - pipe: blackduck-inc/blackduck-security-scan:1.6.0 variables: BRIDGE_POLARIS_SERVERURL: $POLARIS_SERVERURL BRIDGE_POLARIS_ACCESSTOKEN: $POLARIS_ACCESSTOKEN BRIDGE_POLARIS_ASSESSMENT_TYPES: 'SCA,SAST' ## Polaris SCA Binary Scan ## Requires that BRIDGE_POLARIS_ASSESSMENT_TYPES is set to SCA only #BRIDGE_POLARIS_TEST_SCA_TYPE: 'SCA-BINARY' #BRIDGE_POLARIS_ARTIFACTTOUPLOAD: '/path/to/source.zip' ## Polaris SCA Container Scan ## Requires that BRIDGE_POLARIS_ASSESSMENT_TYPES is set to SCA only #BRIDGE_POLARIS_TEST_SCA_TYPE: 'SCA-CONTAINER' #BRIDGE_POLARIS_ARTIFACTTOUPLOAD: '/path/to/container.tar.gz' #BRIDGE_POLARIS_CONTAINER_NAME: 'unique-container-name' # use for filtering ## Mandatory when BRIDGE_POLARIS_PRCOMMENT_ENABLED, BRIDGE_POLARIS_FIXPR_ENABLED or BRIDGE_POLARIS_REPORTS_SARIF_CREATE is set true. # BRIDGE_BITBUCKET_API_TOKEN: $BITBUCKET_REPO_ACCESS_TOKEN ## Pull Request Comments # BRIDGE_POLARIS_PRCOMMENT_ENABLED: 'true' ## Fix Pull Request Creation # BRIDGE_POLARIS_FIXPR_ENABLED: 'true' ## SARIF report generation # BRIDGE_POLARIS_REPORTS_SARIF_CREATE: 'true' ## Uncomment below configuration for signature scan # BRIDGE_POLARIS_TEST_SCA_TYPE: 'SCA-SIGNATURE' ## Uncomment below configuration for sigma rapid scan # BRIDGE_POLARIS_TEST_SAST_TYPE: 'SAST_RAPID' ## Mark build status if policy violating issues are found # MARK_BUILD_STATUS: 'success' ### Use below configuration for uploading artifacts if INCLUDE_DIAGNOSTICS or BRIDGE_POLARIS_REPORTS_SARIF_CREATE is enabled artifacts: - '.blackduck/integrations/polaris/sarif/report.sarif.json' # Used when BRIDGE_POLARIS_REPORTS_SARIF_CREATE is enabled - '.bridge/**' # Used when INCLUDE_DIAGNOSTICS is enabled pipelines: pull-requests: '**': # Matches all pull requests - <<: *blackduck-security-scan branches: '{main,master,develop,stage,release}': - <<: *blackduck-security-scanDetailed example:
pipelines: pull-requests: '**': - step: # runs-on: # Use this to specify self-hosted runners # - linux # Name of your Bitbucket runner script: - pipe: blackduck-inc/blackduck-security-scan:1.6.0 variables: BRIDGE_POLARIS_SERVERURL: $BRIDGE_POLARIS_SERVERURL BRIDGE_POLARIS_ACCESSTOKEN: $BRIDGE_POLARIS_ACCESSTOKEN BRIDGE_POLARIS_ASSESSMENT_TYPES: 'SCA,SAST' BRIDGE_POLARIS_APPLICATION_NAME: $BRIDGE_POLARIS_APPLICATION_NAME BRIDGE_POLARIS_PROJECT_NAME: $BRIDGE_POLARIS_PROJECT_NAME BRIDGE_POLARIS_BRANCH_NAME: $BRIDGE_POLARIS_BRANCH_NAME ### Enable Polaris PR scan BRIDGE_POLARIS_PRCOMMENT_ENABLED: 'true' BRIDGE_BITBUCKET_API_TOKEN: $BRIDGE_BITBUCKET_API_TOKEN ### BRIDGE_BITBUCKET_API_USER_NAME is required if App Password is set as BRIDGE_BITBUCKET_API_TOKEN # BRIDGE_BITBUCKET_API_USER_NAME: $BRIDGE_BITBUCKET_API_USER_NAME BRIDGE_POLARIS_PRCOMMENT_SEVERITIES: 'CRITICAL,HIGH' # BRIDGE_POLARIS_WAITFORSCAN: 'false' # Used to support the async mode ### Signature scan # BRIDGE_POLARIS_TEST_SCA_TYPE: 'SCA-SIGNATURE' ### Sigma rapid scan # BRIDGE_POLARIS_TEST_SAST_TYPE: 'SAST_RAPID' ### Uncomment this to use Source Upload method. Default value is hybrid (build based) # BRIDGE_POLARIS_TEST_SAST_LOCATION: 'remote' # BRIDGE_POLARIS_TEST_SCA_LOCATION: 'remote' # BRIDGE_PROJECT_SOURCE_ARCHIVE: $PROJECT_ARCHIVE # BRIDGE_PROJECT_SOURCE_EXCLUDES: $PROJECT_SOURCE_EXCLUDES #### Uncomment this to use Local Analysis feature # Please use Local Analysis or Source Upload exclusively # BRIDGE_POLARIS_TEST_SAST_LOCATION: 'local' ### Enable Bridge CLI diagnostics INCLUDE_DIAGNOSTICS: 'true' ### Mark build status if policy violating issues are found # MARK_BUILD_STATUS: 'success' ## Use custom image to configure paths and tools # CUSTOM_IMAGE: 'user/custom-blackduck-security-scan:maven' ## Use below parameters to authenticate private custom docker image # DOCKER_USERNAME: $DOCKER_USERNAME # DOCKER_PASSWORD: $DOCKER_PASSWORD # Supports Password and Personal Access Token ## Use this if the private docker image is hosted in internal docker registry # DOCKER_REGISTRY: $DOCKER_REGISTRY ## Uncomment to specify the directory to scan. Default value is repository root # BRIDGE_PROJECT_DIRECTORY: '/usr/local/my-project' # NETWORK_AIRGAP: true # BRIDGECLI_INSTALL_DIRECTORY:'/usr/local/bridge-cli-bundle' ## Coverity (SAST) Tools Settings # BRIDGE_COVERITY_CLEAN_COMMAND: 'mvn clean' # BRIDGE_COVERITY_BUILD_COMMAND: 'mvn clean install' # BRIDGE_COVERITY_CONFIG_PATH: '/usr/local/config/coverity.yml' # BRIDGE_COVERITY_ARGS: '-c /usr/local/config/coverity.yml -o capture.build.clean-command="mvn clean" -- mvn clean install' # BRIDGE_COVERITY_VERSION: '2025.9.0' ## Detect Tool Settings # BRIDGE_DETECT_SEARCH_DEPTH: 2 # BRIDGE_DETECT_ARGS: '--detect.diagnostic=true' # BRIDGE_DETECT_CONFIG_PATH: '/usr/local/config/application.properties' ### Use below configuration for uploading artifacts if INCLUDE_DIAGNOSTICS is enabled artifacts: - '.bridge/**' branches: '{main,master,develop,stage,release}': - step: # runs-on: # Use this to specify self-hosted runners # - linux # Name of your Bitbucket runner script: - pipe: blackduck-inc/blackduck-security-scan:1.6.0 variables: BRIDGE_POLARIS_SERVERURL: $BRIDGE_POLARIS_SERVERURL BRIDGE_POLARIS_ACCESSTOKEN: $BRIDGE_POLARIS_ACCESSTOKEN BRIDGE_POLARIS_ASSESSMENT_TYPES: 'SCA,SAST' BRIDGE_POLARIS_APPLICATION_NAME: $BRIDGE_POLARIS_APPLICATION_NAME BRIDGE_POLARIS_PROJECT_NAME: $BRIDGE_POLARIS_PROJECT_NAME BRIDGE_POLARIS_BRANCH_NAME: $BRIDGE_POLARIS_BRANCH_NAME ### Fix PR configuration # Generates automated fixable PRs for the assessment types configured in # BRIDGE_POLARIS_ASSESSMENT_TYPES (SAST, SCA, or both). # Requires BRIDGE_BITBUCKET_API_TOKEN BRIDGE_POLARIS_FIXPR_ENABLED: 'true' # Maximum number of Fix PRs across SAST and SCA combined. BRIDGE_POLARIS_FIXPR_MAXCOUNT: '5' # Upgrade guidance applies to SCA Fix PRs only. BRIDGE_POLARIS_FIXPR_USEUPGRADEGUIDANCE: 'SHORT_TERM,LONG_TERM' # Matching severities generate SAST and/or SCA Fix PRs, # depending on BRIDGE_POLARIS_ASSESSMENT_TYPES. BRIDGE_POLARIS_FIXPR_FILTER_SEVERITIES: 'CRITICAL,HIGH' ### Upload Polaris SARIF report as job artifact BRIDGE_POLARIS_REPORTS_SARIF_CREATE: 'true' BRIDGE_POLARIS_REPORTS_SARIF_FILE_PATH: '/usr/local/report/report.sarif.json' BRIDGE_POLARIS_REPORTS_SARIF_ISSUE_TYPES: 'SCA,SAST' BRIDGE_POLARIS_REPORTS_SARIF_SEVERITIES: 'CRITICAL,HIGH' BRIDGE_POLARIS_REPORTS_SARIF_GROUPSCAISSUES: 'true' # BRIDGE_POLARIS_WAITFORSCAN: 'false' # Used to support the async mode ### Signature scan # BRIDGE_POLARIS_TEST_SCA_TYPE: 'SCA-SIGNATURE' ### Sigma full scan # BRIDGE_POLARIS_TEST_SAST_TYPE: 'SAST_FULL' ### Uncomment this to use Source Upload method. Default value is hybrid (build based) # BRIDGE_POLARIS_TEST_SAST_LOCATION: 'remote' # BRIDGE_POLARIS_TEST_SCA_LOCATION: 'remote' # BRIDGE_PROJECT_SOURCE_ARCHIVE: $PROJECT_ARCHIVE # BRIDGE_PROJECT_SOURCE_EXCLUDES: $PROJECT_SOURCE_EXCLUDES #### Uncomment this to use Local Analysis feature # Please use Local Analysis or Source Upload exclusively # BRIDGE_POLARIS_TEST_SAST_LOCATION: 'local' ### Enable Bridge CLI diagnostics # INCLUDE_DIAGNOSTICS: 'true' ### BRIDGE_BITBUCKET_API_TOKEN is required to upload SARIF report and diagnostics in the Bitbucket downloads section, otherwise configure SARIF and diagnostics as artifacts in the bitbucket-pipelines.yml # BRIDGE_BITBUCKET_API_TOKEN: $BRIDGE_BITBUCKET_API_TOKEN ### BRIDGE_BITBUCKET_API_USER_NAME is required if App Password is set as BRIDGE_BITBUCKET_API_TOKEN # BRIDGE_BITBUCKET_API_USER_NAME: $BRIDGE_BITBUCKET_API_USER_NAME ### Mark build status if policy violating issues are found # MARK_BUILD_STATUS: 'success' ## Use custom image to configure paths and tools # CUSTOM_IMAGE: 'user/custom-blackduck-security-scan:maven' ## Use below parameters to authenticate private custom docker image # DOCKER_USERNAME: $DOCKER_USERNAME # DOCKER_PASSWORD: $DOCKER_PASSWORD # Supports Password and Personal Access Token ## Use this if the private docker image is hosted in internal docker registry # DOCKER_REGISTRY: $DOCKER_REGISTRY ## Uncomment to specify the directory to scan. Default value is repository root # BRIDGE_PROJECT_DIRECTORY: '/usr/local/my-project' # NETWORK_AIRGAP: true # BRIDGECLI_INSTALL_DIRECTORY:'/usr/local/bridge-cli-bundle' ## Polaris SCA Binary Scan ## Requires that BRIDGE_POLARIS_ASSESSMENT_TYPES is set to SCA only # BRIDGE_POLARIS_TEST_SCA_TYPE: 'SCA-BINARY' # BRIDGE_POLARIS_ARTIFACTTOUPLOAD: '/path/to/artifact.zip' ## Polaris SCA Container Scan ## Requires that BRIDGE_POLARIS_ASSESSMENT_TYPES is set to SCA only # BRIDGE_POLARIS_TEST_SCA_TYPE: 'SCA-CONTAINER' # BRIDGE_POLARIS_ARTIFACTTOUPLOAD: '/path/to/container.tar.gz' # BRIDGE_POLARIS_CONTAINER_NAME: 'unique-container-name' # use for filtering ## Coverity (SAST) Tools Settings # BRIDGE_COVERITY_CLEAN_COMMAND: 'mvn clean' # BRIDGE_COVERITY_BUILD_COMMAND: 'mvn clean install' # BRIDGE_COVERITY_CONFIG_PATH: '/usr/local/config/coverity.yml' # BRIDGE_COVERITY_ARGS: '-c /usr/local/config/coverity.yml -o capture.build.clean-command="mvn clean" -- mvn clean install' # BRIDGE_COVERITY_VERSION: '2025.9.0' ## Detect Tool Settings # BRIDGE_DETECT_SEARCH_DEPTH: 2 # BRIDGE_DETECT_ARGS: '--detect.diagnostic=true' # BRIDGE_DETECT_CONFIG_PATH: '/usr/local/config/application.properties' ### Use below configuration for uploading artifacts if INCLUDE_DIAGNOSTICS or BRIDGE_POLARIS_REPORTS_SARIF_CREATE is enabled artifacts: - '/usr/local/report/report.sarif.json' # Used when BRIDGE_POLARIS_REPORTS_SARIF_CREATE is enabled - '.bridge/**' # Used when INCLUDE_DIAGNOSTICS is enabled
List of mandatory and optional parameters for Polaris
| Input parameter | Description | Mandatory / optional |
|---|---|---|
BRIDGE_POLARIS_ACCESSTOKEN |
Polaris access token. You can use either a user access token (created in the Polaris UI) or a service account token here. |
Mandatory |
BRIDGE_POLARIS_APPLICATION_NAME |
Application name in Polaris. The Default Value is CI_PROJECT_NAME |
Optional |
BRIDGE_POLARIS_ASSESSMENT_TYPES |
Polaris assessment types Accepted values:
For DAST configuration requirements, see Using Bridge CLI With Polaris. |
Mandatory |
BRIDGE_POLARIS_BRANCH_NAME |
Branch name on the Polaris Server. The branch is created if it doesn't already exist. | Optional |
BRIDGE_POLARIS_BRANCH_PARENT_NAME |
Parent branch name on the Polaris Server. Parent branch name is used by the PR comments feature. | Optional |
BRIDGE_POLARIS_PROJECT_NAME |
Project name in Polaris. The Default Value is $BITBUCKET_REPO_SLUG |
Optional |
BRIDGE_POLARIS_SERVERURL |
Polaris server URL | Mandatory |
BRIDGE_BITBUCKET_API_TOKEN |
Bitbucket User Access Token. Example: BRIDGE_BITBUCKET_API_TOKEN: $BRIDGE_BITBUCKET_API_TOKEN |
Mandatory when BRIDGE_POLARIS_PRCOMMENT_ENABLED is set as true. |
BRIDGE_BITBUCKET_API_USER_NAME |
Specify your Bitbucket User Name to use features like Fix PRs, PR Comments, SARIF upload and diagnostics upload. This works in conjunction with your Bitbucket API token. | Mandatory when BRIDGE_POLARIS_PRCOMMENT_ENABLED is set as true. |
BRIDGE_PROJECT_DIRECTORY |
The project source directory. Defaults to the repository root directory. Set this to specify a custom folder that is other than repository root. | Optional |
BRIDGE_POLARIS_REPORTS_SARIF_CREATE |
Set this to true to generate SARIF report. Default: falseNote: SARIF reports can be generated for any configured branch; however, report generation is not supported in a merge request context.
|
Optional |
BRIDGE_POLARIS_REPORTS_SARIF_FILE_PATH |
File path (including file name) where SARIF report is created. Only Default: |
Optional |
BRIDGE_POLARIS_REPORTS_SARIF_ISSUE_TYPES |
Lists which assessment issues types to include in SARIF file report. Example: 'SCA,SAST' |
Optional |
BRIDGE_POLARIS_REPORTS_SARIF_SEVERITIES |
Comma-separated list of SAST/SCA issue severities to include in SARIF file report. Valid severities are Default: All severities are included. |
Optional |
BRIDGE_POLARIS_REPORTS_SARIF_GROUPSCAISSUES |
When set to true, SCA issues are grouped by component. Set this to false to list SCA issues by vulnerability. Default: |
Optional |
BRIDGE_POLARIS_PRCOMMENT_ENABLED |
Option to enable automatic creation pull request comments for new issues found in the merge request. Note: The merge request from the feature branch to the main branch must exist for this feature to work.
Default: |
Optional |
BRIDGE_POLARIS_PRCOMMENT_SEVERITIES |
The value should be a comma-separated list of severities. Comments are created for issues where the issue severity matches one of the values specified using this option. Valid severities are Default: |
Optional |
BRIDGE_POLARIS_FIXPR_ENABLED |
Enable automatic Fix Pull Request creation for eligible SAST and/or SCA issues. Creates Pull Requests containing dependency upgrades for SCA issues and AI-generated code fixes for SAST vulnerabilities, based on the configured assessment types. Only runs on push and workflow_dispatch events. Default :false. |
Optional |
BRIDGE_POLARIS_FIXPR_MAXCOUNT |
Maximum number of Fix Pull Requests to create per scan/workflow run. This limits the number of Pull Requests generated to avoid overwhelming the repository with too many automated Pull Requests at once. By default, a maximum count of five Fix PRs can be raised across both SAST and SCA scans, with SAST evaluated first. Dismissed issues are excluded, then the Default: |
Optional |
BRIDGE_POLARIS_FIXPR_USEUPGRADEGUIDANCE |
For SCA Fix PRs allows the user to specify short-term or long-term upgrade guidance, or both. If both values are provided, the first takes priority, and the second value is used only if the first returns no results. If upgrade guidance is not available, the Fix Pull Request is not created. Accepted Values:
Default: :SHORT_TERM,LONG_TERM. |
Optional |
BRIDGE_POLARIS_FIXPR_FILTER_SEVERITIES |
Creates Fix PRs only for issues with a severity matching a filter. The value is a comma-separated list. If both SAST and SCA assessments types are enabled, the specified severities are applied to issues from both assessment types. Accepted values: One or more of the following (comma-separated, case-insensitive):
Default: CRITICAL,HIGH |
Optional |
BRIDGE_POLARIS_ASSESSMENT_MODE |
The test mode type of the Polaris scan. Supported values: SOURCE_UPLOAD, CIDefault: Note: |
Optional |
BRIDGE_POLARIS_TEST_SAST_LOCATION |
Configure location of source code capture and SAST analysis. Supported values are hybrid, local and remote.
Default: In In In
remote mode Bridge zips source code and uploads to Polaris for full capture and analysis.Note: When Fix PRs are enabled and
BRIDGE_POLARIS_ASSESSMENT_TYPES includes SAST then valid values are hybrid or remote. If local is specified, Fix PRs will be skipped and a warning will be logged. |
Optional |
BRIDGE_POLARIS_TEST_SCA_LOCATION |
Configure location of source code capture and SCA analysis. Supported values are hybrid and remote.
Default: In In |
Optional |
BRIDGE_PROJECT_SOURCE_EXCLUDES |
A list of git ignore pattern strings that indicate the files need to be excluded from the zip file. | Optional |
BRIDGE_PROJECT_SOURCE_ARCHIVE |
The zipped source file path. It overrides the project directory. | Optional |
BRIDGE_POLARIS_TEST_SCA_TYPE |
Polaris SCA test type to trigger signature scan, package manager scan, container scan or binary scan. Default: SCA-PACKAGE Supported values:
Note:
SCA-BINARY and SCA-CONTAINER can only be used stand-alone. Those parameter values cannot be combined with SCA-PACKAGE or SCA-SIGNATURE in the same run. Attempting to mix scan types results in a validation error. |
Optional |
BRIDGE_POLARIS_ARTIFACTTOUPLOAD |
Path to an artifact file to be uploaded for analysis. Use this parameter when BRIDGE_POLARIS_TEST_SCA_TYPE is set to SCA-BINARY or SCA-CONTAINER.
Note: The file must be accessible from the execution environment. If the parameter is not specified, the scan fails validation.
Default:None |
Optional. Required when BRIDGE_POLARIS_TEST_SCA_TYPE is set to SCA-BINARY or SCA-CONTAINER. |
BRIDGE_POLARIS_CONTAINER_NAME |
A name to associate with the container image. The container name will be listed in the containers section of the project in the Polaris web UI and can also be used as a filter.
Default: None |
Optional. Required when BRIDGE_POLARIS_TEST_SCA_TYPE is set to SCA-CONTAINER. |
BRIDGE_POLARIS_TEST_SAST_TYPE |
Polaris test type to trigger sigma rapid scan or full scan. Supported values: Default: |
Optional |
BRIDGE_POLARIS_WAITFORSCAN |
Specifies whether or not the workflow should wait for the analysis to complete. Default: If set to |
Optional |