TExcelTAD

SPDX vs CycloneDX

Two open standards dominate, and every serious tool reads and writes both.

SPDX CycloneDX
Steward Linux Foundation; ISO/IEC 5962:2021 (SPDX 2.2.1) OWASP; ECMA-424
Origin license compliance (2010) application security (2017)
Current versions 2.3 (most tools), 3.0 (2024, graph-based, JSON-LD) 1.6 and 1.7
Encodings JSON, tag-value, YAML, RDF/XML JSON, XML, Protocol Buffers
Relationships typed relationships between any two elements (DESCRIBES, CONTAINS, DEPENDS_ON…) a dependencies tree plus nested components
Beyond components licenses, files, snippets; 3.0 adds security and AI profiles services, vulnerabilities and VEX, hardware, ML models, formulation (how it was built)

In practice: SPDX is what legal and license teams know and what Linux distributions publish; CycloneDX is what security tools emit by default and can carry VEX in the same document. Pick the one your consumers ask for, keep the ability to convert, and don't let the choice block you.

The same project in both formats

Syft can write several formats in one run: repeat -o FORMAT=FILE. This session catalogs the sample Node project once and writes SPDX 2.3 JSON and CycloneDX JSON side by side.

bash · try it yourself
cp -r /opt/samples/node-app . && cd node-app
syft scan . -q -o spdx-json=sbom.spdx.json -o cyclonedx-json=sbom.cdx.json
echo "--- SPDX"
jq '{spdxVersion, dataLicense, name, creators: .creationInfo.creators, packages: (.packages | length), relationships: (.relationships | length)}' sbom.spdx.json
echo "--- CycloneDX"
jq '{bomFormat, specVersion, tool: .metadata.tools.components[0].name, components: (.components | length), dependencies: (.dependencies | length)}' sbom.cdx.json
--- SPDX
{
  "spdxVersion": "SPDX-2.3",
  "dataLicense": "CC0-1.0",
  "name": ".",
  "creators": [
    "Organization: Anchore, Inc",
    "Tool: syft-1.55.0"
  ],
  "packages": 4,
  "relationships": 9
}
--- CycloneDX
{
  "bomFormat": "CycloneDX",
  "specVersion": "1.7",
  "tool": "syft",
  "components": 4,
  "dependencies": 1
}

Both found the same three npm packages, and both report four entries, but not the same fourth one: SPDX adds the scanned directory as a package (the document's root), CycloneDX adds the scanned package-lock.json as a file component. CycloneDX records one dependency entry (node-app depends on lodash and minimist); SPDX spreads the same facts over nine relationships. Neither is wrong; they model "what the tool looked at" differently.

One package, two shapes

bash · try it yourself
cp -r /opt/samples/node-app . && cd node-app
syft scan . -q -o spdx-json=sbom.spdx.json -o cyclonedx-json=sbom.cdx.json
echo "--- SPDX package"
jq '.packages[] | select(.name == "minimist") | {SPDXID: (.SPDXID | sub("-[0-9a-f]+
quot;; "-…")), name, versionInfo, downloadLocation, licenseDeclared, refs: [.externalRefs[] | .referenceType + " " + .referenceLocator]}' sbom.spdx.json echo "--- CycloneDX component" jq '.components[] | select(.name == "minimist") | {name, version, purl, cpe, type}' sbom.cdx.json
--- SPDX package
{
  "SPDXID": "SPDXRef-Package-npm-minimist-…",
  "name": "minimist",
  "versionInfo": "1.2.5",
  "downloadLocation": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
  "licenseDeclared": "NOASSERTION",
  "refs": [
    "cpe23Type cpe:2.3:a:minimist:minimist:1.2.5:*:*:*:*:*:*:*",
    "purl pkg:npm/minimist@1.2.5"
  ]
}
--- CycloneDX component
{
  "name": "minimist",
  "version": "1.2.5",
  "purl": "pkg:npm/minimist@1.2.5",
  "cpe": "cpe:2.3:a:minimist:minimist:1.2.5:*:*:*:*:*:*:*",
  "type": "library"
}

The facts are identical (name, version, purl, CPE); the field names differ (versionInfo vs version, purl as an external reference vs a first-class field). NOASSERTION is SPDX's explicit "the tool did not determine this": the lockfile doesn't record licenses, so Syft doesn't invent one.

Relationships

SPDX states relationships as triples. Here is what Syft recorded, with ids shortened to package names:

bash · try it yourself
cp -r /opt/samples/node-app . && cd node-app
syft scan . -q -o spdx-json=sbom.spdx.json
jq -r '
  ((.packages + (.files // [])) | map({(.SPDXID): (.name // .fileName)}) | add + {"SPDXRef-DOCUMENT": "DOCUMENT"}) as $n
  | .relationships[] | "\($n[.spdxElementId])  \(.relationshipType)  \($n[.relatedSpdxElement])"' sbom.spdx.json | sort
.  CONTAINS  lodash
.  CONTAINS  minimist
.  CONTAINS  node-app
DOCUMENT  DESCRIBES  .
lodash  DEPENDENCY_OF  node-app
lodash  OTHER  package-lock.json
minimist  DEPENDENCY_OF  node-app
minimist  OTHER  package-lock.json
node-app  OTHER  package-lock.json

Four kinds of edge:

  • DOCUMENT DESCRIBES .: the document is about the scanned directory.
  • . CONTAINS lodash: the packages were found inside it.
  • lodash DEPENDENCY_OF node-app: the dependency graph, written from the dependency's side (SPDX 2.3 has both DEPENDS_ON and DEPENDENCY_OF; tools pick one).
  • lodash OTHER package-lock.json: an OTHER relationship whose comment (evident-by: …) records where the package was found.

Tools that consume SPDX must handle both directions of dependency edges. Always check which relationships your generator emits before building tooling on them.

Choosing

  • Your customers or regulators name a format: use it.
  • You want VEX, services or build information in the same document: CycloneDX.
  • License compliance is the main use, or you publish for a Linux distribution: SPDX.
  • Tools convert between them (Converting & Querying SBOMs), but conversions can lose information that has no equivalent on the other side, so keep the original.

Test yourself

Which SBOM standard is published by OWASP and can carry VEX data in the same document?

  1. SPDX
  2. CycloneDX
  3. purl
  4. in-toto

An SPDX package has licenseDeclared: NOASSERTION. What does it mean?

  1. The package has no license
  2. The SBOM author did not determine the license
  3. The license is proprietary
  4. The SBOM is invalid

How do you make Syft write SPDX JSON and CycloneDX JSON in one scan?

  1. Run it twice; it can only write one format
  2. Repeat -o FORMAT=FILE, e.g. -o spdx-json=a.json -o cyclonedx-json=b.json
  3. --all-formats
  4. syft convert --both