Sign inSign up

ccideas/sbom-utilities-pipe

By ccideas

•Updated over 1 year ago

Bitbucket Pipe: Open tools for CycloneDX/SPDX sBOM analysis.

Image
Security
Developer tools
Monitoring & observability
0

5.7K

ccideas/sbom-utilities-pipe repository overview

⁠Bitbucket Pipelines Pipe: sBOM Utilities

A 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).

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/bomber⁠Scans Software Bill of Materials (SBOMs) for security vulnerabilities1.0.0⁠
interlynk-io/sbomqs⁠SBOM quality score - Quality metrics for your sboms1.1.1⁠
osv-scanner⁠Vulnerability scanner which uses the data provided by the osv.dev⁠1.2.0⁠
grype⁠A vulnerability scanner for container images and filesystems1.4.0⁠
⁠Future Tools & Featurs

The following are the next set of tools/features which will be incorported into this pipe. To requrst other tooling/features or to vote to have a specific tool/feature integreted next, open an issue⁠

Tool/FeatureDescription
sBOM SigningSign the sBOM using your priviate key to prove ownership
Distribution APISend your sBOM to servers such as DependencyTrack for storage and further analysis

And more

⁠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.3.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.4.0
          variables:
            PATH_TO_SBOM: "build/${BITBUCKET_REPO_SLUG}.json"
            SCAN_SBOM_WITH_BOMBER: 'true' # to enable a bomber scan
            BOMBER_OUTPUT_FORMAT: 'html'
            BOMBER_DEBUG: 'true'
            OUTPUT_DIRECTORY: 'build'
            SCAN_SBOM_WITH_SBOMQS: 'true' # to enable an sbomqs scan
            SBOMQS_OUTPUT_FORMAT: 'json'
            SCAN_SBOM_WITH_OSV: 'true' # to enable an osv scan
            OSV_OUTPUT_FORMAT: 'json'
            SCAN_SBOM_WITH_GRYPE: 'true' # to enable a grype scan
            GRYPE_ARGS: '--output table --add-cpes-if-none'
            GRYPE_OUTPUT_FILENAME: 'grype-scan-results.txt'
        artifacts:
          - build/*

⁠Variables

VariableUsageOptionsDefaultRequired
PATH_TO_SBOMUsed to specify the name of the sbom file to further processtrue
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_OUTPUT_FORMATUsed to specify the output format of the osv scantable, json, markdown, sarifjsonfalse
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
OUTPUT_DIRECTORYUsed to specify the directory to place all output inbuildfalse

⁠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 Pipe

⁠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

Tag summary

Content type

Image

Digest

sha256:b8fa1eed8…

Size

142.7 MB

Last updated

over 1 year ago

docker pull ccideas/sbom-utilities-pipe:1.7.0