You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 23920aa
Browse filesBrowse the repository at this point in the historyBrowse files
a Node.js CLI to deeply analyze the dependency tree of a given NPM package or Node.js local app
6
+
Deeply analyze the dependency tree of a given NPM package or Node.js local app to spot security threats.
7
7
</p>
8
8
9
9
<palign="center">
@@ -28,158 +28,56 @@
28
28
</p>
29
29
30
30
<palign="center">
31
-
<imgsrc="./docs/ui-preview.PNG">
31
+
<imgsrc="./workspaces/cli/docs/ui-preview.PNG">
32
32
</p>
33
33
34
-
## 📜 Features
35
-
36
-
- 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.).
37
-
- Return complete composition for each packages (extensions, files, tarball size, etc).
38
-
- Packages metadata from the npm registry API (number of releases, last publish date, maintainers etc).
39
-
- Search for licenses files in the tarball and return the [SPDX](https://spdx.org/licenses/) expression conformance of each detected licenses.
40
-
- Link vulnerabilities from the multiple sources like GitHub Advisory, Sonatype or Snyk using [Vulnera](https://github.com/NodeSecure/vulnera).
41
-
- Add flags (emojis) to each packages versions to identify well known patterns and potential security threats easily.
42
-
- First-class support of open source security initiatives like [OpenSSF Scorecard](https://github.com/ossf/scorecard).
43
-
- Generate security report (PDF).
44
-
45
-
## 🚧 Requirements
46
-
47
-
-[Node.js](https://nodejs.org/en/) v24 or higher
34
+
**NodeSecure** is a Node.js CLI (`nsecure`) that performs a static and deep analysis of a package's dependency tree: AST-based scanning for malicious or unsafe patterns, npm registry metadata, license conformance, vulnerability aggregation (GitHub Advisory, Sonatype, Snyk) and [OpenSSF Scorecard](https://github.com/ossf/scorecard), all rendered through an interactive dependency graph with a PDF report generator.
48
35
49
36
## 💃 Getting Started
50
37
51
38
```bash
52
39
$ npm install @nodesecure/cli -g
53
-
```
54
-
55
-
or
56
-
57
-
```bash
58
-
$ git clone https://github.com/NodeSecure/cli.git
59
-
$ cd cli
60
-
61
-
$ npm install
62
-
# bundle/compile front-end assets
63
-
$ npm run build
64
-
$ npm link
65
-
```
66
-
67
-
Then the **nsecure** binary will be available in your terminal. Give a try with the popular [express](http://expressjs.com/) package. This will automatically open the webpage in your default system browser.
68
-
```bash
69
40
$ nsecure auto express
70
41
```
71
42
72
-
> [!TIP]
73
-
> Setup an [npm token](https://github.com/NodeSecure/cli#private-packages--registry) to avoid hiting the maximum request limit of the npm registry API.
74
-
75
-
## 👀 Usage example
76
-
77
-
```bash
78
-
# Run a scan on the current working dir
79
-
# Note: must have a package.json or node_modules directory
80
-
$ nsecure cwd
81
-
82
-
# Run a scan on a remote 'npm' package
83
-
$ nsecure from mocha
84
-
```
43
+
This repository is a monorepo. The `@nodesecure/cli` package, along with its full feature list, command documentation, configuration and FAQ, lives in the [workspaces/cli](./workspaces/cli) workspace — head there for everything about installing and using the CLI.
85
44
86
-
Then a `nsecure-result.json` will be writted at the current CLI location. To open it on a web page just run
| server |[@nodesecure/server](./workspaces/server)|
54
+
| cache |[@nodesecure/cache](./workspaces/cache)|
91
55
92
-
### Command Documentation
56
+
These packages are available in the Node Package Repository and can be easily installed with [npm](https://docs.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com), for example:
93
57
94
-
The CLI includes built-in documentation accessible with the --help option:
95
58
```bash
96
-
$ nsecure --help
97
-
$ nsecure <command> --help
59
+
$ npm i @nodesecure/documentation-ui
60
+
# or
61
+
$ yarn add @nodesecure/documentation-ui
98
62
```
99
63
100
-
For complete details on each command, refer to the following documents:
Each link provides access to the full documentation for the command, including additional details, options, and usage examples.
119
-
120
-
## Private registry / Verdaccio
121
-
122
-
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)).
64
+
## 🙏 Contributing
123
65
124
-
> [!TIP]
125
-
> If you `npm link` the package by yourself you can create a `.env` file at the root of the project too.
66
+
If you are a developer **looking to contribute** to the project, please first read our [CONTRIBUTING](./CONTRIBUTING.md) guide (Code of Conduct, first-contributor guide, Developer's Certificate of Origin, Discord).
126
67
127
-
NodeSecure is capable to work behind a custom private npm registry too by searching the default registry URL in your local npm configuration.
68
+
### Local Setup
128
69
129
70
```bash
130
-
$ npm config get registry
131
-
$ npm config set registry "http://your-registry/"
132
-
```
133
-
134
-
## API
135
-
Our back-end scanner package is available [here](https://github.com/NodeSecure/scanner).
136
-
137
-
## Flags legends
138
-
139
-
Flags and emojis legends are documented [here](https://github.com/NodeSecure/flags/blob/main/FLAGS.md).
140
-
141
-
## Search command
142
-
143
-
Press `Cmd+K` (macOS) or `Ctrl+K` (Windows/Linux) from the network view to open the search command. It lets you filter the dependency graph using one or more criteria simultaneously.
144
-
145
-
Type a package name directly to search, or prefix with a filter name followed by `:` to use a specific filter:
146
-
147
-
-`package` — **default when no prefix is given**, matches by name.
148
-
-`version` — semver range (e.g. `>=1.2.0`, `^2.0.0`).
149
-
-`flag` — select from the list of flags present in the current tree.
-`ext` — file extension present in the package (e.g. `.js`, `.ts`).
153
-
-`builtin` — Node.js core module used by the package (e.g. `fs`, `path`).
154
-
-`size` — size range (see [size-satisfies](https://github.com/NodeSecure/size-satisfies#usage-example), e.g. `>50kb`, `10kb..200kb`).
155
-
-`highlighted` — all highlighted packages by default.
156
-
157
-
## FAQ
158
-
159
-
### Why some nodes are red in the UI ?
160
-
Nodes are highlighted in red when the project/package is flagged with 🔬 `hasMinifiedCode` or ⚠️ `hasWarnings`. You can deactivate specific warnings in the options if desired.
161
-
162
-
### Why the package size is so different from Bundlephobia ?
163
-
The back-end scanner will analyze the complete size of the npm tarball without any filters or specific optimizations. In contrast, Bundlephobia will bundle the package and remove most of the unnecessary files from the tarball, such as documentation and other non-essential items.
164
-
165
-
### Why some packages don't have OSSF Scorecard ?
166
-
See [Scorecard Public Data](https://github.com/ossf/scorecard#public-data):
167
-
168
-
> [!NOTE]
169
-
> We run a weekly Scorecard scan of the 1 million most critical open source projects judged by their direct dependencies and publish the results in a BigQuery public dataset.
170
-
171
-
## Contributors guide
172
-
173
-
If you are a developer **looking to contribute** to the project, you must first read the [CONTRIBUTING](./CONTRIBUTING.md) guide.
174
-
175
-
If you have already cloned and installed the project locally with npm, you still need to build and bundle front-end assets using the npm `build` script:
71
+
$ git clone https://github.com/NodeSecure/cli.git
72
+
$ cd cli
176
73
177
-
```bash
74
+
$ npm install
75
+
# bundle/compile front-end assets for every workspace
178
76
$ npm run build
179
77
```
180
78
181
79
> [!IMPORTANT]
182
-
> Restart this command when modifying files in the public root folder
80
+
> Restart `npm run build`when modifying files under a workspace's public/front-end assets folder.
183
81
184
82
Once you have finished your development, check that the tests (and linter) are still good by running the following script:
185
83
@@ -192,7 +90,7 @@ $ npm test
192
90
193
91
### Publishing package and SLSA
194
92
195
-
The package is published on [NPM with provenance](https://docs.npmjs.com/generating-provenance-statements), ensuring that this project is compliant with [SLSA Level 3](https://slsa.dev/spec/v0.1/levels?ref=fossa.com) standards. The build and publication process is managed through the GitHub [npm-provenance.yml](https://github.com/NodeSecure/cli/blob/master/.github/workflows/npm-provenance.yml) workflow, which is automatically triggered upon the creation of a new release.
93
+
The `@nodesecure/cli`package is published on [NPM with provenance](https://docs.npmjs.com/generating-provenance-statements), ensuring that this project is compliant with [SLSA Level 3](https://slsa.dev/spec/v0.1/levels?ref=fossa.com) standards. The build and publication process is managed through the GitHub [npm-provenance.yml](https://github.com/NodeSecure/cli/blob/master/.github/workflows/npm-provenance.yml) workflow, which is automatically triggered upon the creation of a new release.
196
94
197
95
To create a local version of the package using npm and Git, follow these commands:
| server |[@nodesecure/server](./workspaces/server)|
217
-
| cache |[@nodesecure/cache](./workspaces/cache)|
218
-
219
-
These packages are available in the Node Package Repository and can be easily installed with [npm](https://docs.npmjs.com/getting-started/what-is-npm) or [yarn](https://yarnpkg.com).
220
-
```bash
221
-
$ npm i @nodesecure/documentation-ui
222
-
# or
223
-
$ yarn add @nodesecure/documentation-ui
224
-
```
103
+
These commands will increment the package version, commit the changes, and push them along with the tags to the repository.
0 commit comments