mpx-scan 1.0.0 → 1.0.2
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/bin/cli.js +17 -5
- package/package.json +11 -4
- package/src/scanners/headers.js +1 -1
package/bin/cli.js
CHANGED
|
@@ -36,6 +36,8 @@ program
|
|
|
36
36
|
.option('--brief', 'Brief output (one-line summary)')
|
|
37
37
|
.option('--fix <platform>', `Generate fix config for platform (${PLATFORMS.join(', ')})`)
|
|
38
38
|
.option('--timeout <seconds>', 'Connection timeout', '10')
|
|
39
|
+
.option('--ci', 'CI/CD mode: exit 1 if score below threshold')
|
|
40
|
+
.option('--min-score <score>', 'Minimum score for CI mode (default: 70)', '70')
|
|
39
41
|
.action(async (url, options) => {
|
|
40
42
|
// Show help if no URL provided
|
|
41
43
|
if (!url) {
|
|
@@ -103,11 +105,21 @@ program
|
|
|
103
105
|
console.log(formatReport(results, options));
|
|
104
106
|
}
|
|
105
107
|
|
|
106
|
-
// Exit code
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
// Exit code logic:
|
|
109
|
+
// - Exit 0: scan completed successfully (default)
|
|
110
|
+
// - Exit 1: only in --ci mode if score below threshold
|
|
111
|
+
if (options.ci) {
|
|
112
|
+
const minScore = parseInt(options.minScore);
|
|
113
|
+
const percentage = Math.round((results.score / results.maxScore) * 100);
|
|
114
|
+
if (percentage < minScore) {
|
|
115
|
+
if (!options.json && !options.brief) {
|
|
116
|
+
console.error(chalk.yellow(`\n⚠️ CI mode: Score ${percentage}/100 below minimum ${minScore}`));
|
|
117
|
+
}
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
process.exit(0);
|
|
111
123
|
|
|
112
124
|
} catch (err) {
|
|
113
125
|
if (options.json) {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mpx-scan",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Professional website security scanner CLI. Check headers, SSL, cookies, DNS, and get actionable fix suggestions. Part of the Mesaplex developer toolchain.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"mpx-scan": "
|
|
7
|
+
"mpx-scan": "bin/cli.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "node test/run.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"license": "SEE LICENSE IN LICENSE",
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|
|
34
|
-
"url": "https://github.com/mesaplexdev/mpx-scan"
|
|
34
|
+
"url": "git+https://github.com/mesaplexdev/mpx-scan.git"
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/mesaplexdev/mpx-scan#readme",
|
|
37
37
|
"bugs": "https://github.com/mesaplexdev/mpx-scan/issues",
|
|
@@ -41,5 +41,12 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"chalk": "^4.1.2",
|
|
43
43
|
"commander": "^12.0.0"
|
|
44
|
-
}
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"src/",
|
|
47
|
+
"bin/",
|
|
48
|
+
"README.md",
|
|
49
|
+
"LICENSE",
|
|
50
|
+
"package.json"
|
|
51
|
+
]
|
|
45
52
|
}
|
package/src/scanners/headers.js
CHANGED
|
@@ -176,7 +176,7 @@ function fetchHeaders(parsedUrl, options = {}) {
|
|
|
176
176
|
method: 'HEAD',
|
|
177
177
|
timeout,
|
|
178
178
|
headers: {
|
|
179
|
-
'User-Agent': '
|
|
179
|
+
'User-Agent': 'mpx-scan/1.0.1 Security Scanner (https://github.com/mesaplexdev/mpx-scan)'
|
|
180
180
|
},
|
|
181
181
|
rejectUnauthorized: false // We check SSL separately
|
|
182
182
|
}, (res) => {
|