Skip to content

Commit a965a77

Browse files
committed
add README and tests
1 parent 287e107 commit a965a77

File tree

7 files changed

+5023
-3
lines changed

7 files changed

+5023
-3
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Kyle Martin
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
2+
<h1 align="center">
3+
<br>
4+
npm-viewscripts
5+
<br>
6+
</h1>
7+
8+
<h4 align="center">Identify potentially malicious npm scripts in a project.</h4>
9+
<p align="center">
10+
<img alt="GitHub" src="https://img.shields.io/github/license/js-kyle/npm-viewscripts.svg">
11+
<img alt="NPM" src="https://img.shields.io/npm/v/npm-viewscripts.svg">
12+
</p>
13+
14+
15+
## Overview
16+
17+
This project is a Node.js CLI tool to identify which of a project's existing dependencies are utilising npm lifecycle scripts, which _could_ be malicious.
18+
19+
The currently configured npm scripts the tool will identify are:
20+
`preinstall`, `postintall`, `preuninstall`, `postuninstall`
21+
22+
**Note: This project is to educate, so should not be used as a complete npm security solution.**
23+
24+
## Installation
25+
26+
```
27+
# install globally, using npm
28+
$ npm install npm-viewscripts -g
29+
30+
# Run the cli on a project
31+
$ cd my-node-project
32+
$ npm install
33+
$ npm-viewscripts
34+
```
35+
36+
## Usage
37+
38+
```
39+
$ npm-viewscripts
40+
41+
Usage
42+
$ npm-viewscripts [path]
43+
44+
Options
45+
path Modules folder [Default: node_modules]
46+
```
47+
48+
## Understanding the result
49+
Positive report example:
50+
```
51+
Potentially unsafe scripts found. These should be reviewed for safety
52+
Module name: monorepo-symlink-test Type: postinstall
53+
```
54+
The above output informs us that the `monorepo-symlink-test` is running a `postinstall` script, so we should review that, and ensure that it is safe.
55+
56+
Negative report example:
57+
```
58+
No potentially unsafe scripts found.
59+
```
60+
No modules in the project are _currently_ using scripts which could be used maliciously.
61+
62+

0 commit comments

Comments
 (0)