use npm safety
npm repository may contain some harmful packages,
and these packages may protect them use some similar words as popular package,
such asgoodjs
togood-js
, butgood-js
may contain harmful codes.
use npmsafe instead of npm
npm i npmsafe -g
git clone git@github.com:ueqt/npmsafe.git
cd npmsafe
npm link
npm remove npmsafe -g
npm publish
support all commands and arguments that npm support.
Example:
$ npmsafe install express
cd to folder which contains package.json, this command will check packages in package.json.
if something not verified, you can check it's downloads count in last month to judge it safe or not.
Example:
$ npmsafe check
Analysing ~/git/xxx/package.json
Not verified(package[downloads in npmjs in last month or stars in github(todo)]): 7
mysql [ 171232 ]
moment [ 1025532 ]
later [ 6008 ]
nodemailer [ 242134 ]
nodeutil [ 1111 ]
lodash [ 7512304 ]
influx [ 5146 ]
You can choose one choice:
[ 1 ].Stop(Default)
[ 2 ].Continue
[ 3 ].Continue and save to whitelist
Please input your choice:
I will add much internal whitelist, but you still need more whitelist.
So when you choose 3 in install time, it will save to your custom whiltelist.
Custom whitelist is at ~/.npmsafe/customWhiteList.txt
, you can also edit it manually.
- 1.0.12 Searching remote whitelist update when start npmsafe to ensure your whitelist is latest.
make a tool to automatically check npmjs repository and create whitelist.json more reliable