Skip to content
chains-projectPublic

About

Record Solve Verify. A project for verifiable dependency resolution.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

34 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rnpm — reproducible npm

rnpm is a research prototype for verifiable dependency resolution in npm. It records resolution evidence in the lockfile and uses that evidence to regenerate and compare dependency graphs.

Installation

Requirements

Use Node.js and npm in a Linux environment. The prototype was evaluated using Windows Subsystem for Linux (WSL2), with kernel version 5.15.167.4-microsoft-standard-WSL2.

Verification may install the npm versions recorded in the lockfile. Use a user-writable npm global prefix, for example through a Node.js version manager.

Install from source

Using HTTPS:

git clone https://github.com/chains-project/rnpm.git
cd rnpm
npm link

Using SSH (with GitHub SSH access configured):

git clone git@github.com:chains-project/rnpm.git
cd rnpm
npm link

Running tests

Run the automated test suite from the repository root:

npm test

The tests cover command history recording, command replay, manifest and lockfile restoration, dependency graph comparison, and verification behavior.


Usage

Commands

The supported commands are install (i), uninstall (remove, rm, un), init, update, and verify.

Flags

Use the following npm flags to generate lockfiles without installing dependencies or executing lifecycle scripts:

  • --package-lock-only
  • --ignore-scripts

Both flags are applied automatically during verification.

Use the default npm registry. Custom registries (--registry) are not supported. Other npm flags are not guaranteed to be supported during replay.

Verification flags

  • --regen: Regenerate the lockfile instead of reusing an existing rnpm-replication.json.
  • --non-interactive (alias --yes): Run verification without interactive confirmation, regenerating the lockfile rather than reusing an existing one.
  • --keep-npm: Do not restore the npm version that was active before verification.

By default, if rnpm-replication.json already exists, rnpm verify prompts the user to compare the existing file or regenerate it. Reusing the existing file performs comparison without repeating dependency resolution.

Example

mkdir tst
cd tst
rnpm init -y
rnpm install react --package-lock-only --ignore-scripts
rnpm verify

If verification succeeds, the terminal displays:

Verification completed

Output

package-lock.json

rnpm extends the lockfile produced by npm with the following fields:

  • manifestIntegrity: SHA-256 digest of package.json, used to detect changes to the manifest since the last recorded operation. This digest does not establish the correctness of dependency resolution.
  • rnpm: Metadata used for regeneration and verification.
    • history: Ordered sequence of recorded commands used during replay. Each entry contains:
      • command: npm command (e.g. install or update).
      • args: Command-line arguments.
      • npm: npm version used for the command.
      • time: Resolution timestamp in RFC 3339 format (e.g. 2026-03-17T15:18:17.497Z). During replay, this timestamp is supplied to npm through the --before flag for install and update commands.

rnpm-replication.json

The lockfile regenerated during verification, without the additional rnpm and manifestIntegrity fields. It is used for comparison with the original lockfile.

Terminal

The npm commands supported by rnpm retain their corresponding npm functionality and record resolution evidence in package-lock.json. Unlike npm init, rnpm init also creates a lockfile.

The verify command replays the recorded history using the recorded npm versions and resolution timestamps. It compares the resulting logical dependency graph, dependency types, package sources, and tarball integrity values with those in the original lockfile. A mismatch or failed verification is reported with a non-zero exit status.

A successful comparison establishes correspondence between the compared graphs under the replay conditions; it does not authenticate the recorded history or establish that the original resolution was free from manipulation.

Why record resolution history?

Dependency resolution in npm is iterative. The resulting lockfile depends on both the sequence of resolution commands and the state of the package registry at the time of each command.

Consider the following example, assuming no other dependency constraints:

  1. Run npm install pkgA when version 1.0.0 is the latest release. npm adds pkgA: ^1.0.0 to package.json and records pkgA@1.0.0 in the lockfile.
  2. pkgA@1.0.1 is published.
  3. pkgB@1.0.0 is published.
  4. Run npm install pkgB. npm adds pkgB: ^1.0.0 to package.json and records pkgB@1.0.0 in the lockfile, retaining pkgA@1.0.0.
  5. Resolving the dependencies from the final manifest alone, without the existing lockfile, can instead select pkgA@1.0.1 and pkgB@1.0.0.

The final manifest does not preserve the sequence of commands or their resolution conditions. rnpm records this information to support later dependency graph regeneration. Historical registry state must also remain recoverable for regeneration to succeed.

About

Record Solve Verify. A project for verifiable dependency resolution.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages