A Bitbucket Pipe containing a collection of open source tools to perform various types of additional analysis on a CycloneDX or SPDX sBOM (Software Bill of Materials).

ShiftSBOM-Utils

SonarQube Cloud

Quality Gate Status Bugs Code Smells Coverage Duplicated Lines (%) Vulnerabilities Security Rating

Build Badge GitHub release (latest by date)

ShiftSBOM-Utils is a pure client-side Bitbucket Pipe containing a collection of open source tools to perform various types of additionl analysis on a CycloneDX or SPDX sBOM (Software Bill of Materials). No subscriptions, server access, or API keys are required.

The official copy this project is hosted on Bitbucket. In order to reach a diverse audience a copy of the repo also exists in GitHub. Pull Requests should be submitted to the to the Bitbucket reposiotry and changes will be kept in sync.

Existing toolset and roadmap

The following tooling/functionally is currently available in this pipe

Current Tools

Tool/FeatureDescriptionFrom Version
devops-kung-fu/bomberScans Software Bill of Materials (SBOMs) for security vulnerabilities1.0.0
interlynk-io/sbomqsSBOM quality score - Quality metrics for your sboms1.1.1
osv-scannerVulnerability scanner which uses the data provided by the osv.dev1.2.0
grypeA vulnerability scanner for container images and filesystems1.4.0
OWASP Dependency TrackConsumes and analyzes CycloneDX BOMs at high-velocity1.5.0

Future Tools & Featurs

To requrst other tooling/features or to vote to have a specific tool/feature integreted next, open an issue

YAML Definition

The following is an example of a Bitbucket Pipeline which performs the following:

  1. Installes dependencies for a npm project
  2. Produces a sBOM via cyclonedx-npm-pipe or cyclonedx-bitbucket-pipe
  3. Uses sbom-utilities-pipe to furter process the sBOM

In the following example the sbom-utilities-pipe scans the sBOM for vulnerabilities using devops-kung-fu/bomber then scans the sbom to generate a quality score using interlynk-io/sbomqs. The following code snip would need to be added to the bitbucket-pipelines.yml file

pipelines:
  default:
    - step:
        name: Build and Test
        caches:
          - node
        script:
          - npm install
          - npm test
    - step:
        name: Gen CycloneDX sBom
        caches:
          - node
        script:
          # the build directory is owned by root but the pipe runs as the bitbucket-user
          # change the permission to allow the pipe to write to the build directory
          - chmod 777 build
          - pipe: docker://ccideas/cyclonedx-npm-pipe:1.5.0
            variables:
              IGNORE_NPM_ERRORS: 'true' # optional
              NPM_SHORT_PURLS: 'true' # optional
              NPM_OUTPUT_FORMAT: 'json' # optional
              NPM_PACKAGE_LOCK_ONLY: 'false' # optional
              OUTPUT_DIRECTORY: 'build' # optional # this dir should be archived by the pipeline
        artifacts:
          - build/*
  - step:
      name: Process sBOM
      script:
        # the build directory is owned by root but the pipe runs as the bitbucket-user
        # change the permission to allow the pipe to write to the build directory
        - chmod 777 build
        - pipe: docker://ccideas/sbom-utilities-pipe:1.7.0
          variables:
            PATH_TO_SBOM: "build/${BITBUCKET_REPO_SLUG}.json"
            OUTPUT_DIRECTORY: 'build'
            # bomber config
            SCAN_SBOM_WITH_BOMBER: 'true'
            BOMBER_OUTPUT_FORMAT: 'html'
            BOMBER_DEBUG: 'true'
            # sbomqs config
            SCAN_SBOM_WITH_SBOMQS: 'true'
            SBOMQS_OUTPUT_FORMAT: 'json'
            # osv config
            SCAN_SBOM_WITH_OSV: 'true'
            OSV_OUTPUT_FORMAT: 'json'
            # grype config
            SCAN_SBOM_WITH_GRYPE: 'true'
            GRYPE_ARGS: '--output table --add-cpes-if-none'
            GRYPE_OUTPUT_FILENAME: 'grype-scan-results.txt'
            # OWASP Dependency Track
            SEND_SBOM_TO_DTRACK: 'true'
            DTRACK_URL: '<<DTRACK URL: ie - http://url:port>>'
            DTRACK_PROJECT_ID: '<<DTRACK PROJECT ID>>'
            DTRACK_API_KEY: '<<DTRACK API KEY>>'
        artifacts:
          - build/*

Variables

VariableUsageOptionsDefaultRequired
PATH_TO_SBOMUsed to specify the name of the sbom file to further processtrue
OUTPUT_DIRECTORYUsed to specify the directory to place all output inbuildfalse
SCAN_SBOM_WITH_BOMBERUsed to scan the sBOM for vulnerabilities using bombertrue, falsefalsefalse
BOMBER_DEBUGUsed to enable debug mode during bomber scantrue, falsefalsefalse
BOMBER_IGNORE_FILEUsed to tell bomber what CVEs to ignorenonefalse
BOMBER_PROVIDERUsed to specify what vulnerability provider bomber will useosv, ossindexosvfalse
BOMBER_PROVIDER_TOKENUsed to specify an API token for the selected providernonefalse
BOMBER_PROVIDER_USERNAMEUsed to specify an username for the selected providernonefalse
BOMBER_OUTPUT_FORMATUsed to specify the output format of the bomber scanjson, html, stdoutstdoutfalse
SCAN_SBOM_WITH_SBOMQSUsed to scan the sBOM in order to generate a quality quality scoretrue, falsefalsefalse
SBOMQS_OUTPUT_FORMATUsed to specify the output format of the sbomqs scandetailed, jsondetailedfalse
SCAN_SBOM_WITH_OSVUsed to scan the sBOM for vulberabilities using osv scannertrue, falsefalsefalse
OSV_ARGScmd args to use when running osv-scannersee osv-scanner scan –help for full listfalse
OSV_OUTPUT_FILENAMEUsed to specify the filename to store the osv scan outputauto-generatedfalse
SCAN_SBOM_WITH_GRYPEUsed to scan the sBOM for vulberabilities using the grype scannertrue, falsefalsefalse
GRYPE_ARGScmd args to use when running grypesee grype –help for full listfalse
GRYPE_OUTPUT_FILENAMEthe file to write grype ouput toauto-generatedfalse
SEND_SBOM_TO_DTRACKUsed to send the sbom to a downstream dependency track servertrue, falsefalsefalse
DTRACK_URLThe URL includeing http/https and the port number of the DTrack API is running onnonetrue
DTRACK_PROJECT_IDThe project id to send the sbom to in dependency tracknonetrue
DTRACK_API_KEYThe team API key with BOM_UPLOAD permissionsnone

Support for OWASP Dependency Track

As of release 1.5.0 the sbom-utilities-pipe allows you to simpily send your CycloneDX sBOM to a OWASP Dependency track server for further analysis. The sbom-utilities-pipe uses dependency tracks /v1/bom PUT API for the request. To use this feature it is recommended you configure the following variables as secured repository variables in your Bitbucket project configuration.

DTRACK_URL DTRACK_PROJECT_ID DTRACK_API_KEY

Then configure your bitbucket-pipelines.yml with the following

- step:
      name: Process sBOM
      script:
        # the build directory is owned by root but the pipe runs as the bitbucket-user
        # change the permission to allow the pipe to write to the build directory
        - chmod 777 build
        - pipe: docker://ccideas/sbom-utilities-pipe:1.5.0
          variables:
            SEND_SBOM_TO_DTRACK: 'true'
            DTRACK_URL: ${DTRACK_URL}
            DTRACK_PROJECT_ID: ${DTRACK_PROJECT_ID}
            DTRACK_API_KEY: ${DTRACK_API_KEY}

Once the API call is successful the response ID will be logged as such

Response Body: {"token":"9ad9d8f9-273f-4d99-ae16-8fc89c21cd4d"}

Need an sBOM

This project contains some sample sBOMs which can be found in the examples/sboms directory. To produce a sBOM for a given project you can use any of the following Bitbucket Pipes

Live Example

A working pipeline for the popular auditjs tool has been created as an example. The pipeline in this fork of the auditjs tool will install the required dependencies then generate a CycloneDX sBOM containing all the ingredients which make up the product then the sBOM will be further processed by the sbom-utilities-pipe

Support

If you’d like help with this pipe, or you have an issue, or a feature request, let us know.

If you are reporting an issue, please include:

the version of the pipe relevant logs and error messages steps to reproduce

Credits

This Bitbucket pipe is a collection and integration of the following open source tools

A big thank-you to the teams and volunteers who make these amazing tools available