Quick reference
Name, version, licence, hash, purl: one component, five facts.
lodash | 4.17.21 | MIT | sha256:9f3c | pkg:npm/lodash@4.17.21| Part | Name | What it tells you |
|---|---|---|
lodash | Name | How the registry spells it. Names collide across ecosystems. |
4.17.21 | Version | The exact version shipped, never a range and never latest. |
MIT | Licence | The declared licence. It is declared, so it can be wrong. |
sha256:9f3c | Hash | The digest of the artefact. Without it the SBOM is a list of names. |
pkg:npm/lodash@4.17.21 | Purl | A package URL naming the same component in any tool. |
In one line: A name is not a component. Version, licence and hash are what make the line useful.
Generate one:
syft dir:. -o spdx-json > sbom.jsonExplained
Name
How the registry spells it. Names collide across ecosystems, so the name alone never identifies anything.
Version
4.17.21, never a range and never latest. An SBOM that lists a range cannot be matched against a CVE with any confidence.
Licence
MIT here. It is a declaration, which means it can be wrong, so a licence scan follows the SBOM rather than replacing it.
Hash
The sha256 of the artefact. Without the digest the SBOM is a list of names, and a rebuilt image with the same name and version differs silently.
Purl
pkg:npm/lodash@4.17.21 is a package URL that points at the same component in any tool, so two SBOMs can be compared line by line.
Add the supplier and the dependency edges and you have something a scanner can consume. Leave the hash out and you have a spreadsheet.
The honest caveat: a complete SBOM of a build you cannot reproduce tells you what you shipped once, not what you will ship next.
The lesson: five fields, one component, or the line is only a label.
Your turn: Which field does your SBOM generator drop first?
Related on this site
More notes: Security engineering
Open in the notes app: search, filters, copy This note on GitHub