National Cyber Warfare Foundation (NCWF)login

Automating polyglot SBOM generation with cdxgen


0 user ratings
2026-10-24 17:30:26
milo
Red Team (CNA)
"Automating

cdxgen builds CycloneDX bills of materials from source trees, git URLs, purls and container images, giving authorized security and compliance teams evidence-rich supply-chain visibility.








Toolcdxgen/cdxgen — polyglot CycloneDX BOM generator CLI, library, REPL and server for SBOM, HBOM, OBOM, CBOM, SaaSBOM and AI-BOM documents
CategorySoftware supply-chain security / SBOM generation
Primary UseGenerating, validating, signing and verifying CycloneDX BOM documents from repositories, purl references and OCI container images in CI/CD pipelines
Safe UseIntended for authorized asset inventory, compliance audits, vulnerability management and defensive research on systems and codebases you own or are contracted to assess.
Telemetry NotePurely a local analysis tool; it reads manifests and images you point it at and writes JSON documents, leaving no network beacons. Its hardened defaults, --dry-run read-only mode and documented Permissions model make its activity observable and auditable on the host.

cdxgen positions itself as the universal polyglot SBOM generator, and the README makes an unusually precise argument for why that matters. Most BOM tools, it says, behave like barcode scanners: they read a few package manifests and emit a component list without deep inspection. Real enterprise applications span multiple repositories, languages and build systems, so per-manifest generation either fails outright or produces output too shallow for compliance and automated analysis. cdxgen answers with a CLI tool, library, REPL and server that create, validate, sign and verify BOMs, generating CycloneDX JSON natively while supporting SPDX 3.0.1 JSON-LD export via cdxgen --format spdx or cdx-convert.


What distinguishes the project architecturally is the breadth of its BOM taxonomy. Beyond conventional software SBOMs, the tool emits Hardware BOMs (HBOM) for live hosts across Apple Silicon macOS, Linux amd64/arm64 and Windows; Cryptography BOMs (CBOM) covering Java keystores, certificates and JavaScript/TypeSource algorithm inventory; Operations BOMs (OBOM) for Linux container images and VMs; and SaaSBOM documents for Java, Python, JavaScript, TypeScript and PHP projects. Most notably for current priorities, it produces AI/ML BOMs covering prompt files, AI services, MCP configs and model metadata, with explainable AI-governance, security and agentic findings. That is a wider surface than most generators in this space attempt.


Specification handling is deliberately conservative. The tool targets CycloneDX specification versions 1.6, 1.7 and 2.0, and can downgrade output to 1.4 or 1.5 for legacy consumers, a pragmatic touch for pipelines where downstream tooling lags the spec. Attestation support (CDXA) lets teams generate SBOMs from templates aligned to multiple standards and sign the document at a granular level to improve authenticity. Chained with OWASP depscan, it also automates generation of Vulnerability Disclosure Reports (VDR) at scale, which is the natural bridge from inventory to remediation workflow.


The README is organized around personas rather than feature lists, which reveals how the maintainers expect the tool to be consumed. Developers get a one-liner: cdxgen -o bom.json . against a local repo, git URL, purl or container image. AppSec teams are steered toward cdxgen -o bom.json --profile appsec --evidence --bom-audit ., which enriches the BOM with evidence and runs BOM audit rules. SOC analysts get obom -o obom.json --deep --bom-audit --bom-audit-categories obom-runtime for live-host inventory and runtime posture triage. This persona-first structure is a strong signal that the project is designed for organizational adoption, not individual experimentation.


The hardware and runtime paths deserve particular attention from defenders. hbom -o hbom.json inventories the current host, and hbom --include-runtime merges hardware inventory with runtime evidence using what the README calls strict, non-guessing joins, meaning topology claims are backed by observed evidence rather than inference. A read-only hbom --dry-run shows exactly which hardware probe commands would run before a full collection, and hbom diagnostics summarizes missing native utilities and permission-denied enrichments. That review-first design pattern is exactly what you want in sensitive or regulated environments where opaque host probing is unacceptable.


For security teams, the standout capability is tracebom, which dynamically traces executions to capture cryptographic activity. The documented example, tracebom --cmd "npm test" --trace-crypto -o cbom.json, profiles an application while its test suite runs and records negotiated TLS cipher suites, protocols, cryptographic libraries, dynamically resolved components and services in CycloneDX 1.7 format. This is the crypto-agility inventory angle: as post-quantum migration pressure grows, knowing which libraries and ciphers your application actually negotiates at runtime, rather than what manifests claim, becomes a compliance and risk necessity.


The AI/ML coverage is arguably the most forward-looking piece. Beyond a --include-formulation flag combined with --bom-audit --bom-audit-categories ai-bom, there is a dedicated aibom CLI that bundles the same defaults, accepting direct Hugging Face purl references and Modelfile or .gguf inputs. Given how quickly AI assets, prompt files and MCP configurations are accumulating in real codebases, having a documented inventory workflow for them, including a dedicated MCP inventory guide, is a differentiator few competitors currently match.


Build engineers get an introspection loop: cdxgen --profile introspect --introspect-fail-below 70 -o bom.json . grades how completely the SBOM captured the project and returns ranked fixes when the build environment degraded fidelity. This acknowledges a real operational truth, that SBOM quality is a function of the environment it is generated in, and turns drift into a measurable, gate-able signal rather than a silent failure. Compliance teams similarly get cdx-validate -i bom.json --benchmark scvs-l2,cra, which scores BOM quality against OWASP SCVS and the EU Cyber Resilience Act posture before cdx-convert exports SPDX deliverables.


The stated philosophy is worth quoting directly because it shapes the engineering: explainability over listing, precision through multiple techniques even at the cost of speed, persona coverage, ML-friendly output properties, and safety. That safety principle manifests concretely in hardened defaults when executing external build tools, a secure mode documented under Permissions for sensitive environments, and the read-only --dry-run mode for review-first workflows. A published threat model rounds out a security posture that treats its own inputs as untrusted, which is the correct assumption when parsing arbitrary manifests from third-party repositories.


Distribution and installation are worth noting carefully. As of v13, the npm package was renamed from @cyclonedx/cdxgen to @cdxgen/cdxgen, so upgrading means changing the package specifier, not just the version: npm uninstall -g @cyclonedx/cdxgen followed by npm install -g @cdxgen/cdxgen --ignore-scripts --min-release-age=2. The cdxgen command, its CLI flags and its container images are unchanged, and library consumers update to import { createBom } from "@cdxgen/cdxgen". Standalone executables and container images are the recommended deployment for CI and production where no Node.js dependency is desired, with the release/12.0.x branch still receiving fixes for v12 holdovers.


At roughly 1,092 stars, an Apache-2.0 license, and a JavaScript codebase with documented OWASP affiliations and topics spanning sbom, spdx, purl, sca and supply-chain, cdxgen sits in the mainstream of adopted supply-chain tooling rather than the experimental fringe. Its repo topics also flag cbom and saasbom, reinforcing that the extended BOM types are first-class concerns. For an authorized assessment or internal hardening program, it functions as the inventory backbone: generate, enrich with evidence, audit, validate against benchmarks, sign, and feed into dependency analysis. It is a defensive instrument by construction, and its depth of documentation, from permissions guidance to hands-on lessons covering container privilege scenarios, makes it one of the more operationally mature entries in the SBOM generation space.



Official project repository for cdxgen/cdxgen.

Download Tool

Educational analysis for authorized security professionals. Use only in controlled, authorized environments.






Source: OffensiveSec
Source Link: https://www.offsecblog.com/2026/10/automating-polyglot-sbom-generation.html


Comments
new comment
Nobody has commented yet. Will you be the first?
 
Forum
Red Team (CNA)



Copyright 2012 through 2026 - National Cyber Warfare Foundation - All rights reserved worldwide.