Skip to content

pnpm-lock.yaml vulnerability scanner

Free, no sign-up

Scan a pnpm-lock.yaml for known vulnerabilities without installing anything. Works with lockfile versions 5, 6 and 9 and shows the fixed version of each one.

The file is read in your browser. Only package names and versions are sent to OSV when you scan.

This tool asks the OSV.dev vulnerability database directly from your browser. It sends the name, version and ecosystem of each package in the file, and then the IDs of the advisories that matched. The file itself, its paths, URLs and hashes stay in your browser, and nothing is sent to HardenKit.

How to use the pnpm-lock.yaml vulnerability scanner

  1. Drop your pnpm-lock.yaml on the page, or paste its contents.
  2. Press the scan button to send the package names and versions to OSV.dev.
  3. Read the table, worst first, with the fixed version of each package.
  4. Upgrade with pnpm update package, or pin a nested package with “pnpm.overrides” in package.json, then scan again.

About this tool

pnpm-lock.yaml lists every package pnpm installed under a “packages” key, one entry per name and version. The way that key is written has changed twice. Lockfile version 5 (pnpm 7 and older) writes /lodash/4.17.21, version 6 (pnpm 8) writes /[email protected] with peer dependencies in brackets after it, and version 9 (pnpm 9 and later) drops the leading slash. This scanner reads all three.

For each entry the scanner takes the package name and version, strips the peer-dependency suffix, and asks OSV.dev whether that version has a published advisory. One package installed with two sets of peers is one package and is looked up once. Entries that come from a git repository, a tarball URL or a local folder have no registry version, so they are listed as not checked.

The table is sorted by the severity stated in each advisory. “Fixed in” is the first fixed version on the release line you are on, which is the smallest upgrade that removes the finding. Most findings are in transitive dependencies; pnpm why package-name shows which of your direct dependencies is responsible for one.

Sources

Questions

Which pnpm versions does the scanner support?

Lockfile versions 5, 6 and 9, written by pnpm 7 and older, pnpm 8, and pnpm 9 and later. The version is on the first line of the file as lockfileVersion. A workspace lockfile works as well: all its importers share one “packages” list.

How is this different from pnpm audit?

pnpm audit runs in the project and asks the npm registry. This page reads only the lockfile, in the browser, and asks OSV.dev. It is useful for a repository you have not checked out or a machine without Node.js.

How do I fix a vulnerable transitive dependency in pnpm?

Add the package to the “pnpm.overrides” field of the root package.json with the fixed version, then run pnpm install. Test afterwards, because the parent package did not ask for that version.

Does the scanner upload my lockfile?

No. The YAML is parsed in your browser. OSV.dev receives a list of package names and versions with the ecosystem name “npm”, and nothing else from the file.

Related tools