← Back to PullGuard

Lockfile diff: install-time changes on every pull request

A pull request that adds a dependency changes its lockfile by hundreds or thousands of lines, and nobody reads them. PullGuard compares the lockfiles and install configuration in each pull request with its base branch and names the changes a supply-chain attack needs: a package that now runs code on install, a package fetched from somewhere other than the registry, and integrity hashes that were removed, weakened or swapped. Pro

What is compared

Both sides are read from git: the merge-base with the base branch, and the pull request's HEAD commit. A lockfile is compared with every lockfile of the same ecosystem in the same directory at the base, of any format, so a copy saved under another name (npm-shrinkwrap.json, which npm prefers) is not judged as a brand-new file. Ecosystems are never mixed: a poetry.lock beside a package-lock.json is compared only with Python lockfiles. exclude, .gitignore and the scan's read limits do not apply: the comparison does not use the working tree. A scan of a subdirectory still compares the lockfiles and configuration in the directories above it that govern it.

Formats: package-lock.json and npm-shrinkwrap.json (v1, v2 and v3 — for a v2 file both of its trees), yarn.lock (v1 and berry) and pnpm-lock.yaml; Python uv.lock and poetry.lock; Ruby Gemfile.lock (with its CHECKSUMS section when Bundler writes one); Go go.sum; and Gradle gradle/verification-metadata.xml (only under the build's gradle/ directory, the one place Gradle reads it).

Findings

FindingSeverityWhen
lockfile_install_script_addedmajor A package that is new, or whose version changed, runs an install script, and no version of it did at the base. Upgrading a package that already ran one is silent.
lockfile_source_changedmajor A package installed from a git repository, a local path or a tarball URL instead of the registry; a registry tarball that is not the named version (another package's tarball under this package's name); a registry host the lockfile did not use before (one finding per host); a new alias that installs a package new to the lockfile or re-points the name of one that was there (including a yarn entry that serves another package's name, and a pnpm importer alias); a yarn dependency installed with a repository patch; any download over plaintext http.
lockfile_integrity_changedmajor For the same published version: the integrity hash removed, weakened (for example sha512 to sha1), or different (different bytes). A new download with no hash at all. The install-script flag removed at the same version. Where a lockfile pins each file separately (Python wheels and source archives, a Go module and its go.mod, Gradle artifacts, a gem's checksum), each file is compared on its own: the same file with a different hash, or every hash removed, fires; a file added to or dropped from a release is a routine refresh and is silent.
lockfile_lookalike_namemajor / minor A package name new to the lockfile (npm or PyPI) that imitates a popular package: one character different (including two swapped letters), different only in separators (crossenv / cross-env), or the popular name with an added prefix or suffix (nodemailer-js). Popular names come from published rankings of the most downloaded and most depended-on packages; a popular name is never reported itself. Minor when the name is in an npm scope the lockfile already uses.
install_hook_changedminor / major Install configuration changed: Gradle's dependency-verification settings (major when verification is turned off or more artifacts or keys are trusted), package.json lifecycle scripts, packageManager, overrides / resolutions, pnpm build allowlists, dev-container lifecycle commands, .npmrc, .yarnrc, .yarnrc.yml, pnpm-workspace.yaml, a pnpmfile, yarn releases and plugins (compared by content hash, however large), dependency patches, and a directory whose every lockfile was removed. Major when the setting redirects downloads or runs code during install. Setting names are shown, never values (an .npmrc can hold a token).
lockfile_unverifiedmajor A changed lockfile that could not be compared: it does not parse, repeats a key or an entry, is larger than 16 MiB, is a symlink, has a lockfile name in non-canonical case, or hides a field at an unexpected indent. It is counted on the report and the pull-request comment says the lockfile could not be compared.

These findings judge the change itself, so a committed baseline, delta mode and a .pullguardignore entry do not remove them. A reviewed false-positive override (status: false_positive with a reason) keeps one visible and stops it blocking. Ordinary lockfile churn — an upgrade, npm dedupe, re-sorting, an integrity upgrade, a lockfile-format migration — is silent.

What it cannot see

Requirements


← PullGuard home Configuration →