🎖safely* install packages with npm or yarn by auditing them as part of your install process
safely* install packages with npm/yarn by auditing them as part of your install process
Once npq is installed, you can safely* install packages:
npq install express
npqwill perform the following steps to sanity check that the package is safe by employing syntactic heuristics and querying a CVE database:
If npq is prompted to continue with the install, it simply hands over the actual package install job to the package manager (npm by default).
safely* - there's no guaranteed safety; a malicious or vulnerable package could still exist that has no security vulnerabilities publicly disclosed and passes npq's checks.
npm install -g npq
Note: we recommend installing with
yarn. That way,
npqcan automatically install shell aliases for you.
npq install express
npqis a pre-step to ensure that the npm package you're installing is safe, you can safely embed it in your day-to-day
npmusage so there's no need to remember to run
If you're using
yarn, or generally want to explicitly tell npq which package manager to use you can specify an environment variable:
Example: create an alias with yarn as the package manager:
alias yarn="NPQ_PKG_MGR=yarn npq-hero"
npqby default will offload all commands and their arguments to the
npmpackage manager after it finished its due-diligence for the respective packages.
| Marshall Name | Description | Notes | --- | --- | --- | age | Will show a warning for a package if its age on npm is less than 22 days | Checks a package creation date, not a specific version | downloads | Will show a warning for a package if its download count in the last month is less than 20 | readme | Will show a warning if a package has no README or it has been detected as a security placeholder package by npm staff | scripts | Will show a warning if a package has a pre/post install script which could potentially be malicious | snyk | Will show a warning if a package has been found with vulnerabilities in snyk's database | For snyk to work you need to either have the
snyknpm package installed with a valid api token, or make the token available in the SNYK_TOKEN environment variable, and npq will use it | license | Will show a warning if a package has been found without a license field | Checks the latest version for a license
To disable a marshall altogether, set an environment variable using with the marshall's shortname.
Example, to disable snyk:
MARSHALL_DISABLE_SNYK=1 npq install express
An example of using lockfile-lint with a
.travis.ymlconfiguration as part of your build:
language: node_js before_script: - npx lockfile-lint --path package-lock.json --validate-https --allowed-hosts npm install: - yarn install script: - yarn run test
npm installwill 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.
pre-installscript which can be potentially harmful for your system and prompt you whether to install it. Whereas
npm auditwill not perform any such checks, and only consults a vulnerability database for known security issues.
npm auditis closer in functionality to what snyk does, rather than what NPQ does.
Please consult the CONTRIBUTING for guidelines on contributing to this project
Liran Tal [email protected]