mcpsec 0.2.0 → 0.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcpsec",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Security scanner for MCP (Model Context Protocol) servers - detects tool poisoning, credential exposure, prompt injection, and SSRF",
5
5
  "license": "MIT",
6
6
  "author": "Rob Taylor <robdtaylor@users.noreply.github.com>",
@@ -193,9 +193,25 @@ export function scanConfigs(configs: MCPConfigFile[]): Finding[] {
193
193
  // Check for stdio transport with absolute paths to unknown binaries
194
194
  if (server.command) {
195
195
  // npx/bunx with unknown packages
196
- if (/^(npx|bunx|pnpx)\s/.test(server.command)) {
197
- const pkg = server.command.split(/\s+/)[1];
196
+ // Handle both formats:
197
+ // "command": "npx -y some-pkg" (inline)
198
+ // "command": "npx", "args": ["-y", "some-pkg"] (split)
199
+ const cmdBase = server.command.split(/\s+/)[0];
200
+ if (/^(npx|bunx|pnpx)$/.test(cmdBase)) {
201
+ // Extract package name from inline command or args array
202
+ let pkg: string | undefined;
203
+ const inlineParts = server.command.split(/\s+/).slice(1);
204
+ const allArgs = [...inlineParts, ...(server.args || [])];
205
+ // Find the first arg that isn't a flag (skip -y, --yes, etc.)
206
+ for (const arg of allArgs) {
207
+ if (!arg.startsWith('-')) {
208
+ pkg = arg;
209
+ break;
210
+ }
211
+ }
212
+
198
213
  if (pkg && !pkg.startsWith('@anthropic') && !pkg.startsWith('@modelcontextprotocol')) {
214
+ const fullCommand = [server.command, ...(server.args || [])].join(' ');
199
215
  findings.push({
200
216
  id: `CFG-${++findingId}`,
201
217
  severity: 'medium',
@@ -204,7 +220,7 @@ export function scanConfigs(configs: MCPConfigFile[]): Finding[] {
204
220
  description: `Server "${serverName}" uses npx/bunx to run "${pkg}". This package is downloaded and executed at runtime without integrity verification.`,
205
221
  server: serverName,
206
222
  configFile: config.path,
207
- evidence: `command: ${server.command}`,
223
+ evidence: `command: ${fullCommand}`,
208
224
  remediation: 'Pin the package version and verify its integrity. Consider installing locally instead of using npx.',
209
225
  });
210
226
  }