What is a lockfile?

Updated

A lockfile is a file, such as package-lock.json, that records the exact version of every package your project installed, including the packages your packages depend on.

Why does it matter?

It is the list Crowsnest reads. It makes installs repeatable, and it shows you what changed between two reviews.

How do I stay safe?

  • Commit your lockfile to version control.
  • Look at lockfile changes in code review, not only code changes.
  • Install from the lockfile in your builds.

What this does not do

A lockfile does not say whether a package is safe. It only records what you have. Crowsnest scans that record; it cannot check a folder with no lockfile.

Where do I read more?

Related terms: supply chain attack and maintainer takeover. Read How to stay safe from malicious packages, or learn how to scan a project in CLI usage. Back to the glossary.