Safeguard
Supply Chain•

Is an SBOM the same as a lockfile?

No. A lockfile pins versions so installs repeat. An SBOM is a standard, shareable inventory of components. Here is how the two differ and work together.

Safeguard Security Team
3 min read

No. A lockfile records the exact dependency tree so later installs produce the same result. An SBOM is a standard format inventory meant to be read by other people and tools. A lockfile can be an input to an SBOM, but it is not a substitute for one.

Definitions

Lockfile. The npm documentation says package-lock.json describes the exact tree that was generated, so that later installs are able to generate identical trees. It records versions, where each package was resolved from, and an integrity hash. It is meant to be committed so teammates and CI install the same thing.

SBOM. A software bill of materials lists the components in a piece of software in a standard format such as CycloneDX or SPDX. It is designed to be handed to someone else: a customer, an auditor, a scanner.

Side by side

LockfileSBOM
Main purposeRepeatable installsTransparency and analysis
FormatTool specificStandard (CycloneDX, SPDX)
AudienceYour buildCustomers, auditors, scanners
Covers other ecosystemsOne package manager onlyCan describe a whole product
Licences and supplier dataNot the goalPart of the format
Can describe containers or binariesNoYes, depending on the generator

Why the difference matters

  • A product often mixes ecosystems. A web service may have npm packages, Python tooling and a base image. Each has its own lockfile. An SBOM can describe all of it in one document.
  • A lockfile is not something you can safely send to a customer. Formats differ per tool and nothing standardises how components are identified.
  • Lockfiles describe what a build would install, not necessarily what was shipped. A container may add system packages that no lockfile lists.

When each is the right tool

  1. Committing a lockfile is a build hygiene step. Do it for applications.
  2. Generating an SBOM from the lockfile on each release gives you the shareable inventory.
  3. Scanning either one finds known vulnerabilities, but the SBOM travels better between teams.

A worked example

A service written in Python ships in a container. The Python lockfile lists the pinned libraries. The container also holds an operating system layer with its own packages, and maybe a binary downloaded during the build. None of those appear in the Python lockfile. An SBOM generated from the built image can list all three groups in one file, which is why the two are used together, not instead of each other.

Quick check

If I commit a lockfile, do I already have an SBOM?

No. You have the input. Run a generator to produce a standard format document and check that it includes identifiers and transitive components.

Can I scan a lockfile for vulnerabilities?

Yes. Many scanners read lockfiles directly. Scanning the SBOM gives the same finding for the same versions.

Where Safeguard fits

Safeguard's SBOM and dependency scanning reads manifests and lockfiles and produces an inventory you can scan and share. The free scan accepts a project so you can compare the two views.

Sources

  • npm Docs, package-lock.json (purpose and recorded fields).
  • CycloneDX specification overview, cyclonedx.org (BOM types and current version 1.7).

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.