@mayhemx87/mcpscan 0.4.0 → 0.5.0
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/README.md +2 -1
- package/dist/engine.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -91,7 +91,7 @@ the exact line of the offending server definition.
|
|
|
91
91
|
# .pre-commit-config.yaml
|
|
92
92
|
repos:
|
|
93
93
|
- repo: https://github.com/mayhemx87/mcpscan
|
|
94
|
-
rev: v0.
|
|
94
|
+
rev: v0.5.0
|
|
95
95
|
hooks:
|
|
96
96
|
- id: mcpscan
|
|
97
97
|
```
|
|
@@ -119,6 +119,7 @@ Dedicated MCP config files and editor settings files that embed MCP servers:
|
|
|
119
119
|
| `.claude/settings.json`, `.claude/settings.local.json` | Claude Code |
|
|
120
120
|
| `.gemini/settings.json` | Gemini CLI |
|
|
121
121
|
| `.zed/settings.json` (`context_servers`) | Zed |
|
|
122
|
+
| `.junie/mcp/mcp.json` | Junie |
|
|
122
123
|
|
|
123
124
|
Both `mcpServers` and VS Code's `servers` keys are understood, as is Zed's
|
|
124
125
|
`context_servers` key; `command` and `args` are analyzed together, including
|
package/dist/engine.js
CHANGED
|
@@ -53,6 +53,8 @@ function looksLikeLiteralSecret(value) {
|
|
|
53
53
|
return false;
|
|
54
54
|
return SECRET_VALUE_PATTERNS.some(p => p.test(value));
|
|
55
55
|
}
|
|
56
|
+
const REPO_ESCAPE_PATH = /^(?:\/|[A-Za-z]:[\\/]|\\\\|\.\.[\\/])/;
|
|
57
|
+
const PATH_TRAVERSAL_IN_LINE = /(?:^|[\s;|&])\.\.[\\/]/;
|
|
56
58
|
/**
|
|
57
59
|
* Returns true if the command line contains npx/uvx/pipx with an unversioned
|
|
58
60
|
* package (handles compound commands like cmd1 && npx pkg). Runner flags
|
|
@@ -216,10 +218,8 @@ export function analyzeConfig(filePath, content, isGitTracked) {
|
|
|
216
218
|
}
|
|
217
219
|
}
|
|
218
220
|
// MCP-004: absolute path or path traversal outside repo
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
args.some(a => a.startsWith('/')) ||
|
|
222
|
-
/(?:^|[\s;|&])\.\.\//.test(line)) {
|
|
221
|
+
if ([command, ...args].some(value => REPO_ESCAPE_PATH.test(value.trimStart())) ||
|
|
222
|
+
PATH_TRAVERSAL_IN_LINE.test(line)) {
|
|
223
223
|
serverFindings.push({
|
|
224
224
|
file: filePath,
|
|
225
225
|
rule_id: 'MCP-004',
|