> cat /dev/github | grep security-tools
discovered 30 Mar 2026

npq

JavaScript ★ 1561 via github-topic
→ View on GitHub

AI Summary: npq is a tool designed to audit npm packages prior to installation, enhancing security during the package management process. It performs multiple checks, including vulnerability assessments using the Snyk database, package age, popularity metrics, and the presence of essential documentation files. Notable features include an auto-continue mode after warnings and customizable settings for strict security reviews.


README

npq allows you to audit npm packages before you install them

npm license codecov CI Known Vulnerabilities Security Responsible Disclosure

TL;DR how to use npq:

$ npx npq install express --dry-run

What it does: the npx tool downloads and execute npq package, runs an install check for the express package and --dry-run means npq exists regardless of success/errors.

Here’s a screenshot of npq in action:

npq demo screenshot

Media coverage about npq:

About

Once npq is installed, you can safely* install packages:

npq install express

npq will perform the following steps to sanity check that the package is safe by employing syntactic heuristics and querying a CVE database:

  • Consult the snyk.io database of publicly disclosed vulnerabilities to check if a security vulnerability exists for this package and its version.
  • Package age on npm
  • Package download count as a popularity metric
  • Package has a README file
  • Package has a LICENSE file
  • Package has pre/post install scripts

IMPORTANT: npq by default uses an auto-continue mode when warnings are detected (no errors), waiting 15 seconds before proceeding with the installation. You can disable this behavior via the --disable-auto-continue CLI flag or the NPQ_DISABLE_AUTO_CONTINUE=true environment variable to enforce a strict review and security hardened installs. See the auto-continue documentation for more details.

When npq completes its signal checks it hands over the actual package install job to the package manager (npm by default, or as specified via the NPQ_PKG_MGR environment variable).

DISCLAIMER: there’s no guaranteed absolute safety; a malicious or vulnerable package could still exist that has no security vulnerabilities publicly disclosed and passes npq’s checks.

Demo

https://github.com/user-attachments/assets/619ab3f6-aa3f-483c-9560-0f18e033e6bf

Install

npm install -g npq

Note: we recommend installing with npm rather than yarn. That way, npq can automatically install shell aliases for you.

You can also install npq via Homebrew on macOS or Linux:

brew install npq

Usage

Install packages with npq

npq install express

Embed in your day to day

Since npq is a pre-step to ensure that the npm package you’re installing is safe, you can safely embed it in your day-to-day npm usage so there’s no need to remember to run npq explicitly.

alias npm='npq-hero'

Offload to package managers

If you’re using yarn, pnpm, or generally want to explicitly tell npq which package manager to use you can specify an environment variable: NPQ_PKG_MGR=<package-manager>

Examples:

Using yarn 1.x:

alias yarn="NPQ_PKG_MGR=yarn npq-hero"

Using yarn 4.x:

NPQ_PKG_MGR=yarn yarn run npq-hero

or

NPQ_PKG_MGR=yarn yarn exec npq-hero

Using pnpm:

NPQ_PKG_MGR=pnpm npx npq install fastify

Using pnpm with alias:

alias pnpm="NPQ_PKG_MGR=pnpm npq-hero"

Note: npq by default will offload all commands and their arguments to the npm (or other package manager as specified) after it finished its due-diligence checks for the respective packages.

Marshalls

Marshall NameDescriptionNotes
ageWill show a warning for a package if its age on npm is less than 22 daysChecks a package creation date, not a specific version
authorWill show a warning if a package has been found without an author fieldChecks the latest version for an author
downloadsWill show a warning for a package if its download count in the last month is less than 20
readmeWill show a warning if a package has no README or it has been detected as a security placeholder package by npm staff
repoWill show a warning if a package has been found without a valid and working repository URLChecks the latest version for a repository URL
scriptsWill show a warning if a package has a pre/post install script which could potentially be malicious
snykWill show a warning if a package has been found with vulnerabilities in Snyk’s databaseFor Snyk to work you need to either have the snyk npm package installed with a valid API token, or make the token available in the SNYK_TOKEN environment variable, and npq will use it
licenseWill show a warning if a package has been found without a license fieldChecks the latest version for a license
expired domainsWill show a warning if a package has been found with one of its maintainers having an email address that includes an expired domainChecks a dependency version for a maintainer with an expired domain
signaturesWill compare the package’s signature as it shows on the registry’s pakument with the keys published on the npmjs.com registry
provenanceWill verify the package’s attestations of provenance metadata for the published package
version-maturityWill show a warning if the specific version being installed was published less than 7 days agoHelps identify recently published versions that may not have been reviewed by the community yet
newBinWill show a warning if the package version being installed introduces a new command-line binary (via the bin field in package.json) that was not present in its previous version.Helps identify potentially unexpected new executables being added to your node_modules/.bin/ directory.
typosquattingWill show a warning if the package name is similar to a popular package name, which could indicate a potential typosquatting attack.Helps identify packages that may be trying to trick users into installing them by mimicking popular package names.
deprecationWill show a warning if the package version is deprecated on npm or if its GitHub repository has been archived.Helps identify packages that are no longer maintained or recommended for use. Set GITHUB_TOKEN environment variable for higher GitHub API rate limits.

Disabling Marshalls

To disable a marshall altogether, set an environment variable using with the marshall’s shortname.

Example, to disable the Snyk vulnerability marshall:

MARSHALL_DISABLE_SNYK=1 npq install express

Available Marshall Environment Variables

Here are all the available environment variable names for disabling specific marshalls:

Marshall NameEnvironment VariableDescription
ageMARSHALL_DISABLE_AGEDisable package age checks
authorMARSHALL_DISABLE_AUTHORDisable package author verification
downloadsMARSHALL_DISABLE_DOWNLOADSDisable download count checks
expired domainsMARSHALL_DISABLE_MAINTAINERS_EXPIRED_EMAILSDisable expired domain checks for maintainer emails
licenseMARSHALL_DISABLE_LICENSEDisable license availability checks
provenanceMARSHALL_DISABLE_PROVENANCEDisable package provenance verification
repoMARSHALL_DISABLE_REPODisable repository URL validation
scriptsMARSHALL_DISABLE_SCRIPTSDisable pre/post install script checks
signaturesMARSHALL_DISABLE_SIGNATURESDisable registry signature verification
snykMARSHALL_DISABLE_SNYKDisable Snyk vulnerability checks
typosquattingMARSHALL_DISABLE_TYPOSQUATTINGDisable typosquatting detection
version-maturityMARSHALL_DISABLE_VERSION_MATURITYDisable version maturity checks
newBinMARSHALL_DISABLE_NEWBINDisable new binary introduction checks
deprecationMARSHALL_DISABLE_DEPRECATIONDisable deprecation checks

Run checks on package without installing it

npq install express --dry-run

Force non-rich text output

npq install express --plain

Disable auto-continue countdown

By default, when npq detects only warnings (no errors), it automatically proceeds with installation after a 15-second countdown. To disable this behavior and always require explicit confirmation:

Using the CLI flag:

npq install express --disable-auto-continue

Using the environment variable:

export NPQ_DISABLE_AUTO_CONTINUE=true
npq install express

Or set it permanently in your shell profile (.bashrc, .zshrc, etc.):

export NPQ_DISABLE_AUTO_CONTINUE=true

When auto-continue is disabled, npq will always prompt for explicit confirmation before proceeding with installation, even when only warnings are detected.

Learn Node.js Security

Node.js Security

Screenshot 2024-09-12 at 20 14 27

Learn Node.js Secure Coding techniques and best practices from Liran Tal

FAQ

  1. What is the difference between npq and npq-hero?
  • npq is meant to be its own stand-alone CLI so it has command line flags like --dry-run and others (see npq --help). However, when you want to alias the npm CLI to NPQ you should use npq-hero as the executable of the alias to npm (e.g: alias npm=npq), which means npq-hero can’t have its own command-line flags because they could conflict with the npm executable.
  1. Can I use NPQ without having npm or yarn?
  • NPQ will audit a package for possible security issues, but it isn’t a replacement for npm or yarn. When you choose to continue installing the package, it will offload the installation process to your choice of either npm or yarn.
  1. How is NPQ different from npm audit?
  • npm install will install a module even if it has vulnerabilities; NPQ will display the issues detected, and prompt the user for confirmation on whether to proceed installing it.
  • NPQ will run synthetic checks, called marshalls, on the characteristics of a module, such as whether the module you are going to install has a pre-install script which can be potentially harmful for your system and prompt you whether to install it. Whereas npm audit will not perform any such checks, and only consults a vulnerability database for known security issues.
  • npm audit is closer in functionality to what Snyk does, rather than what NPQ does.
  1. Do I require a Snyk API key in order to use NPQ?
  • It’s not required. If NPQ is unable to detect a Snyk API key for the user running NPQ, then it will skip the database vulnerabilities check. We do, however, greatly encourage you to use Snyk, and connect it with NPQ for broader security.
  1. Why is NPQ connecting to external domains like gmail.com or personal websites during installation?
  • This is not telemetry. NPQ does not collect any usage data. When auditing a package, NPQ fetches the maintainers/authors of the dependency and checks their email addresses to verify they are valid and not associated with expired domains. Expired domains can be abused by attackers for account takeover (ATO) attacks to compromise packages with malicious versions. Hence, NPQ may make DNS requests to domains like gmail.com or personal domains found in maintainer emails. Additionally, NPQ makes HTTP requests to osv.dev to fetch security vulnerability data (or uses Snyk if configured, as a prioritized option).

Contributing

Please consult the CONTRIBUTING for guidelines on contributing to this project

Author

Liran Tal liran.tal@gmail.com