|
3 | 3 | </h1> |
4 | 4 |
|
5 | 5 | <p align="center"> |
6 | | - a Node.js CLI to deeply analyze the dependency tree of a given package / directory |
| 6 | + a Node.js CLI to deeply analyze the dependency tree of a given NPM package or Node.js local app |
7 | 7 | </p> |
8 | 8 |
|
9 | 9 | <p align="center"> |
|
28 | 28 | <img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uxkBbhI2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zxtg6o2v2ahmpsjfhs71.PNG"> |
29 | 29 | </p> |
30 | 30 |
|
31 | | -## 📢 About |
32 | | - |
33 | | -[Node.js](https://nodejs.org/en/) security Command Line Interface. The goal of the project is to a design a CLI/API that will fetch and deeply analyze the dependency tree of a given **npm** package (Or a local project with a **package.json**) and output a **.json file** that will contains all metadata and flags about each packages. All this data will allow to quickly identify different issues across projects and packages (related to security and quality). |
34 | | - |
35 | | -The CLI allow to load the JSON into a Webpage with the **open** command. The page will draw a Network of all dependencies with [vis.js](https://visjs.org/) (example in the screenshot above). We also wrote a little Google drive document a while ago that summarizes some of these points: |
36 | | - |
37 | | -- [NodeSecure G.Drive Design document](https://docs.google.com/document/d/1853Uwup9mityAYqAOnen1KSqSA6hlBgpKU0u0ygGY4Y/edit?usp=sharing) |
38 | | - |
39 | 31 | ## 📜 Features |
40 | 32 |
|
41 | | -- Run an AST analysis on each .js/.mjs file in the packages tarball and sort out warnings (unsafe-regex, unsafe-import etc) and the complete list of required expr and statements (files, node.js module, etc.). |
| 33 | +- Run a static scan on every JavaScript files and sort out warnings (unsafe-regex, unsafe-import etc) and the complete list of required expr and statements (files, node.js module, etc.). |
42 | 34 | - Return complete composition for each packages (extensions, files, tarball size, etc). |
43 | 35 | - Packages metadata from the npm registry API (number of releases, last publish date, maintainers etc). |
44 | 36 | - Search for licenses files in the tarball and return the [SPDX](https://spdx.org/licenses/) expression conformance of each detected licenses. |
45 | | -- Link vulnerabilities from the [Security-WG repository](https://github.com/nodejs/security-wg/tree/master/vuln/npm) to the package version node. |
46 | | -- Add flags to each packages versions to identify well known patterns and potential security threats easily. |
47 | | -- Analyze npm packages and local Node.js projects. |
48 | | -- Supports [OpenSSF Scorecard](https://github.com/ossf/scorecard). |
| 37 | +- Link vulnerabilities from the multiple sources like GitHub Advisory, Sonatype or Snyk using [Vulnera](https://github.com/NodeSecure/vulnera). |
| 38 | +- Add flags (emojis) to each packages versions to identify well known patterns and potential security threats easily. |
| 39 | +- First-class support of open source security initiatives like [OpenSSF Scorecard](https://github.com/ossf/scorecard). |
49 | 40 |
|
50 | 41 | ## 🚧 Requirements |
51 | 42 |
|
@@ -94,7 +85,7 @@ $ nsecure --help |
94 | 85 | $ nsecure cwd |
95 | 86 |
|
96 | 87 | # Run an analysis for a given 'npm' package (must be in the npm registry). |
97 | | -$ nsecure from @sindresorhus/is |
| 88 | +$ nsecure from mocha |
98 | 89 | ``` |
99 | 90 |
|
100 | 91 | Then a `nsecure-result.json` will be writted at the current CLI location. To open it on a web page just run |
@@ -136,13 +127,14 @@ Some options are available on both `cwd`, `from` and `auto` commands. The output |
136 | 127 | $ nsecure from express -d 10 -o express-security-report |
137 | 128 | ``` |
138 | 129 |
|
139 | | -## Private packages / registry |
| 130 | +## Private registry / Verdaccio |
140 | 131 |
|
141 | | -Nsecure allow you to fetch stats on private npm packages by setting up a `NODE_SECURE_TOKEN` env variable (which must contains an [npm token](https://docs.npmjs.com/creating-and-viewing-authentication-tokens)). |
| 132 | +NodeSecure allow you to fetch stats on private npm packages by setting up a `NODE_SECURE_TOKEN` env variable (which must contains an [npm token](https://docs.npmjs.com/creating-and-viewing-authentication-tokens)). |
142 | 133 |
|
143 | | -> 💬 If you link the package by yourself with npm you can create a `.env` file at the root of the project too. |
| 134 | +> [!TIP] |
| 135 | +> If you `npm link` the package by yourself you can create a `.env` file at the root of the project too. |
144 | 136 |
|
145 | | -Nsecure is capable to work behind a custom private npm registry too by searching the default registry URL in your local npm configuration. |
| 137 | +NodeSecure is capable to work behind a custom private npm registry too by searching the default registry URL in your local npm configuration. |
146 | 138 |
|
147 | 139 | ```bash |
148 | 140 | $ npm config get registry |
|
0 commit comments