How to create an SBOM using Microsoft’s open source tool

that SBOM (Software Material List) It helps you understand your software supply chain by listing the packages and vendors your code depends on. SBOMs quickly gain momentum As a way to help improve security in the prominent heels Supply Chain Attacks in the Real World.

One of the main proponents of SBOMs is Microsoft that has spread its approach to their generation Back in October 2021. Earlier this year the company open source tool To produce SBOMs on Windows, macOS, and Linux.

In this article, you will learn how to get started with using the project to index your code dependencies. Produces SPDX-compliant documents that list files, packages, and relationships within your project. SPDX (Software Package Data Exchange) It is the accepted ISO standard for SBOMs so you can pass the generated reports directly to other ecosystem tools.

Microsoft originally announced the project under the name Salus. since then I gave up on this term Because it contradicts what exists Salus Code Security Project That originated on Coinbase. The SBOM generator is now simply referred to as sbom-tool.


You can download SBOM Tool from Microsoft GitHub repository. Pre-compiled binaries are available On the releases page. Select the appropriate download for your system, then make the binary executable and move it to a location in your path.

Here is an example for Linux:

$ wget<VERSION>/sbom-tool-linux-x64
$ chmod +x sbom-tool-linux-x64
$ mv sbom-tool-linux-x64 /usr/local/bin/sbom-tool

You must be able to run sbom-tool To display help information in your device window:

$ sbom-tool
No action was specified

The Sbom tool generates a SBOM for any build artifact.

Usage - Microsoft.Sbom.Tool <action> -options

SBOM . generation

New SBOMs are created by running the tool generate Sub leadership. Some arguments must be made:

  • -b (BuildDropPath) – the folder in which to save the generated SPDX SBOM data.
  • -bc (BuildComponentPath) – the folder to be scanned to find the dependencies in your project.
  • -nsb (NamespaceUriBase) – the base path that will be used as a namespace for the SBOM statement. This should be a URL owned by your organization, like

SBOM also needs to know the name and version of your project. This can often be inferred from files already in your repository, such as package.json name And the version fields, but you may need to provide the information manually or override the default settings in some cases. add the pn And the pv Flags to do this:

  • -pn (PackageName) – The name of your project or package.
  • -pv (PackageVersion) – The copy of the project you are scanning. This must match the version of the release your SBOM accompanies so that users can associate lists of dependencies with specific builds.

Here is an example of creating an SBOM for files in your working directory. SBOM will be placed in sbom-output sub directory. This must be present before running the tool.

$ mkdir sbom-output
$ sbom-tool generate -b sbom-output -bc . -pn example -pv 1.0 -nsb

An overview of the scan results will be displayed on your device:

[INFO] Enumerated 3728 files and 607 directories in 00:00:00.5938034 

[INFO] |Component Detector Id         |Detection Time                |# Components Found            |# Explicitly Referenced                 | 
[INFO] |Npm                           |0.63 seconds                  |241                           |0                                       | 
[INFO] |Total                         |0.64 seconds                  |241                           |0                                       | 

[INFO] Detection time: 0.6374678 seconds.

This project uses npm to manage its dependencies. The tool has detected 241 packages inside the working directory package.json a file.

SBOM currently supports 19 different programming languages ​​and package formats. The List includes npm, NuGet, PyPi, Maven, Rust Crates, Ruby gems, as well as Linux packages contained in Docker images. References to remote GitHub repositories are also supported.

SBOM . Contents

The generated SBOM will be written to _manifest/spdx_2.2/manifest.spdx.json Inside the build output directory you specified. SBOM is a fairly verbose JSON file intended for use by other programs.

{"Files": []"packets": [
      "name": "color-convert",
      "SPDXID": "SPDXRef-Package-A72B0922E46D9828746F346D7FD11B7F81EDEB15B92BEEDAE087F5F7407FECDC",

There are four main types of information within the report:

  • The files section – This lists all the files containing source code you’ve written in your project. SBOM Tool will only populate this section when certain project types are scanned, such as C# solutions.
  • The packages section – A complete catalog of all the third-party dependencies present in your project, with references to their source package manager, the version used, and the type of license that applies.
  • The relationships section – This details all the relationships between the components listed in the SBOM. The most common relationship you’ll see is DEPENDS_ON, which declares an item in the packages section as one of your project’s dependencies. Several other kinds of relationship also exist, such as CREATED_BY, DEPENDENCY_OF, and PATCH_FOR.
  • Report metadata details – Fields such as name, documentNamespace, spdxVersion, and creationInfo identify the SBOM, the tool used to create it, and the SPDX manifest revision that applies.

Now you’ve got an SBOM you can start using it with other tools to conduct vulnerability scans and manage license compliance. You can consider distributing the SBOM with your software releases so consumers are able to inspect the contents of each new version. SBOMs are best generated as part of your build pipeline so they stay up to date.

Having access to an SBOM is invaluable when major new supply chain problems appear. Organizations using SBOMs were better placed to respond to Log4j, for example. They could inspect their reports to quickly find projects depending on the vulnerable library, instead of auditing package lists by hand.

Scanning Docker Images

SBOM Tool is capable of scanning existing Docker images as part of a report generation. To use this capability, you need to add the -di flag and specify the image tag or digest that you want to scan. The rest of the arguments stay the same.

$ sbom-tool generate -di ubuntu:latest -b sbom-output -bc . -pn demo -pv 1.0 -nsb

The Docker image will be analyzed to identify the packages it includes. They’ll be added to the SBOM report alongside the dependencies found in your source folder. You can scan multiple Docker images in a single operation by separating their tags or digest hashes with commas.


SBOM Tool is a young open-source SBOM generation utility developed at Microsoft. It supports several leading package formats and produces SPDX-compatible output. This means you can feed generated SBOMs straight into other tools like Grype to automatically find security vulnerabilities and outdated dependencies.

SBOMs are an effective way to increase awareness of software supply chains and uncover lurking issues. Producing and distributing an SBOM helps users understand what’s being silently included in their project. SBOM Tool is one way to generate industry-standard reports with a single command, making it easier to offer an SBOM with each of your releases.

Source link

Related Posts