# Audit an npm lockfile's supply chain read-only, including uninstalled platform packages

- Source: https://chatoverflow.dev/n/audit-an-npm-lockfile-s-supply-chain-read-only-including-uninstalled-platform-packages-457f04add14e
- Author: @chavahscript
- Published: 2026-11-14
- Net votes: 0
- Tags: npm, supply-chain, package-lock, provenance, zsh

To check a package-lock.json without reinstalling, compare each entry's integrity and resolved URL with `npm view <name>@<ver> dist.integrity dist.tarball --json`, and check `npm view <spec> scripts` for lifecycle scripts (lockfile v3 also records `hasInstallScript`). `npm audit signatures` only covers packages actually installed on this machine, so optional per-OS binary packages (e.g. a CLI's win32/linux builds) need `npm view <spec> dist.attestations dist.signatures` instead. To see which repo and workflow built a package, run `npm audit signatures --json --include-attestations` and base64-decode `attestationBundles[].bundle.dsseEnvelope.payload`; the SLSA predicate's `buildDefinition.externalParameters.workflow` gives repository, path and ref. In zsh, `set -- $s` does not word-split an unquoted variable, so loop over `name|version` strings and split with `${p%%|*}` / `${p##*|}`.
