npm-scan-plus 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Chris Bunting
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.
package/README.md CHANGED
@@ -158,3 +158,7 @@ npm run lint
158
158
  ## License
159
159
 
160
160
  MIT
161
+
162
+ ---
163
+
164
+ Developed by [Chris Bunting](https://github.com/cbuntingde) <cbuntingde@gmail.com>
package/bin/npm-scan-wrap CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * npm-scan wrapper - Automatically scans before and after npm install
5
- * Usage: npm-scan-wrap install <packages>
6
- * npm-scan-wrap install
4
+ * npm-scan-plus wrapper - Automatically scans before and after npm install
5
+ * Usage: npm-scan-plus-wrap install <packages>
6
+ * npm-scan-plus-wrap install
7
7
  */
8
8
 
9
9
  const { spawn } = require('child_process');
@@ -14,9 +14,16 @@ const SCANNER_PATH = path.join(__dirname, '../dist/cli/index.js');
14
14
 
15
15
  async function runScanner(args) {
16
16
  return new Promise((resolve, reject) => {
17
- const scanner = spawn('node', [SCANNER_PATH, ...args], {
18
- stdio: 'inherit',
19
- shell: true
17
+ // Properly quote arguments to prevent injection
18
+ const safeArgs = args.map(arg => {
19
+ if (arg.includes(' ') || arg.includes('"') || arg.includes("'")) {
20
+ return `"${arg.replace(/"/g, '\\"')}"`;
21
+ }
22
+ return arg;
23
+ });
24
+
25
+ const scanner = spawn('node', [SCANNER_PATH, ...safeArgs], {
26
+ stdio: 'inherit'
20
27
  });
21
28
 
22
29
  scanner.on('close', (code) => {
@@ -28,10 +35,11 @@ async function runScanner(args) {
28
35
 
29
36
  async function runNpm(args) {
30
37
  return new Promise((resolve, reject) => {
31
- const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
32
- const install = spawn(npm, args, {
38
+ // Use npm.cmd on Windows, avoid shell: true
39
+ const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
40
+
41
+ const install = spawn(npmCmd, args, {
33
42
  stdio: 'inherit',
34
- shell: true,
35
43
  env: { ...process.env, NPM_CONFIG_AUDIT: 'false' }
36
44
  });
37
45
 
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "npm-scan-plus",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Security scanner for npm packages - pre and post-install scanning for malicious code, supply chain attacks, and obfuscated code",
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.ts",
7
7
  "bin": {
8
- "npm-scan": "./bin/npm-scan.js",
9
- "npm-scan-wrap": "./bin/npm-scan-wrap"
8
+ "npm-scan-plus": "./bin/npm-scan.js",
9
+ "npm-scan-plus-wrap": "./bin/npm-scan-wrap"
10
10
  },
11
11
  "scripts": {
12
12
  "build": "tsc",