npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lifecycle-audit

v1.0.0

Published

Zero-dependency CLI and API to audit npm, pnpm, and yarn dependencies for install/postinstall lifecycle scripts and risky shell payloads.

Readme

lifecycle-audit

Zero-dependency CLI and TypeScript/JavaScript API to audit node_modules, package-lock.json, npm-shrinkwrap.json, and pnpm-lock.yaml for install/uninstall lifecycle scripts (preinstall, install, postinstall, preuninstall, uninstall, postuninstall, and optional prepare) and flag risky shell payloads.

Why?

  • npm audit only checks known CVEs—it does not flag a dependency that runs curl ... | bash in a postinstall script.
  • lifecycle-audit is read-only, has zero runtime dependencies, and works out of the box with npx.

Quick Start

npx lifecycle-audit

Fail CI on any unallowed lifecycle script (including low / medium):

npx lifecycle-audit --strict

Allow trusted native build packages and output JSON:

npx lifecycle-audit --allow esbuild,sharp --json

CLI Options

| Flag | Description | Default | | --- | --- | --- | | --dir <path> | Target project directory | . | | --allow <pkg,...> | Allowlisted package name or name@version (repeatable) | [] | | --fail-on <level> | Exit 1 on unallowed findings: none, high, medium, any | high | | --strict | Alias for --fail-on any | false | | --json | Output machine-readable JSON | false | | --quiet | Hide allowlisted packages in text output | false | | --include-root | Also audit the root package.json | false | | --include-prepare | Also include prepare hooks | false | | --lockfile-only | Skip node_modules and scan lockfiles only | false | | -v, --version | Show version | — | | -h, --help | Show help | — |

Allowlist Configuration

You can persist allowlisted packages in .lifecycle-audit.json:

{
  "allow": ["esbuild", "[email protected]"]
}

Or inside your project's package.json:

{
  "lifecycleAudit": {
    "allow": ["esbuild"]
  }
}

Programmatic API

Works in both ESM and CommonJS with full TypeScript definitions:

import { auditLifecycle, analyzeScript, formatReport } from 'lifecycle-audit';

const report = auditLifecycle({
  dir: process.cwd(),
  allow: ['esbuild'],
  failOn: 'high'
});

if (report.shouldFail) {
  console.error(formatReport(report));
  process.exit(1);
}

console.log(analyzeScript('curl -fsSL https://example.com/install.sh | bash'));
// { risk: 'high', reasons: ['Invokes network transfer or socket utility', 'Pipes output directly into a shell interpreter'] }

Risk Levels

  • high: Network utilities (curl, wget, iwr, fetch, nc), piping into shells (| sh, | bash), base64/hex obfuscation, eval / new Function, or references to sensitive files (.ssh, .aws, .npmrc, id_rsa).
  • medium: Inline code execution (node -e, python -c, sh -c, cmd /c), shell command substitution/piping, background process spawning, or environment inspection.
  • low: Standard native addon builders (node-gyp, prebuild-install, napi-postinstall), local script invocations (node install.js), or benign messages.
  • unknown: Lockfile reports hasInstallScript: true or requiresBuild: true, but node_modules is not installed locally so the script body cannot be inspected yet.

License

MIT