microsoft/sbom-tool
C#
Captured source
source ↗microsoft/sbom-tool
Description: The SBOM tool is a highly scalable and enterprise ready tool to create SPDX 2.2 compatible SBOMs for any variety of artifacts.
Language: C#
License: MIT
Stars: 2035
Forks: 199
Open issues: 92
Created: 2022-06-01T16:58:49Z
Pushed: 2026-06-10T04:45:29Z
Default branch: main
Fork: no
Archived: no
README:
SBOM Tool
Introduction
The SBOM tool is a highly scalable and enterprise ready tool to create SPDX 2.2 and SPDX 3.0 compatible SBOMs for any variety of artifacts. The tool uses the Component Detection libraries to detect components and the ClearlyDefined API to populate license information for these components.
Table of Contents
- [Download and Installation](#download-and-installation)
- [Run the tool](#run-the-tool)
- [Integrating SBOM tool to your CI/CD pipelines](#integrating-sbom-tool-to-your-cicd-pipelines)
- [Telemetry](#telemetry)
- [Contributing](#contributing)
- [Security](#security)
- [Trademarks](#trademarks)
Download and Installation
Executables for Windows, Linux, macOS
We distribute executables and SBOM files of the tool in GitHub Releases page. You can go and download binaries manually or use commands below to get the latest version of the tool for your platform.
Please check the [CLI Reference](docs/sbom-tool-cli-reference.md) document for additional help regarding the CLI tool.
Package managers
##### WinGet
winget install Microsoft.SbomTool
##### Homebrew
brew install sbom-tool
Manual download
##### Windows (PowerShell)
Invoke-WebRequest -Uri "https://github.com/microsoft/sbom-tool/releases/latest/download/sbom-tool-win-x64.exe" -OutFile "sbom-tool.exe"
##### Linux (curl)
curl -Lo sbom-tool https://github.com/microsoft/sbom-tool/releases/latest/download/sbom-tool-linux-x64 chmod +x sbom-tool
##### macOS (curl)
curl -Lo sbom-tool https://github.com/microsoft/sbom-tool/releases/latest/download/sbom-tool-osx-x64 chmod +x sbom-tool
Building SBOM tool as docker image
Clone this repo and build the docker image.
git clone https://github.com/microsoft/sbom-tool cd sbom-tool docker build . -t ms_sbom_tool
You can then use the tool normally, by mounting the directories to be scanned using docker bind mounts.
SBOM .NET Tool
The sbom-tool can also be installed as a .NET tool using the following command:
dotnet tool install --global Microsoft.Sbom.DotNetTool
SBOM API NuGet package
Please add and authenticate the Microsoft GitHub NuGet package registry to your nuget.config. Then install the Microsoft.Sbom.Api package to your project using these instructions
Please check the [API Reference](docs/sbom-tool-api-reference.md) document for additional help regarding the SBOM tool C# Api.
Run the tool
SBOM Generation
Once you have installed the command line tool for your OS, run the tool using this command:
sbom-tool generate -b -bc -pn -pv -ps -nsb
The drop path is the folder where all the files to be shipped are located. All these files will be hashed and added to the files section of the SBOM. The build components path is usually your source folder, tool will scan this folder to search for project files like *.csproj or package.json to see what components were used to build the package. Tool uses component-detection to scan for components and dependencies, visit its Github page to get more information about supported components. The package name and version represent the package the SBOM is describing.
Each SBOM has a unique namespace that uniquely identifies the SBOM, we generate a unique identifier for the namespace field inside the SBOM, however we need a base URI that would be common for your entire organization. For example, a sample value for the -nsb parameter could be https://companyName.com/teamName, then the generator will create the namespace that would look like https://companyName.com/teamName///. Read more about the document namespace field for SPDX 2.2 and for SPDX 3.0 where it is part of namespaceMap.
Generation defaults to using SPDX 2.2. However you can modify the command to generate an SPDX 3.0 SBOM by adding the -mi argument with the value SPDX:3.0 like below:
sbom-tool generate -b -bc -pn -pv -ps -nsb -mi SPDX:3.0
A more detailed list of available CLI arguments for the tool can be found [here](docs/sbom-tool-arguments.md)
SBOM Validation
With an SBOM file in hand, use the tool to validate the output file with either command depending on the SPDX version:
sbom-tool validate -b -o -mi SPDX:2.2 sbom-tool validate -b -o -mi SPDX:3.0
This sample command provides the minimum mandatory arguments required to validate an SBOM: -b should be the same path used to generate the SBOM file. In the first scenario above, the tool will default to searching for an SBOM at the \_manifest\spdx_2.2\manifest.spdx.json path. In the first scenario above, the tool will default to searching for an SBOM at the \_manifest\spdx_3.0\manifest.spdx.json path. -o is the output path, including file name, where the tool should write the results to. -mi is the ManifestInfo, which provides the user's desired name and version of the manifest format.
SBOM Redact
Use the tool to redact any references to files from a given SBOM or set of SBOMs with either of the following commands:
sbom-tool redact -sd -o
sbom-tool redact -sp -o
This command will generate a mirrored set of SBOMs in the output directory, but with the file references removed. Note that the SBOM directory and output path arguments can not reference the same directory and the output path should point to an existing, empty directory.
Currently we only support redacting SPDX 2.2 SBOMs.
Integrating SBOM tool to your CI/CD pipelines
You can follow these…
Excerpt shown — open the source for the full document.