[](https://github.com/cdxgen/cdxgen)
[](./AI-DECLARATION.md)
[![JSR][badge-jsr]][jsr-cdxgen]
[![NPM][badge-npm]][npmjs-cdxgen]
[![GitHub Releases][badge-github-releases]][github-releases]
[![NPM Downloads][badge-npm-downloads]][npmjs-cdxgen]
[![GitHub License][badge-github-license]][github-license]
[![GitHub Contributors][badge-github-contributors]][github-contributors]
[![SWH][badge-swh]][swh-cdxgen]
# CycloneDX Generator (cdxgen)
cdxgen is a CLI tool, library, [REPL](./ADVANCED.md), and server to create, validate, sign, and verify software BOMs. It generates CycloneDX JSON BOMs and supports SPDX 3.0.1 JSON-LD export. CycloneDX is a full-stack BOM specification that is easily created, human and machine-readable, and simple to parse. The tool generates BOMs targeting CycloneDX specification versions 1.6, 1.7, and 2.0, and the output can be downgraded to 1.4 or 1.5 for legacy consumers.
Supported BOM formats:
- Hardware (HBOM) - For supported live hosts such as Apple Silicon macOS, Linux amd64/arm64, and Windows amd64/arm64 systems.
- Software (SBOM) - For many languages and container images.
- Cryptography (CBOM) - For Java keystores and certificates, plus JavaScript and TypeScript source-level algorithm inventory.
- Operations (OBOM) - For Linux container images and VMs running Linux or Windows operating systems.
- Software-as-a-Service (SaaSBOM) - For Java, Python, JavaScript, TypeScript, and PHP projects.
- AI/ML (AI-BOM) - For prompt files, AI services, MCP configs, and model metadata with explainable AI-governance, security, performance, and agentic findings.
- Attestations (CDXA) - Generate SBOM with templates for multiple standards. Sign the BOM document at a granular level to improve authenticity.
- Vulnerability Disclosure Report (VDR) - Use cdxgen with [OWASP depscan](https://github.com/owasp-dep-scan/dep-scan) to automate the generation of VDR at scale.
Supported output document formats:
- CycloneDX JSON (primary native format)
- SPDX 3.0.1 JSON-LD (`cdxgen --format spdx` or `cdx-convert`)
## Choose your path
| Persona | What cdxgen helps you do | First command | Read next |
| --------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| **Developers** | Generate a CycloneDX BOM from a local repo, git URL, purl, or container image | `cdxgen -o bom.json .` | [CLI Usage][docs-cli], [Supported Project Types][docs-project-types] |
| **AI platform teams** | Generate AI/ML BOMs, catalog prompt/model/MCP surfaces, and run AI-BOM governance | `aibom .` | [AI-BOM Guide](docs/AI_BOM.md), [AI-BOM lesson](docs/LESSON15.md) |
| **Hardware teams** | Generate an HBOM or merged HBOM+OBOM host view for the current host | `hbom -o hbom.json` | [HBOM guide](docs/HBOM.md), [HBOM lesson](docs/LESSON13.md) |
| **AppSec** | Enrich BOMs with evidence, run BOM audit rules, and feed downstream security workflows | `cdxgen -o bom.json --profile appsec --evidence --bom-audit .` | [BOM Audit](docs/BOM_AUDIT.md), [Threat Model](docs/THREAT_MODEL.md) |
| **Build engineers** | Grade how completely the SBOM captured the project, and get ranked fixes when the build environment degraded it | `cdxgen --profile introspect --introspect-fail-below 70 -o bom.json .` | [Build Introspection](docs/INTROSPECTION.md), [Fidelity loop skill](.agents/skills/sbom-fidelity-loop/SKILL.md) |
| **SOC analysts** | Build OBOM inventories for live hosts and triage runtime posture issues | `obom -o obom.json --deep --bom-audit --bom-audit-categories obom-runtime` | [OBOM lessons](docs/OBOM_LESSONS.md), [Server Usage][docs-server] |
| **Compliance teams** | Validate BOM quality, check SCVS/CRA posture, and export SPDX deliverables | `cdx-validate -i bom.json --benchmark scvs-l2,cra` | [cdx-validate](docs/CDX_VALIDATE.md), [cdx-convert](docs/CDX_CONVERT.md), [Permissions][docs-permissions] |
| **Security Teams** | Dynamically trace executions to capture cryptographic activities, CBOM properties, software components, and services | `tracebom --cmd "npm test" --trace-crypto -o cbom.json` | [Threat Model](docs/THREAT_MODEL.md) |
### Role-based quick starts
#### For developers
- Start with a local path, git URL, or purl and generate a BOM in one command.
- Use [Supported Project Types][docs-project-types] to confirm ecosystem coverage before wiring cdxgen into CI.
#### For hardware and platform teams
- Use `hbom` when you need a CycloneDX hardware inventory for the current host rather than a software dependency graph.
- Start with the [HBOM guide](docs/HBOM.md) and the [HBOM lesson](docs/LESSON13.md) for supported platforms, enrichment options, and validation workflows.
- Use `hbom --dry-run` first when you want a read-only partial HBOM plus an exact list of blocked hardware probe commands before a full collection run.
- Use `hbom diagnostics` when you want a focused summary of missing native utilities and permission-denied enrichments before deciding whether to install host packages or rerun with `--privileged`.
- Use `hbom --include-runtime` when you want one topology-aware CycloneDX host document that merges hardware inventory with runtime evidence using strict, non-guessing joins.
#### For AppSec
- Use `--profile appsec`, `--evidence`, and `--bom-audit` when you want richer security context.
- Combine generation with [BOM Audit](docs/BOM_AUDIT.md), [cdx-validate](docs/CDX_VALIDATE.md), signing, and verification for a fuller secure-SBOM workflow.
- Use `tracebom` to dynamically profile applications & services and capture negotiated TLS cipher suites, protocols, cryptographic libraries, dynamically resolved software components, and services in CycloneDX 1.7 format.
#### For AI platform and governance teams
- Use `--include-formulation` plus `--bom-audit --bom-audit-categories ai-bom` when you want one AI-BOM workflow for prompt files, AI services, MCP configs, and model metadata.
- Use `aibom` when you want the same defaults in one dedicated CLI, including direct Hugging Face purls/URLs and direct Modelfile / `.gguf` inputs.
- Start with the [AI-BOM Guide](docs/AI_BOM.md) and the [AI-BOM lesson](docs/LESSON15.md) for the preferred alias, review flow, and category breakdown.
#### For SOC analysts
- Use `obom` for live-system and runtime inventory on Linux, Windows, and macOS hosts.
- Focus on [OBOM lessons](docs/OBOM_LESSONS.md) when you need host triage, persistence review, Linux GTFOBins-backed runtime analysis, hardening drift review, or incident-response evidence.
#### For compliance and platform governance
- Use `cdx-validate` to assess structural and compliance posture, then `cdx-convert` when SPDX output is required.
- Review [Permissions][docs-permissions] and hardened-environment guidance before adopting cdxgen in controlled pipelines.
## Why cdxgen?
Most SBOM tools are like simple barcode scanners. For easy applications, they can parse a few package manifests and create a list of components only based on these files without any deep inspection. Further, a typical application might have several repos, components, and libraries with complex build requirements. Traditional techniques to generate an SBOM per language or package manifest either do not work in enterprise environments or don't provide the confidence required for both compliance and automated analysis. So we built cdxgen - the universal polyglot SBOM generator that is user-friendly, precise, and comprehensive!
**Our philosophy:**
- _Explainability:_ Don't list, but explain with evidence.
- _Precision:_ Try using multiple techniques to improve precision, even if it takes extra time.
- _Personas:_ Cater to the needs of a range of personas such as security researchers, compliance auditors, developers, and SOC.
- _Machine Learning:_ Optimize the generated data for Machine Learning (ML) purposes by considering the various model properties.
- _Safety:_ Execute external build tools and handle untrusted inputs defensively, with hardened defaults, a [secure mode](docs/PERMISSIONS.md) for sensitive environments, and a read-only `--dry-run` mode for review-first workflows.
## Documentation
Please visit our [documentation site][docs-homepage] for detailed usage, tutorials, and support documentation.
Sections include:
- [Getting Started][docs-homepage]
- [CLI Usage][docs-cli]
- [Migration to v13](MIGRATING-TO-V13.md)
- [HBOM Guide](docs/HBOM.md)
- [Merged Host View Lesson](docs/LESSON13.md)
- [Server Usage][docs-server]
- [Hands-on Lessons](docs/LESSON8.md)
- [Container Escape & Privilege Lesson](docs/LESSON9.md)
- [HBOM Lesson](docs/LESSON13.md)
- [Supported Project Types][docs-project-types]
- [Environment Variables][docs-env-vars]
- [Advanced Usage][docs-advanced-usage]
- [Permissions][docs-permissions]
- [cdx-audit Guide](docs/CDX_AUDIT.md)
- [cdx-convert Guide](docs/CDX_CONVERT.md)
- [cdx-validate Guide](docs/CDX_VALIDATE.md)
- [cdx-verify Guide](docs/CDX_VERIFY.md)
- [cdx-sign Guide](docs/CDX_SIGN.md)
- [Tracebom Guide](docs/TRACEBOM.md)
- [AI-BOM Guide](docs/AI_BOM.md)
- [MCP Inventory](docs/MCP.md)
- [REPL Guide](docs/REPL.md)
- [Custom Properties](docs/CUSTOM_PROPERTIES.md)
- [Claude Code Plugin](claude-plugin/README.md)
- [Deprecations](docs/DEPRECATIONS.md)
- [Security Policy](SECURITY.md)
- [Threat Model](docs/THREAT_MODEL.md)
- [Support (Enterprise & Community)][docs-support]
## Usage
## Installing
> [!IMPORTANT]
> **The npm package was renamed in v13.** v13 and later are published as
> [`@cdxgen/cdxgen`][npmjs-cdxgen]. v12 and earlier are published as
> [`@cyclonedx/cdxgen`][npmjs-cdxgen-v12], which stays on npm and continues to
> receive fixes on the `release/12.0.x` branch, but does not receive v13
> features.
>
> Upgrading means changing the package name, not just the version:
>
> ```shell
> npm uninstall -g @cyclonedx/cdxgen
> npm install -g @cdxgen/cdxgen --ignore-scripts --min-release-age=2
> ```
>
> The `cdxgen` command, the CLI flags, and the container images are unchanged.
> If you import cdxgen as a library, update the specifier:
> `import { createBom } from "@cdxgen/cdxgen"`.
cdxgen is distributed three ways. The **standalone executables** and **container
images** are the recommended choice for CI, production, and any environment
where you want a self-contained tool with no Node.js dependency. The npm package
is an alternative when you already manage JavaScript tooling or need cdxgen as a
library. See [npm and JavaScript package managers](#npm-and-javascript-package-managers)
below.
Regardless of how you install, the following commands are available:
| Command | Purpose | Standalone GitHub release binary |
| --------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
| `cdxgen` | Generate CycloneDX / SPDX BOMs from source, images, binaries, git URLs, or purls | yes |
| `aibom` | Generate CycloneDX AI/ML BOMs from source, Hugging Face URLs/purls, Modelfiles, or GGUF artifacts (`-t ai` defaults) | yes |
| `hbom` | Generate a CycloneDX hardware BOM for the current host | yes (`hbom`, `hbom-slim`) |
| `tracebom` | Trace command execution to capture dynamic CBOM, cryptographic properties, software components, and services | yes |
| `cdx-audit` | Prioritize existing BOM dependencies for upstream supply-chain review using explainable risk signals | yes |
| `cdx-convert` | Convert CycloneDX JSON to SPDX 3.0.1 JSON-LD | yes |
| `cdx-sign` | Sign BOMs with JSF signatures | yes |
| `cdx-validate` | Validate BOMs and benchmark posture | yes |
| `cdx-verify` | Verify BOM signatures | yes |
| `cdxi` | Open the interactive REPL | no |
| `evinse` | Add evidence, reachability, and service context | no |
| `cbom` | Alias for CBOM-oriented `cdxgen` defaults | yes |
| `obom` | Alias for `cdxgen -t os` | yes |
| `saasbom` | Alias for SaaSBOM-oriented `cdxgen` defaults | yes |
| `spdxgen` | Alias for `cdxgen --format spdx` | use `cdxgen` |
| `cdxgen-secure` | Alias for hardened `cdxgen` defaults | use `cdxgen` |
Standalone GitHub release binaries are published for `cdxgen`, `cdxgen-slim`, `aibom`, `cbom`, `obom`, `saasbom`, `hbom`, `hbom-slim`, `cdx-audit`, `cdx-convert`, `cdx-sign`, `cdx-validate`, `cdx-verify`, and `tracebom`.
`hbom` release binaries bundle both `@cdxgen/cdx-hbom` and the matching `@cdxgen/cdxgen-plugins-bin*` companion helpers for the target platform. `hbom-slim` keeps the dedicated hardware collector (`@cdxgen/cdx-hbom`) but omits the companion plugin bundle when you want the smallest single-file HBOM executable.
The `cbom` and `saasbom` release binaries bundle the Atom analysis stack (`@appthreat/atom` and `@appthreat/atom-parsetools`) plus protobuf export support (`@cdxgen/cdx-proto` and `@bufbuild/protobuf`). As of atom 3, `cbom` and `saasbom` embed a native atom binary and need **no JDK** on linux-amd64, linux-arm64 (glibc), linux-amd64-musl, darwin-arm64, and windows-amd64. On the jar-kind triples (darwin-amd64, windows-arm64, and linux-arm64-musl), the embedded atom still runs on the JVM and requires Java 23+. The `obom` release binary bundles the matching platform plugin package, pruned to runtime OS inventory helpers, plus the same protobuf export support. These aliases therefore support `--export-proto --proto-bin-file ` without requiring a separate npm install.
`cdx-audit` is designed to accelerate upstream dependency review with explainable, evidence-backed risk prioritization. It complements provenance, reproducibility, and manual investigation rather than replacing them. Beyond the basic `cdx-audit --bom bom.json` usage, it supports three reporters (`--report console|json|sarif`), scope selection (`--scope all|required`), trusted-publishing filters (`--include-trusted` and `--only-trusted`), and license policies via `--license-policy`. Non-zero exit codes on findings make it easy to gate CI pipelines. See the [cdx-audit guide](docs/CDX_AUDIT.md) for the full reference.
For AI-heavy repositories, cdxgen also supports an AI-BOM workflow via the `aibom` command or the `-t ai` project type aliases (`ai`, `aibom`, `ai-bom`). This emits AI service/model evidence and pairs naturally with the `ai-bom` BOM-audit category alias for governance, security, performance, AI-agent, and MCP findings.
For host inventories, `hbom --include-runtime` produces a merged HBOM + OBOM view with strict topology links such as interface-name, driver-module, storage/runtime (including Windows drive letters), and explicit secure-boot trust matches, plus a `host-topology` BOM audit pack for higher-confidence host findings. When the live hardware collector reports missing utilities or permission-sensitive enrichments, use `hbom diagnostics` (or inspect the derived `cdx:hbom:analysis:*` summary properties) before deciding whether a rerun with `--privileged` is justified. On Windows, `--privileged` only helps from an already-elevated session, and a non-administrator over SSH or WinRM is denied every WMI query; see [HBOM permissions](docs/PERMISSIONS.md#hbom-permissions).
### Standalone executables (recommended)
For a self-contained tool with no runtime dependencies, download a published
release asset and verify its hash before executing it. This is the recommended
method for CI and production use.
Common asset names:
- `cdxgen-linux-amd64`
- `cdxgen-linux-amd64-musl`
- `cdxgen-darwin-arm64`
- `cdxgen-windows-amd64.exe`
- `aibom-linux-amd64`
- `aibom-darwin-arm64`
- `aibom-windows-amd64.exe`
- `hbom-linux-amd64`
- `hbom-linux-amd64-slim`
- `hbom-darwin-arm64`
- `hbom-windows-amd64.exe`
- `cdx-audit-linux-amd64`
- `cdx-audit-darwin-arm64`
- `cdx-audit-windows-amd64.exe`
- `cdx-convert-*`, `cdx-sign-*`, `cdx-validate-*`, `cdx-verify-*`
#### Linux
```bash
VERSION="v13.5.0"
ASSET="cdx-audit-linux-amd64"
BASE_URL="https://github.com/cdxgen/cdxgen/releases/download/${VERSION}"
curl -fsSLO "${BASE_URL}/${ASSET}"
curl -fsSLO "${BASE_URL}/${ASSET}.sha256"
sha256sum -c "${ASSET}.sha256"
chmod +x "${ASSET}"
./"${ASSET}" --help
```
#### macOS
```bash
VERSION="v13.5.0"
ASSET="cdx-audit-darwin-arm64"
BASE_URL="https://github.com/cdxgen/cdxgen/releases/download/${VERSION}"
curl -fsSLO "${BASE_URL}/${ASSET}"
curl -fsSLO "${BASE_URL}/${ASSET}.sha256"
shasum -a 256 -c "${ASSET}.sha256"
chmod +x "${ASSET}"
./"${ASSET}" --help
```
#### Windows (PowerShell)
```powershell
$Version = "v13.5.0"
$Asset = "cdx-audit-windows-amd64.exe"
$BaseUrl = "https://github.com/cdxgen/cdxgen/releases/download/$Version"
Invoke-WebRequest -Uri "$BaseUrl/$Asset" -OutFile $Asset
Invoke-WebRequest -Uri "$BaseUrl/$Asset.sha256" -OutFile "$Asset.sha256"
$Expected = (Get-Content "$Asset.sha256" | Select-Object -First 1).Trim().Split()[0]
$Actual = (Get-FileHash $Asset -Algorithm SHA256).Hash.ToLowerInvariant()
if ($Actual -ne $Expected.ToLowerInvariant()) {
throw "SHA256 mismatch for $Asset"
}
.\$Asset --help
```
#### GitHub Actions with the GitHub CLI
```yaml
permissions:
contents: read
steps:
- name: Download cdx-audit release binary
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release download v13.5.0 \
--repo cdxgen/cdxgen \
--pattern 'cdx-audit-linux-amd64' \
--pattern 'cdx-audit-linux-amd64.sha256'
sha256sum -c cdx-audit-linux-amd64.sha256
chmod +x cdx-audit-linux-amd64
./cdx-audit-linux-amd64 --help
```
Package managers that install the standalone executable with a single command:
If you are a [Homebrew][homebrew-homepage] user, you can install [cdxgen][homebrew-cdxgen] via:
```shell
$ brew install cdxgen
```
If you are a [Winget][winget-homepage] user on windows, you can also install cdxgen via:
```shell
winget install cdxgen
```
### Container images
You can also use the cdxgen container image with node, deno, or bun runtime versions.
The default version uses Node.js 24
```bash
docker run --rm -e CDXGEN_DEBUG_MODE=debug -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/cdxgen/cdxgen:master -r /app -o /app/bom.json
```
To use the deno version, use `ghcr.io/cdxgen/cdxgen-deno` as the image name.
```bash
docker run --rm -e CDXGEN_DEBUG_MODE=debug -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/cdxgen/cdxgen-deno:master -r /app -o /app/bom.json
```
For the bun version, use `ghcr.io/cdxgen/cdxgen-bun` as the image name.
```bash
docker run --rm -e CDXGEN_DEBUG_MODE=debug -v /tmp:/tmp -v $(pwd):/app:rw -t ghcr.io/cdxgen/cdxgen-bun:master -r /app -o /app/bom.json
```
### npm and JavaScript package managers
The npm package is an alternative when you already have Node.js >= 24 available
or need cdxgen as a library. It is the least self-contained option because it
relies on a JavaScript runtime and optional native companions.
Install the npm package without the optional binary plugins for basic SBOM generation.
**npm**:
```shell
npm install -g @cdxgen/cdxgen --omit=optional --ignore-scripts --min-release-age=2
```
For a full and rich experience with support for multiple BOM types, remove `--omit=optional`.
```shell
npm install -g @cdxgen/cdxgen --ignore-scripts --min-release-age=2
```
**pnpm**:
```shell
pnpm add -g @cdxgen/cdxgen --omit=optional --ignore-scripts --minimum-release-age=2880
```
**bun**:
```shell
bun install -g @cdxgen/cdxgen --ignore-scripts
```
To run cdxgen without installing (hotloading), use the [pnpm dlx](https://pnpm.io/cli/dlx) command.
```shell
corepack pnpm dlx @cdxgen/cdxgen --help
```
You can call any packaged command the same way:
```shell
corepack pnpm dlx --package=@cdxgen/cdxgen cdx-audit --help
corepack pnpm dlx --package=@cdxgen/cdxgen cdx-convert --help
corepack pnpm dlx --package=@cdxgen/cdxgen cdx-validate --help
corepack pnpm dlx --package=@cdxgen/cdxgen cdx-sign --help
corepack pnpm dlx --package=@cdxgen/cdxgen cdx-verify --help
corepack pnpm dlx --package=@cdxgen/cdxgen hbom --help
corepack pnpm dlx --package=@cdxgen/cdxgen hbom diagnostics --help
corepack pnpm dlx --package=@cdxgen/cdxgen evinse --help
corepack pnpm dlx --package=@cdxgen/cdxgen cdxi --help
```
cdxgen also runs under the [bun](https://bun.sh) runtime, including `bunx --bun @cdxgen/cdxgen`. Bun projects using a text lockfile (`bun.lock`) are supported as an SBOM target via the `bun` project type (`-t bun`); the legacy binary lockfile (`bun.lockb`) is not parsed, so regenerate a text lockfile with `bun install --save-text-lockfile`.
```shell
bun install -g @cdxgen/cdxgen --ignore-scripts
```
cdxgen also runs under the [deno](https://deno.com) runtime. Deno projects with a lockfile (`deno.lock`, versions 2 - 5) are supported as an SBOM target via the `deno` project type (`-t deno`); `jsr:` imports are recorded under the `@jsr` npm-compat scope, `npm:` imports as regular npm components and remote `https://` imports as generic components.
```shell
deno install --allow-read --allow-env --allow-run --allow-sys=uid,systemMemoryInfo,gid,homedir --allow-write --allow-net -n cdxgen "npm:@cdxgen/cdxgen/cdxgen"
```
In deno applications, cdxgen could be directly imported without any conversion.
```ts
import { createBom, submitBom } from "npm:@cdxgen/cdxgen@^13";
```
## Common workflows
| Goal | First command | Read next |
| ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| Generate a BOM from the current repository | `cdxgen -o bom.json .` | [CLI Usage][docs-cli] |
| Generate a BOM from a git URL | `cdxgen -o bom.json https://github.com/example/project.git` | [CLI Usage][docs-cli] |
| Generate a BOM from a package URL | `cdxgen -o bom.json "pkg:npm/lodash@4.17.21"` | [CLI Usage][docs-cli] |
| Generate a dynamically traced CBOM for an application | `tracebom --cmd "npm test" --trace-crypto -o cbom.json` | [Threat Model](docs/THREAT_MODEL.md) |
| Generate and audit an AI-BOM from the current repository | `cdxgen -r --include-formulation -o aibom.json --bom-audit --bom-audit-categories ai-bom .` | [AI-BOM Guide](docs/AI_BOM.md) |
| Scan a container image | `cdxgen ghcr.io/owasp-dep-scan/depscan:nightly -o bom.json -t docker` | [Server Usage][docs-server] |
| Audit a generated BOM for built-in supply-chain findings | `cdxgen -o bom.json --bom-audit .` | [BOM Audit](docs/BOM_AUDIT.md) |
| Prioritize an existing BOM for upstream risk-driven review | `cdx-audit --bom bom.json` | [cdx-audit](docs/CDX_AUDIT.md) |
| Re-audit a saved AI-BOM directly later | `cdx-audit --bom aibom.json --direct-bom-audit --categories ai-bom` | [AI-BOM Guide](docs/AI_BOM.md) |
| Enrich and audit a Go BOM with Golem semantic evidence | `evinse -i bom.json -o bom.evinse.json -l go /absolute/path/to/go/project` | [Go Evinse with Golem](docs/GO_EVINSE_GOLEM.md) |
| Re-audit a saved OBOM or BOM directly later | `cdx-audit --bom obom.json --direct-bom-audit --categories obom-runtime` | [cdx-audit](docs/CDX_AUDIT.md) |
| Validate a BOM against structural and compliance checks | `cdx-validate -i bom.json` | [cdx-validate](docs/CDX_VALIDATE.md) |
| Convert CycloneDX JSON to SPDX JSON-LD | `cdx-convert -i bom.json -o bom.spdx.json` | [cdx-convert](docs/CDX_CONVERT.md) |
| Generate an OBOM for live-system triage | `obom -o obom.json --deep --bom-audit --bom-audit-categories obom-runtime` | [OBOM lessons](docs/OBOM_LESSONS.md) |
| Review an offline rootfs for hardening drift | `cdxgen /absolute/path/to/rootfs -t rootfs -o bom.json --bom-audit --bom-audit-categories rootfs-hardening` | [BOM Audit](docs/BOM_AUDIT.md) |
For the full option reference, use `cdxgen --help` or visit [CLI Usage][docs-cli].
Companion commands also expose built-in help:
- `cbom --help`
- `cdx-audit --help`
- `cdx-validate --help`
- `cdx-convert --help`
- `cdx-sign --help`
- `cdx-verify --help`
- `cdxgen-secure --help`
- `cdxi --help`
- `evinse --help`
- `obom --help`
- `saasbom --help`
- `spdxgen --help`
## Example
Minimal example.
```shell
cdxgen -o bom.json
```
The primary positional input can be:
- a local filesystem path (default: current directory)
- a git URL that cdxgen clones before scanning
- a package URL (purl) that cdxgen resolves to source and then scans
Common source input examples:
```shell
# Local path
cdxgen -o bom.json .
# Git URL
cdxgen -t java -o bom.json --git-branch main https://github.com/HooliCorp/java-sec-code.git
# Package URL (purl)
cdxgen -t js -o bom.json "pkg:npm/lodash@4.17.21"
```
For a java project. cdxgen would automatically detect maven, gradle, or sbt and build bom accordingly
```shell
cdxgen -t java -o bom.json
```
To print the SBOM as a table pass `-p` argument.
```shell
cdxgen -t java -o bom.json -p
```
To recursively generate a single BOM for all languages pass `-r` argument.
```shell
cdxgen -r -o bom.json
```
To generate an SBOM directly from a git URL:
```shell
cdxgen -t java -o bom.json --git-branch main https://github.com/HooliCorp/java-sec-code.git
```
This works anywhere cdxgen expects its primary source input, so a git URL can be used in place of `.` or any other local path.
To generate an SBOM from a package URL (purl), cdxgen resolves registry metadata to a repository URL, clones it, and scans it:
```shell
cdxgen -t js -o bom.json "pkg:npm/lodash@4.17.21"
```
Supported purl source types: `npm`, `pypi`, `gem`, `cargo`, `pub`, `github`, `bitbucket`, `maven` (version required), `composer`, and `generic` (with `vcs_url` or `download_url` qualifier).
> **Warning:** Repository URLs resolved from registries may be inaccurate or malicious. Review resolved sources before trusting generated output.
The default specification used by cdxgen is 1.7. To generate BOM for a different specification version, such as 1.6, pass the version number using the `--spec-version` argument. Accepted values are 1.6, 1.7, and 2.0. Versions 1.4 and 1.5 are only available as output downgrades, not as generation targets; generate at 1.6 or higher and then use `cdx-convert --to 1.5` for legacy consumers.
```shell
# 1.6 is supported by most tools
cdxgen -r -o bom.json --spec-version 1.6
```
Use repeated `--component-type` values to include only selected CycloneDX component types. This is a filter, not an inventory enabler: passing a type such as `machine-learning-model` does not enable machine-learning model discovery, and filtering to a type that the scan does not generate can produce an empty component list. The allowed values are validated against `--spec-version`; for example, `cryptographic-asset` requires 1.6 or newer, and unsupported component types are pruned during compatibility downgrades. The dedicated `cbom` command does not accept `--component-type`; use `cdxgen --include-crypto` for normal generation plus filtering.
```shell
cdxgen -t docker alpine:3.20 --spec-version 1.6 --component-type library --component-type data
```
To generate SBOM for C or Python, cdxgen uses the bundled atom companion. On linux-amd64, linux-arm64 (glibc), linux-amd64-musl, darwin-arm64, and windows-amd64, atom ships as a native binary and needs no JDK. Only the jar-based triples (darwin-amd64, windows-arm64, and linux-arm64-musl) run atom on the JVM.
```shell
cdxgen -t c -o bom.json
```
NOTE: On the jar-based triples, atom requires Java >= 23 and is known to freeze with Java 8 or 11, so ensure a suitable version is installed and the JAVA_HOME environment variable is configured correctly. If in doubt, use the cdxgen container image.
## Universal SBOM
By passing the type argument `-t universal`, cdxgen could be forced to opportunistically collect as many components and services as possible by scanning all package, container, and Kubernetes manifests. The resulting SBOM could have over a thousand components, thus requiring additional triaging before use with traditional SCA tools.
## SBOM server
Invoke cdxgen with `--server` argument to run it in server mode. By default, it listens to port `9090`, which can be customized with the arguments `--server-host` and `--server-port`.
```shell
cdxgen --server
```
Or use the container image.
```bash
docker run --rm -v /tmp:/tmp -p 9090:9090 -v $(pwd):/app:rw -t ghcr.io/cdxgen/cdxgen -r /app --server --server-host 0.0.0.0
```
Use curl or your favorite tool to pass arguments to the `/sbom` route.
### Server arguments
Arguments can be passed either via the query string or as a JSON body. Please refer to [Server Usage][docs-server]
### Health endpoint
Use the /health endpoint to check if the SBOM server is up and running.
```shell
curl "http://127.0.0.1:9090/health"
```
### Scanning a local path
```shell
curl "http://127.0.0.1:9090/sbom?path=/Volumes/Work/sandbox/vulnerable-aws-koa-app&multiProject=true&type=js"
```
### Scanning a git repo
```shell
curl "http://127.0.0.1:9090/sbom?url=https://github.com/HooliCorp/vulnerable-aws-koa-app.git&multiProject=true&type=js"
```
If you need to pass credentials to authenticate.
```shell
curl "http://127.0.0.1:9090/sbom?url=https://@github.com/some/repo.git&multiProject=true&type=js"
curl "http://127.0.0.1:9090/sbom?url=https://:@bitbucket.org/some/repo.git&multiProject=true&type=js"
```
You can POST the arguments.
```bash
curl -H "Content-Type: application/json" http://localhost:9090/sbom -XPOST -d $'{"url": "https://github.com/HooliCorp/vulnerable-aws-koa-app.git", "type": "nodejs", "multiProject": "true"}'
```
### Review-first dry runs
When you want to inspect what cdxgen would do before allowing side effects, use `--dry-run`.
```shell
cdxgen --dry-run -p -t js .
```
Dry-run mode keeps cdxgen read-only: it reads local files, blocks writes/exec/temp creation/cloning/submission, and prints an activity summary table for both beginners and power users. When available, the recorded activity data also captures archive extraction intent, command I/O volume, and followed symlink-resolution traces.
### Docker compose
```shell
git clone https://github.com/cdxgen/cdxgen.git
docker compose up
```
## War file support
cdxgen can generate a BOM file from a given war file.
```shell
# cdxgen -t java app.war
cdxgen app.war
```
## Resolving licenses
cdxgen can automatically query public registries such as maven, npm, or nuget to resolve the package licenses. This is a time-consuming operation and is disabled by default. To enable, set the environment variable `FETCH_LICENSE` to `true`, as shown. Ensure that `GITHUB_TOKEN` is set or provided by [built-in GITHUB_TOKEN in GitHub Actions][github-rate-limit], otherwise rate limiting might prevent license resolving.
```bash
export FETCH_LICENSE=true
```
## Dependency Tree
cdxgen can retain the dependency tree under the `dependencies` attribute for a small number of supported package manifests. These are currently limited to:
- package-lock.json
- yarn.lock
- pnpm-lock.yaml
- Maven (pom.xml)
- Gradle
- Scala SBT
- Python (requirements.txt, setup.py, pyproject.toml, poetry.lock)
- .NET (packages.lock.json, project.assets.json, paket.lock, .nuspec/.nupkg)
- Go (go.mod)
- PHP (composer.lock)
- Ruby (Gemfile.lock)
- Rust (Cargo.lock)
## Plugins
`cdxgen` can be extended with external binary plugins to support more SBOM use cases. These are installed as optional dependencies and can be used without a global install.
```shell
pnpm dlx @cdxgen/cdxgen-plugins-bin
```
## Claude Code plugin
The cdxgen toolkit is also packaged as a [Claude Code](https://claude.com/claude-code) plugin, so agents drive the correct command and flags — including the dry-run-first and no-auto-install safety constraints — instead of guessing.
```shell
claude plugin marketplace add cdxgen/cdxgen
claude plugin install cdxgen@cdxgen-plugins
```
It ships skills covering SBOM generation, container and rootfs scans, OBOM/HBOM, CBOM, AI-BOM and MCP inventory, BOM auditing, signing, validation, conversion, evidence enrichment, runtime tracing, and Dependency-Track publishing. See [claude-plugin/README.md](claude-plugin/README.md).
## Rust accelerator (cdxrs)
cdxgen ships with an optional Rust accelerator binary, `cdxrs`, which speeds up hot paths such as registry metadata lookups where available. Use the `--rust` and `--no-rust` arguments to toggle it, or set the environment variable `CDXGEN_RS_DISABLE=all` to force the JavaScript path. See the [cdxrs protocol](./docs/CDXRS_PROTOCOL.md) document for implementation details.
## Metadata cache
cdxgen caches registry metadata on disk to speed up repeat runs. Use the `cdxgen cache ` subcommand to inspect or purge the cache, the `--cache` and `--cache-ttl` arguments to control it per run, or the `CDXGEN_NO_CACHE` and `CDXGEN_CACHE_TTL` environment variables for the same effect.
## Docker / OCI container support
`docker` type is automatically detected based on the presence of values such as `sha256` or `docker.io` prefix etc in the path.
```shell
cdxgen odoo@sha256:4e1e147f0e6714e8f8c5806d2b484075b4076ca50490577cdf9162566086d15e -o /tmp/bom.json
```
You can also pass `-t docker` with repository names. Only the `latest` tag would be pulled if none was specified.
```shell
cdxgen shiftleft/scan-slim -o /tmp/bom.json -t docker
```
For offline or staged scans, point cdxgen at a locally reconstructed root filesystem directory. The container pipeline accepts `-t docker`, `-t rootfs`, or `-t oci-dir` for this mode.
```shell
cdxgen /tmp/remote_target -o /tmp/bom.json -t rootfs
```
With the packaged helpers installed, rootfs and container BOMs gain repository trust-source components, deep keyring / CA-store `cryptographic-asset` components, native CycloneDX origin fields such as `supplier`, `manufacturer`, and `authors` for OS package trust metadata, plus additional package trust-state properties such as `PackageArchitecture`, `PackageSource`, and `PackageStatus`.
You can also pass the .tar file of a container image.
```shell
docker pull shiftleft/scan-slim
docker save -o /tmp/slim.tar shiftleft/scan-slim
podman save -q --format oci-archive -o /tmp/slim.tar shiftleft/scan-slim
cdxgen /tmp/slim.tar -o /tmp/bom.json -t docker
```
### Podman in rootless mode
Setup podman in either [rootless][podman-github-rootless] or [remote][podman-github-remote] mode
Do not forget to start the podman socket required for API access on Linux.
```shell
systemctl --user enable --now podman.socket
systemctl --user start podman.socket
podman system service -t 0 &
```
### WSL Containers (wslc) on Windows
On Windows, Docker Desktop is optional when [WSL Containers][wsl-containers-docs] is available. cdxgen automatically uses the `wslc` CLI (included with WSL 2.9.3 or higher) to pull, inspect, and export images whenever the docker CLI is not installed, so image scans such as the below work with just WSL:
```shell
wsl --update
cdxgen alpine:latest -t oci -o bom.json
```
Set `DOCKER_CMD=wslc` to prefer wslc even when a docker CLI is installed. See [Generating container SBOM on Windows](./ADVANCED.md#generating-container-sbom-on-windows) for requirements, including the nested virtualization needed when Windows itself runs inside a VM.
## Generate OBOM for a live system
You can use the `obom` command to generate an OBOM for a live system or a VM for compliance and vulnerability management purposes. Linux, Windows, and macOS are supported in this mode, though some macOS tables require elevated privileges and Full Disk Access.
```shell
# obom is an alias for cdxgen -t os
obom
# cdxgen -t os
```
This feature is powered by osquery, which is [installed](https://github.com/cdxgen/cdxgen-plugins-bin/blob/main/build.sh#L8) along with the binary plugins. cdxgen would opportunistically try to detect as many components, apps, and extensions as possible using the platform-specific default queries under `data/queries*.json`. The Linux profile includes dedicated `sysctl_hardening` and `mount_hardening` snapshots, GTFOBins enrichment for privileged and network-active runtime rows, Secure Boot certificate inventory, and improved npm package discovery. When the optional `trustinspector` helper is available, OBOM collection is further enriched with:
- macOS code-signing authority, team ID, and notarization assessment metadata for discovered application paths
- Windows Authenticode signer/timestamp metadata for discovered executable paths
- Windows WDAC active-policy inventory
- batched path inspection so large host inventories keep their trust metadata instead of stopping at the first few hundred paths
Container and rootfs BOMs also summarize how many executable and shared-library file components were discovered outside OS package ownership. Look for `cdx:container:unpackagedExecutableCount` and `cdx:container:unpackagedSharedLibraryCount` in metadata, or use `.unpackagedbins` and `.unpackagedlibs` in `cdxi` for an interactive pivot.
The process would take several minutes and result in an SBOM file with thousands of components of various types, such as operating-system, device-drivers, files, and data.
For practical SOC/IR and compliance workflows, see the dedicated [OBOM lessons](./docs/OBOM_LESSONS.md). For macOS-specific setup and permission caveats, see [OBOM macOS troubleshooting](./docs/OBOM_MACOS_TROUBLESHOOTING.md). For compact before/after examples of the new trust metadata, see [Trust enrichment BOM diff examples](./docs/TRUST_ENRICHMENT_DIFF.md).
## Generate Cryptography Bill of Materials (CBOM)
Use the `cbom` alias to generate a CBOM. In addition to keystores and certificates, cdxgen can also derive cryptographic algorithm inventory from JavaScript and TypeScript source by following lightweight constant propagation through common `node:crypto`, WebCrypto, and JWT call sites.
```shell
cbom -t java
# cdxgen -t java --include-crypto -o bom.json .
# Add source-derived crypto algorithms for a JS or TS project
cdxgen --include-crypto -o bom.json /absolute/path/to/js-project
```
When reviewing the result in `cdxi`, use `.cryptos` for the full cryptographic asset view or `.sourcecryptos` to narrow the list to source-derived algorithm components only.
## Generating SaaSBOM and component evidences
See [evinse mode](./ADVANCED.md) in the advanced documentation.
---
## BOM signing
cdxgen features a best-in-class, native **JSON Signature Format (JSF)** implementation for BOM signing, providing robust authenticity and non-repudiation capabilities. Unlike basic signing tools, our implementation fully supports granular signatures (signing individual components, services, and annotations), parallel Multi-Signatures (`signers`), and sequential Signature Chains (`chain`).
To enable automatic signing during BOM generation, set the following environment variables:
- `SBOM_SIGN_ALGORITHM`: JSF Algorithm. Examples: `RS512`, `ES256`, `Ed25519`, `HS256`. It must match the key type.
- `SBOM_SIGN_PRIVATE_KEY`: Location of the private key (PEM format), or of the shared secret for `HS256`, `HS384`, and `HS512`
- `SBOM_SIGN_PUBLIC_KEY`: Optional. Location of the public key to embed. It must belong to the private key.
- `SBOM_SIGN_MODE`: Optional. Signature mode (`replace`, `signers`, `chain`). Default is `replace`.
To quickly generate a test key pair for `SBOM_SIGN_ALGORITHM` and sign your first BOM, you can run cdxgen with the `--generate-key-and-sign` argument.
When signing is configured (`SBOM_SIGN_ALGORITHM` plus a private key), cdxgen signs the BOM it writes, prints, or submits to Dependency-Track, and exits with status 1 if it cannot sign it, including when the key file is missing. A private key without `SBOM_SIGN_ALGORITHM` leaves the BOM unsigned and prints a warning; set `SBOM_SIGN_ALGORITHM=none` to opt out explicitly.
BOMs signed with cdxgen 13.2.0 or earlier must be re-signed with the current `cdx-sign` before they verify. See [cdx-sign](docs/CDX_SIGN.md#re-signing-boms-from-earlier-releases).
### Advanced Signing with `cdx-sign`
For complex supply chain orchestration, use the bundled `cdx-sign` CLI. This tool allows multiple entities (e.g., a Builder and an Auditor) to co-sign an existing BOM without modifying its original data.
```shell
# Append a parallel multi-signature (Auditor co-signing) after checking the Builder's signature
# Note: Granular component signing is disabled to preserve the Builder's original signature payload.
cdx-sign -i bom.json -k auditor_private.pem -a ES256 --key-id "auditor-qa" --mode signers --no-sign-components --verify-existing-with builder_public.pem
```
### Validating CycloneDX BOMs
Use the bundled `cdx-validate` command to validate CycloneDX BOMs against **structural**, **deep**, and **compliance** checks. Refer to this [document](./docs/CDX_VALIDATE.md) for usage.
### Verifying the signature
Use the bundled `cdx-verify` command to validate BOM signatures. By default, `cdx-verify` performs a **strict deep verification**, meaning it mathematically validates the top-level BOM signature _and_ the signatures of every nested component, service, and annotation against the provided public key. Refer to this [lesson](./docs/LESSON6.md) for the usage of sign and verify commands.
```shell
npm install -g @cdxgen/cdxgen --omit=optional --ignore-scripts --min-release-age=2
# Perform strict deep verification (default)
cdx-verify -i bom.json --public-key public.key
# Verify ONLY the top-level root signature (useful for verifying a multi-signer who didn't sign nested components)
cdx-verify -i bom.json --public-key auditor_public.key --no-deep
# Require every co-signer
cdx-verify -i bom.json --public-key builder_public.key --public-key auditor_public.key --require-all
```
### Verifying the signature (pnpm)
You can run the verification tools directly using pnpm (no global install needed):
```shell
pnpm dlx @cdxgen/cdxgen cdx-verify -i bom.json --public-key public.key
```
You can also use pnpm to invoke the signing tool:
```shell
pnpm dlx @cdxgen/cdxgen cdx-sign -i bom.json -k private.key
```
---
## Automatic usage detection
For node.js projects, lock files are parsed initially, so the SBOM would include all dependencies, including dev ones. An AST parser powered by babel-parser is then used to detect packages that are imported and used by non-test code. Such imported packages would automatically set their scope property to `required` in the resulting SBOM. A package with no observed usage keeps the scope from the lock file, since packages loaded from configuration, bundler entrypoints, stylesheets, or plugins are invisible to import analysis. A package imported only for its TypeScript types is scoped `excluded`, and a package that only such packages depend on is scoped `optional`. You can turn off this analysis by passing the argument `--no-babel`. Scope property would then be set based on the `dev` attribute in the lock file.
Single-file component frameworks are handled natively by this analysis: `.vue` and `.svelte` templates are segmented position-preservingly so script imports recover with correct file and line evidence. For Svelte and SvelteKit, framework usage signals are additionally collected — SvelteKit virtual modules such as `$app/stores` are attributed to `@sveltejs/kit`, `$lib/*` imports resolve through `kit.alias`, `svelte.config.js` adapters and preprocessors, CSS preprocessor packages implied by `