trace-npm
npm now asks you to approve install scripts. Approving one doesn’t tell you what it does. trace-npm runs one under a syscall tracer and reports what it read, started and connected to.
A script that reads a credential and sends it away.
This is a recorded run against a demo package built to read a credential and send it away. The credentials trace-npm offers a script are synthetic canaries in a throwaway home directory, so reading one is evidence the script went looking for something it had no reason to need.

What it reports
- FilesRead or written, with suspicious paths flagged: ~/.ssh, ~/.aws, .env files, shell profiles, keychains.
- ProgramsEvery child process the script started, attributed to the script that started it.
- NetworkThe endpoints it connected to. Endpoint-level for now, not DNS names.
- Honesty about itselfVisible accounting for any trace it lost, and a limitations block in every report. JSON output for CI.
Try it on a package you’d like to look at. It executes the script, so use a disposable machine or container.
npx trace-npm run --package some-package --script postinstall \ --i-understand-this-executes-untrusted-code
Already have a saved trace? trace-npm report reads it on any platform.
What it is not
- Not a sandboxThe script really runs. The host runner uses a synthetic home directory and a timeout, which limits the damage; it does not remove the risk.
- Not a verdictA clean report is not proof that a package is safe, and a flagged read is evidence, not proof of intent.
- Not cross-platform yetLive tracing needs Linux and strace. On macOS or Windows, run it in a container.
- Read before sharingIn 0.1.0-alpha, some secrets and home-directory paths can remain visible in a report.
- Not completeAttribution is per script rather than per nested package, and file contents are never captured.
How it was tested
Six automated tests replay saved traces of an adversarial and a benign package: parsing, the suspicious-path report, process attribution in both, a payload run through a shell, and suppression of noisy path probes. They cover parsing and reporting. Live tracing needs Linux and strace, and is the newer half of the tool, which is part of why this is an alpha.