Languages

SBOMs for Ruby and Bundler

Bundler has no built-in SBOM command. sbombox generate detects Gemfile.lock and uses cdxgen or syft. The bundler-sbom plugin is the do-it-yourself option.

At a glance

Ruby and SBOMBox
Package managerBuilt-in SBOM commandWhat sbombox generate runsLockfile to commit
BundlerNocdxgen, then syftGemfile.lock

SBOMBox detects Ruby by Gemfile.lock. A project with only a Gemfile is not detected: run bundle lock and commit the lockfile.

Generate with SBOMBox

curl -fsSL https://sbombox.com/install.sh | sh

sbombox generate -o sbom.json
sbombox score sbom.json

To use cdxgen, which is more thorough but slower, install it with the CLI:

curl -fsSL https://sbombox.com/install.sh | SBOMBOX_GENERATORS=syft,cdxgen sh

To pin the choice, set SBOMBOX_GENERATOR to one or more generator names, comma-separated. SBOMBox tries them in that order and skips any that are not installed. An unknown name fails with the list of valid names.

SBOMBOX_GENERATOR=syft sbombox generate -o sbom.json

Use the bundler-sbom plugin

The plugin writes SPDX by default. -s cyclonedx writes CycloneDX JSON to bom-cyclonedx.json. --without leaves Bundler groups out.

bundler plugin install bundler-sbom
bundle sbom dump -s cyclonedx --without development:test
# See what lowers the score
sbombox score bom-cyclonedx.json --format detailed

# Check a ruleset, e.g. EU Cyber Resilience Act readiness
sbombox compliance bom-cyclonedx.json -p cra-readiness

# Upload it to the active project, labelled with the release
sbombox push bom-cyclonedx.json --version v1.4.0

Defaults have changed between plugin releases. Check the version you install and the file it writes.

Monorepos

Known gaps

Troubleshooting

Common Ruby issues
SymptomCauseFix
Could not detect project ecosystem in <dir>: no supported manifest or lockfile.Only a Gemfile, no Gemfile.lockRun bundle lock and commit Gemfile.lock
No SBOM generator found for ecosystems [...]. Install one with: curl -fsSL https://sbombox.com/install.sh | shNeither cdxgen nor syft is installedRun curl -fsSL https://sbombox.com/install.sh | sh
RSpec or RuboCop in the SBOMDevelopment and test groups includedUse bundler-sbom with --without development:test

In CI, run the same commands. See GitHub Actions, GitLab CI, Jenkins, Azure Pipelines, Bitbucket Pipelines or CircleCI, or use the GitHub Action.