@bryan-thompson/inspector-assessment 1.37.0 → 1.38.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/cli/build/lib/assessment-runner/assessment-executor.js +29 -1
- package/cli/build/lib/assessment-runner/source-loader.js +11 -0
- package/cli/package.json +1 -1
- package/client/dist/assets/{OAuthCallback-6-wM7Zc1.js → OAuthCallback-AngeBaCl.js} +1 -1
- package/client/dist/assets/{OAuthDebugCallback-Bw9-AzzP.js → OAuthDebugCallback--FE6_fPs.js} +1 -1
- package/client/dist/assets/{index-DyCdQP10.js → index-BQC95Boo.js} +4 -4
- package/client/dist/index.html +1 -1
- package/client/lib/lib/assessment/coreTypes.d.ts +37 -0
- package/client/lib/lib/assessment/coreTypes.d.ts.map +1 -1
- package/client/lib/lib/assessment/resultTypes.d.ts +26 -1
- package/client/lib/lib/assessment/resultTypes.d.ts.map +1 -1
- package/client/lib/lib/securityPatterns/advancedExploitPatterns.d.ts +13 -0
- package/client/lib/lib/securityPatterns/advancedExploitPatterns.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/advancedExploitPatterns.js +504 -0
- package/client/lib/lib/securityPatterns/authSessionPatterns.d.ts +12 -0
- package/client/lib/lib/securityPatterns/authSessionPatterns.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/authSessionPatterns.js +357 -0
- package/client/lib/lib/securityPatterns/index.d.ts +18 -0
- package/client/lib/lib/securityPatterns/index.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/index.js +18 -0
- package/client/lib/lib/securityPatterns/injectionPatterns.d.ts +13 -0
- package/client/lib/lib/securityPatterns/injectionPatterns.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/injectionPatterns.js +356 -0
- package/client/lib/lib/securityPatterns/resourceExhaustionPatterns.d.ts +12 -0
- package/client/lib/lib/securityPatterns/resourceExhaustionPatterns.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/resourceExhaustionPatterns.js +215 -0
- package/client/lib/lib/securityPatterns/toolSpecificPatterns.d.ts +13 -0
- package/client/lib/lib/securityPatterns/toolSpecificPatterns.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/toolSpecificPatterns.js +373 -0
- package/client/lib/lib/securityPatterns/types.d.ts +20 -0
- package/client/lib/lib/securityPatterns/types.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/types.js +6 -0
- package/client/lib/lib/securityPatterns/utils.d.ts +56 -0
- package/client/lib/lib/securityPatterns/utils.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/utils.js +96 -0
- package/client/lib/lib/securityPatterns/validationPatterns.d.ts +13 -0
- package/client/lib/lib/securityPatterns/validationPatterns.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/validationPatterns.js +110 -0
- package/client/lib/lib/securityPatterns.d.ts +18 -69
- package/client/lib/lib/securityPatterns.d.ts.map +1 -1
- package/client/lib/lib/securityPatterns.js +18 -1946
- package/client/lib/services/assessment/AssessmentOrchestrator.d.ts +4 -1
- package/client/lib/services/assessment/AssessmentOrchestrator.d.ts.map +1 -1
- package/client/lib/services/assessment/helpers/ExternalAPIDependencyDetector.d.ts +96 -5
- package/client/lib/services/assessment/helpers/ExternalAPIDependencyDetector.d.ts.map +1 -1
- package/client/lib/services/assessment/helpers/ExternalAPIDependencyDetector.js +202 -16
- package/client/lib/services/assessment/helpers/StdioTransportDetector.d.ts +137 -0
- package/client/lib/services/assessment/helpers/StdioTransportDetector.d.ts.map +1 -0
- package/client/lib/services/assessment/helpers/StdioTransportDetector.js +315 -0
- package/client/lib/services/assessment/helpers/ToolAnnotationExtractor.d.ts +34 -0
- package/client/lib/services/assessment/helpers/ToolAnnotationExtractor.d.ts.map +1 -0
- package/client/lib/services/assessment/helpers/ToolAnnotationExtractor.js +85 -0
- package/client/lib/services/assessment/modules/ErrorHandlingAssessor.d.ts +17 -0
- package/client/lib/services/assessment/modules/ErrorHandlingAssessor.d.ts.map +1 -1
- package/client/lib/services/assessment/modules/ErrorHandlingAssessor.js +162 -10
- package/client/lib/services/assessment/modules/ProtocolComplianceAssessor.d.ts.map +1 -1
- package/client/lib/services/assessment/modules/ProtocolComplianceAssessor.js +30 -0
- package/client/lib/services/assessment/modules/SecurityAssessor.d.ts.map +1 -1
- package/client/lib/services/assessment/modules/SecurityAssessor.js +6 -0
- package/client/lib/services/assessment/modules/securityTests/AnnotationAwareSeverity.d.ts +55 -0
- package/client/lib/services/assessment/modules/securityTests/AnnotationAwareSeverity.d.ts.map +1 -0
- package/client/lib/services/assessment/modules/securityTests/AnnotationAwareSeverity.js +135 -0
- package/client/lib/services/assessment/modules/securityTests/SafeResponseDetector.d.ts +6 -0
- package/client/lib/services/assessment/modules/securityTests/SafeResponseDetector.d.ts.map +1 -1
- package/client/lib/services/assessment/modules/securityTests/SafeResponseDetector.js +9 -1
- package/client/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.d.ts +20 -0
- package/client/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.d.ts.map +1 -1
- package/client/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.js +37 -0
- package/client/lib/services/assessment/modules/securityTests/SecurityPayloadTester.d.ts +11 -1
- package/client/lib/services/assessment/modules/securityTests/SecurityPayloadTester.d.ts.map +1 -1
- package/client/lib/services/assessment/modules/securityTests/SecurityPayloadTester.js +26 -1
- package/client/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.d.ts +1 -1
- package/client/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.d.ts.map +1 -1
- package/client/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.js +10 -1
- package/client/lib/services/assessment/modules/securityTests/index.d.ts +1 -0
- package/client/lib/services/assessment/modules/securityTests/index.d.ts.map +1 -1
- package/client/lib/services/assessment/modules/securityTests/index.js +1 -0
- package/client/package.json +1 -1
- package/package.json +1 -1
- package/server/package.json +1 -1
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* @public
|
|
6
6
|
* @module AssessmentOrchestrator
|
|
7
7
|
*/
|
|
8
|
-
import { MCPDirectoryAssessment, AssessmentConfiguration, ManifestJsonSchema, ProgressCallback, ServerInfo, PackageJson } from "../../lib/assessmentTypes.js";
|
|
8
|
+
import { MCPDirectoryAssessment, AssessmentConfiguration, ManifestJsonSchema, ProgressCallback, ServerInfo, PackageJson, ToolAnnotationsContext } from "../../lib/assessmentTypes.js";
|
|
9
9
|
import { Tool, CompatibilityCallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
10
10
|
import { ClaudeCodeBridge, ClaudeCodeBridgeConfig } from "./lib/claudeCodeBridge.js";
|
|
11
11
|
import { ExternalAPIDependencyInfo } from "./helpers/ExternalAPIDependencyDetector.js";
|
|
12
|
+
import { TransportDetectionResult } from "./helpers/StdioTransportDetector.js";
|
|
12
13
|
/**
|
|
13
14
|
* MCP Resource interface for assessment context
|
|
14
15
|
* @public
|
|
@@ -98,6 +99,8 @@ export interface AssessmentContext {
|
|
|
98
99
|
};
|
|
99
100
|
listTools?: () => Promise<Tool[]>;
|
|
100
101
|
externalAPIDependencies?: ExternalAPIDependencyInfo;
|
|
102
|
+
transportDetection?: TransportDetectionResult;
|
|
103
|
+
toolAnnotationsContext?: ToolAnnotationsContext;
|
|
101
104
|
}
|
|
102
105
|
/**
|
|
103
106
|
* Main orchestrator class for running MCP server assessments
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssessmentOrchestrator.d.ts","sourceRoot":"","sources":["../../../src/services/assessment/AssessmentOrchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EAEvB,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,WAAW,
|
|
1
|
+
{"version":3,"file":"AssessmentOrchestrator.d.ts","sourceRoot":"","sources":["../../../src/services/assessment/AssessmentOrchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EAEvB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,EAAE,CACR,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,OAAO,CAAC,2BAA2B,CAAC,EACzC,UAAU,CAAC,EAAE,UAAU,EACvB,aAAa,CAAC,EAAE,MAAM,EACtB,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,sBAAsB,CAAC;IAclC,OAAO,CAAC,qBAAqB;IAO7B;;;OAGG;IACH,SAAS,IAAI,uBAAuB;IAIpC;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,uBAAuB,CAAC,GAAG,IAAI;CAG7D"}
|
|
@@ -1,17 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External API Dependency Detector
|
|
3
3
|
*
|
|
4
|
-
* Identifies tools that depend on external APIs based on
|
|
4
|
+
* Identifies tools that depend on external APIs based on:
|
|
5
|
+
* 1. Tool name and description patterns (fast, always available)
|
|
6
|
+
* 2. Source code scanning for API calls (more accurate, when source available)
|
|
7
|
+
*
|
|
5
8
|
* This information enables downstream assessors to adjust their behavior:
|
|
6
9
|
* - TemporalAssessor: Relaxed variance thresholds for external API tools
|
|
7
10
|
* - FunctionalityAssessor: Accept API errors as valid responses
|
|
8
11
|
* - ErrorHandlingAssessor: Account for external service failures
|
|
9
12
|
*
|
|
10
|
-
* Issue #168:
|
|
13
|
+
* Issue #168: Enhanced with source code scanning support
|
|
11
14
|
*
|
|
12
15
|
* @module helpers/ExternalAPIDependencyDetector
|
|
13
16
|
*/
|
|
14
17
|
import { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
18
|
+
/**
|
|
19
|
+
* Implications of external API dependencies for downstream assessors
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export interface ExternalAPIImplications {
|
|
23
|
+
/** Expected temporal variance behavior */
|
|
24
|
+
temporalVariance: string;
|
|
25
|
+
/** Dependency on external service availability */
|
|
26
|
+
availabilityDependency: string;
|
|
27
|
+
/** Potential rate limiting from external services */
|
|
28
|
+
rateLimitingRisk?: string;
|
|
29
|
+
}
|
|
15
30
|
/**
|
|
16
31
|
* External API dependency detection results
|
|
17
32
|
* @public
|
|
@@ -25,6 +40,12 @@ export interface ExternalAPIDependencyInfo {
|
|
|
25
40
|
confidence: "high" | "medium" | "low";
|
|
26
41
|
/** List of detected tool names (for serialization) */
|
|
27
42
|
detectedTools: string[];
|
|
43
|
+
/** Extracted domains from source code scanning (e.g., ["api.worldbank.org"]) */
|
|
44
|
+
domains?: string[];
|
|
45
|
+
/** Whether source code was available and scanned */
|
|
46
|
+
sourceCodeScanned?: boolean;
|
|
47
|
+
/** Implications for downstream assessors when external APIs are detected */
|
|
48
|
+
implications?: ExternalAPIImplications;
|
|
28
49
|
}
|
|
29
50
|
/**
|
|
30
51
|
* Detects external API dependencies in MCP tools based on name and description patterns.
|
|
@@ -46,12 +67,82 @@ export declare class ExternalAPIDependencyDetector {
|
|
|
46
67
|
*/
|
|
47
68
|
private readonly EXTERNAL_API_DESCRIPTION_PATTERNS;
|
|
48
69
|
/**
|
|
49
|
-
*
|
|
70
|
+
* Source code patterns that indicate external API calls.
|
|
71
|
+
* Each pattern captures the URL in group 1.
|
|
72
|
+
*
|
|
73
|
+
* Issue #168: Patterns from proposal for source code scanning
|
|
74
|
+
*/
|
|
75
|
+
private readonly SOURCE_CODE_API_PATTERNS;
|
|
76
|
+
/**
|
|
77
|
+
* URL patterns to skip (localhost, local networks, documentation)
|
|
78
|
+
*/
|
|
79
|
+
private readonly LOCALHOST_PATTERNS;
|
|
80
|
+
/**
|
|
81
|
+
* File patterns to skip during source code scanning
|
|
82
|
+
*/
|
|
83
|
+
private readonly SKIP_FILE_PATTERNS;
|
|
84
|
+
/**
|
|
85
|
+
* Detect external API dependencies from tools and optionally source code.
|
|
86
|
+
*
|
|
87
|
+
* Detection strategy:
|
|
88
|
+
* 1. Always analyze tool names and descriptions (fast, no source needed)
|
|
89
|
+
* 2. If sourceCodeFiles provided, scan for actual API calls (more accurate)
|
|
90
|
+
* 3. Combine results and compute confidence
|
|
50
91
|
*
|
|
51
92
|
* @param tools - List of MCP tools to analyze
|
|
52
|
-
* @
|
|
93
|
+
* @param sourceCodeFiles - Optional map of file paths to content for source scanning
|
|
94
|
+
* @returns Detection results with tool names, domains, and implications
|
|
95
|
+
*/
|
|
96
|
+
detect(tools: Tool[], sourceCodeFiles?: Map<string, string>): ExternalAPIDependencyInfo;
|
|
97
|
+
/** Maximum content length per file (500KB) - prevents ReDoS attacks */
|
|
98
|
+
private readonly MAX_CONTENT_LENGTH;
|
|
99
|
+
/** Maximum matches per file - prevents runaway matching */
|
|
100
|
+
private readonly MAX_MATCHES_PER_FILE;
|
|
101
|
+
/**
|
|
102
|
+
* Scan source code files for external API URLs.
|
|
103
|
+
* Returns unique external domains found in the code.
|
|
104
|
+
*
|
|
105
|
+
* @param sourceCodeFiles - Map of file paths to content
|
|
106
|
+
* @returns Array of unique external domain names
|
|
107
|
+
*/
|
|
108
|
+
scanSourceCode(sourceCodeFiles: Map<string, string>): string[];
|
|
109
|
+
/**
|
|
110
|
+
* Extract the hostname from a URL string.
|
|
111
|
+
*
|
|
112
|
+
* @param url - URL string (may be partial)
|
|
113
|
+
* @returns Hostname or null if extraction fails
|
|
114
|
+
*/
|
|
115
|
+
private extractDomain;
|
|
116
|
+
/**
|
|
117
|
+
* Check if a URL points to localhost or local network.
|
|
118
|
+
*
|
|
119
|
+
* @param url - URL string to check
|
|
120
|
+
* @returns true if URL is local
|
|
121
|
+
*/
|
|
122
|
+
private isLocalhost;
|
|
123
|
+
/**
|
|
124
|
+
* Check if a file should be skipped during source scanning.
|
|
125
|
+
*
|
|
126
|
+
* @param filePath - Path to check
|
|
127
|
+
* @returns true if file should be skipped
|
|
128
|
+
*/
|
|
129
|
+
private shouldSkipFile;
|
|
130
|
+
/**
|
|
131
|
+
* Compute detection confidence based on both methods.
|
|
132
|
+
* Source code confirmation boosts confidence.
|
|
133
|
+
*
|
|
134
|
+
* @param toolCount - Number of tools detected via name/description
|
|
135
|
+
* @param domains - Domains found in source code
|
|
136
|
+
* @returns Confidence level
|
|
137
|
+
*/
|
|
138
|
+
private computeConfidence;
|
|
139
|
+
/**
|
|
140
|
+
* Generate implications for downstream assessors.
|
|
141
|
+
*
|
|
142
|
+
* @param domains - External domains found
|
|
143
|
+
* @returns Implications object
|
|
53
144
|
*/
|
|
54
|
-
|
|
145
|
+
private generateImplications;
|
|
55
146
|
/**
|
|
56
147
|
* Check if a single tool depends on external APIs.
|
|
57
148
|
* Uses BOTH name patterns AND description analysis for detection.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalAPIDependencyDetector.d.ts","sourceRoot":"","sources":["../../../../src/services/assessment/helpers/ExternalAPIDependencyDetector.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ExternalAPIDependencyDetector.d.ts","sourceRoot":"","sources":["../../../../src/services/assessment/helpers/ExternalAPIDependencyDetector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE1D;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,0CAA0C;IAC1C,gBAAgB,EAAE,MAAM,CAAC;IACzB,kDAAkD;IAClD,sBAAsB,EAAE,MAAM,CAAC;IAC/B,qDAAqD;IACrD,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,qDAAqD;IACrD,8BAA8B,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5C,8DAA8D;IAC9D,aAAa,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;IACtC,sDAAsD;IACtD,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,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
|
|
1
1
|
/**
|
|
2
2
|
* External API Dependency Detector
|
|
3
3
|
*
|
|
4
|
-
* Identifies tools that depend on external APIs based on
|
|
4
|
+
* Identifies tools that depend on external APIs based on:
|
|
5
|
+
* 1. Tool name and description patterns (fast, always available)
|
|
6
|
+
* 2. Source code scanning for API calls (more accurate, when source available)
|
|
7
|
+
*
|
|
5
8
|
* This information enables downstream assessors to adjust their behavior:
|
|
6
9
|
* - TemporalAssessor: Relaxed variance thresholds for external API tools
|
|
7
10
|
* - FunctionalityAssessor: Accept API errors as valid responses
|
|
8
11
|
* - ErrorHandlingAssessor: Account for external service failures
|
|
9
12
|
*
|
|
10
|
-
* Issue #168:
|
|
13
|
+
* Issue #168: Enhanced with source code scanning support
|
|
11
14
|
*
|
|
12
15
|
* @module helpers/ExternalAPIDependencyDetector
|
|
13
16
|
*/
|
|
@@ -62,12 +65,72 @@ export class ExternalAPIDependencyDetector {
|
|
|
62
65
|
/third[- ]?party\s*(api|service)/i,
|
|
63
66
|
];
|
|
64
67
|
/**
|
|
65
|
-
*
|
|
68
|
+
* Source code patterns that indicate external API calls.
|
|
69
|
+
* Each pattern captures the URL in group 1.
|
|
70
|
+
*
|
|
71
|
+
* Issue #168: Patterns from proposal for source code scanning
|
|
72
|
+
*/
|
|
73
|
+
SOURCE_CODE_API_PATTERNS = [
|
|
74
|
+
// fetch() calls - JavaScript/TypeScript
|
|
75
|
+
/fetch\s*\(\s*['"`](https?:\/\/[^'"`\s]+)/gi,
|
|
76
|
+
// axios HTTP client calls
|
|
77
|
+
/axios\s*\.\s*(?:get|post|put|patch|delete|request)\s*\(\s*['"`](https?:\/\/[^'"`\s]+)/gi,
|
|
78
|
+
// URL construction
|
|
79
|
+
/new\s+URL\s*\(\s*['"`](https?:\/\/[^'"`\s]+)/gi,
|
|
80
|
+
// Common API base URL constants
|
|
81
|
+
/(?:API_BASE_URL|BASE_URL|API_URL|ENDPOINT)\s*=\s*['"`](https?:\/\/[^'"`\s]+)/gi,
|
|
82
|
+
// Generic HTTP client .get/.post calls
|
|
83
|
+
/\.\s*(?:get|post)\s*\(\s*['"`](https?:\/\/[^'"`\s]+)/gi,
|
|
84
|
+
// Python requests library
|
|
85
|
+
/requests\s*\.\s*(?:get|post|put|patch|delete)\s*\(\s*['"`](https?:\/\/[^'"`\s]+)/gi,
|
|
86
|
+
// Python httpx library
|
|
87
|
+
/httpx\s*\.\s*(?:get|post|put|patch|delete)\s*\(\s*['"`](https?:\/\/[^'"`\s]+)/gi,
|
|
88
|
+
];
|
|
89
|
+
/**
|
|
90
|
+
* URL patterns to skip (localhost, local networks, documentation)
|
|
91
|
+
*/
|
|
92
|
+
LOCALHOST_PATTERNS = [
|
|
93
|
+
/localhost/i,
|
|
94
|
+
/127\.0\.0\.1/,
|
|
95
|
+
/0\.0\.0\.0/,
|
|
96
|
+
/192\.168\./,
|
|
97
|
+
/10\.\d+\./,
|
|
98
|
+
/172\.(?:1[6-9]|2[0-9]|3[01])\./,
|
|
99
|
+
/\.local\b/i,
|
|
100
|
+
/example\.com/i,
|
|
101
|
+
/test\.com/i,
|
|
102
|
+
];
|
|
103
|
+
/**
|
|
104
|
+
* File patterns to skip during source code scanning
|
|
105
|
+
*/
|
|
106
|
+
SKIP_FILE_PATTERNS = [
|
|
107
|
+
/node_modules/i,
|
|
108
|
+
/\.test\.(ts|js|tsx|jsx)$/i,
|
|
109
|
+
/\.spec\.(ts|js|tsx|jsx)$/i,
|
|
110
|
+
/\.d\.ts$/i,
|
|
111
|
+
/package-lock\.json$/i,
|
|
112
|
+
/yarn\.lock$/i,
|
|
113
|
+
/\.map$/i,
|
|
114
|
+
/\.git\//i,
|
|
115
|
+
/dist\//i,
|
|
116
|
+
/build\//i,
|
|
117
|
+
/__tests__\//i,
|
|
118
|
+
/__mocks__\//i,
|
|
119
|
+
];
|
|
120
|
+
/**
|
|
121
|
+
* Detect external API dependencies from tools and optionally source code.
|
|
122
|
+
*
|
|
123
|
+
* Detection strategy:
|
|
124
|
+
* 1. Always analyze tool names and descriptions (fast, no source needed)
|
|
125
|
+
* 2. If sourceCodeFiles provided, scan for actual API calls (more accurate)
|
|
126
|
+
* 3. Combine results and compute confidence
|
|
66
127
|
*
|
|
67
128
|
* @param tools - List of MCP tools to analyze
|
|
68
|
-
* @
|
|
129
|
+
* @param sourceCodeFiles - Optional map of file paths to content for source scanning
|
|
130
|
+
* @returns Detection results with tool names, domains, and implications
|
|
69
131
|
*/
|
|
70
|
-
detect(tools) {
|
|
132
|
+
detect(tools, sourceCodeFiles) {
|
|
133
|
+
// Phase 1: Name/description pattern matching (always runs)
|
|
71
134
|
const toolsWithExternalAPI = new Set();
|
|
72
135
|
for (const tool of tools) {
|
|
73
136
|
if (this.isExternalAPITool(tool)) {
|
|
@@ -75,23 +138,146 @@ export class ExternalAPIDependencyDetector {
|
|
|
75
138
|
}
|
|
76
139
|
}
|
|
77
140
|
const detectedCount = toolsWithExternalAPI.size;
|
|
78
|
-
//
|
|
79
|
-
|
|
80
|
-
let
|
|
81
|
-
if (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
else if (detectedCount >= 3) {
|
|
85
|
-
confidence = "high";
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
confidence = "medium";
|
|
141
|
+
// Phase 2: Source code scanning (when available)
|
|
142
|
+
let domains;
|
|
143
|
+
let sourceCodeScanned = false;
|
|
144
|
+
if (sourceCodeFiles && sourceCodeFiles.size > 0) {
|
|
145
|
+
sourceCodeScanned = true;
|
|
146
|
+
domains = this.scanSourceCode(sourceCodeFiles);
|
|
89
147
|
}
|
|
148
|
+
// Compute confidence based on both detection methods
|
|
149
|
+
const confidence = this.computeConfidence(detectedCount, domains);
|
|
150
|
+
// Generate implications if any external APIs were detected
|
|
151
|
+
const hasExternalDependencies = detectedCount > 0 || (domains && domains.length > 0);
|
|
152
|
+
const implications = hasExternalDependencies
|
|
153
|
+
? this.generateImplications(domains)
|
|
154
|
+
: undefined;
|
|
90
155
|
return {
|
|
91
156
|
toolsWithExternalAPIDependency: toolsWithExternalAPI,
|
|
92
157
|
detectedCount,
|
|
93
158
|
confidence,
|
|
94
159
|
detectedTools: Array.from(toolsWithExternalAPI),
|
|
160
|
+
domains,
|
|
161
|
+
sourceCodeScanned,
|
|
162
|
+
implications,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
/** Maximum content length per file (500KB) - prevents ReDoS attacks */
|
|
166
|
+
MAX_CONTENT_LENGTH = 500_000;
|
|
167
|
+
/** Maximum matches per file - prevents runaway matching */
|
|
168
|
+
MAX_MATCHES_PER_FILE = 100;
|
|
169
|
+
/**
|
|
170
|
+
* Scan source code files for external API URLs.
|
|
171
|
+
* Returns unique external domains found in the code.
|
|
172
|
+
*
|
|
173
|
+
* @param sourceCodeFiles - Map of file paths to content
|
|
174
|
+
* @returns Array of unique external domain names
|
|
175
|
+
*/
|
|
176
|
+
scanSourceCode(sourceCodeFiles) {
|
|
177
|
+
const domains = new Set();
|
|
178
|
+
sourceCodeFiles.forEach((content, filePath) => {
|
|
179
|
+
// Skip test files, node_modules, etc.
|
|
180
|
+
if (this.shouldSkipFile(filePath))
|
|
181
|
+
return;
|
|
182
|
+
// Skip oversized files to prevent ReDoS
|
|
183
|
+
if (content.length > this.MAX_CONTENT_LENGTH)
|
|
184
|
+
return;
|
|
185
|
+
// Try each API call pattern using matchAll (thread-safe, no lastIndex issues)
|
|
186
|
+
for (const pattern of this.SOURCE_CODE_API_PATTERNS) {
|
|
187
|
+
// Use Array.from for compatibility with older TS targets
|
|
188
|
+
const matches = Array.from(content.matchAll(pattern));
|
|
189
|
+
let matchCount = 0;
|
|
190
|
+
for (const match of matches) {
|
|
191
|
+
if (matchCount >= this.MAX_MATCHES_PER_FILE)
|
|
192
|
+
break;
|
|
193
|
+
matchCount++;
|
|
194
|
+
const url = match[1];
|
|
195
|
+
// Skip localhost and local network URLs
|
|
196
|
+
if (this.isLocalhost(url))
|
|
197
|
+
continue;
|
|
198
|
+
// Extract domain from URL
|
|
199
|
+
const domain = this.extractDomain(url);
|
|
200
|
+
if (domain) {
|
|
201
|
+
domains.add(domain);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
return Array.from(domains);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Extract the hostname from a URL string.
|
|
210
|
+
*
|
|
211
|
+
* @param url - URL string (may be partial)
|
|
212
|
+
* @returns Hostname or null if extraction fails
|
|
213
|
+
*/
|
|
214
|
+
extractDomain(url) {
|
|
215
|
+
try {
|
|
216
|
+
// Handle URLs that may not have protocol
|
|
217
|
+
const fullUrl = url.startsWith("http") ? url : `https://${url}`;
|
|
218
|
+
return new URL(fullUrl).hostname;
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Check if a URL points to localhost or local network.
|
|
226
|
+
*
|
|
227
|
+
* @param url - URL string to check
|
|
228
|
+
* @returns true if URL is local
|
|
229
|
+
*/
|
|
230
|
+
isLocalhost(url) {
|
|
231
|
+
return this.LOCALHOST_PATTERNS.some((pattern) => pattern.test(url));
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Check if a file should be skipped during source scanning.
|
|
235
|
+
*
|
|
236
|
+
* @param filePath - Path to check
|
|
237
|
+
* @returns true if file should be skipped
|
|
238
|
+
*/
|
|
239
|
+
shouldSkipFile(filePath) {
|
|
240
|
+
return this.SKIP_FILE_PATTERNS.some((pattern) => pattern.test(filePath));
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Compute detection confidence based on both methods.
|
|
244
|
+
* Source code confirmation boosts confidence.
|
|
245
|
+
*
|
|
246
|
+
* @param toolCount - Number of tools detected via name/description
|
|
247
|
+
* @param domains - Domains found in source code
|
|
248
|
+
* @returns Confidence level
|
|
249
|
+
*/
|
|
250
|
+
computeConfidence(toolCount, domains) {
|
|
251
|
+
const domainCount = domains?.length ?? 0;
|
|
252
|
+
// Both methods agree = high confidence
|
|
253
|
+
if (toolCount > 0 && domainCount > 0) {
|
|
254
|
+
return "high";
|
|
255
|
+
}
|
|
256
|
+
// Either method found multiple = high confidence
|
|
257
|
+
if (toolCount >= 3 || domainCount >= 3) {
|
|
258
|
+
return "high";
|
|
259
|
+
}
|
|
260
|
+
// Either method found something = medium confidence
|
|
261
|
+
if (toolCount > 0 || domainCount > 0) {
|
|
262
|
+
return "medium";
|
|
263
|
+
}
|
|
264
|
+
// Nothing found = low confidence (no external APIs)
|
|
265
|
+
return "low";
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Generate implications for downstream assessors.
|
|
269
|
+
*
|
|
270
|
+
* @param domains - External domains found
|
|
271
|
+
* @returns Implications object
|
|
272
|
+
*/
|
|
273
|
+
generateImplications(domains) {
|
|
274
|
+
const domainList = domains && domains.length > 0 ? domains.join(", ") : "external services";
|
|
275
|
+
return {
|
|
276
|
+
temporalVariance: "Expected - external data changes between invocations",
|
|
277
|
+
availabilityDependency: `Server depends on ${domainList} uptime`,
|
|
278
|
+
rateLimitingRisk: domains && domains.length > 0
|
|
279
|
+
? `May encounter rate limits from ${domainList}`
|
|
280
|
+
: undefined,
|
|
95
281
|
};
|
|
96
282
|
}
|
|
97
283
|
/**
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stdio Transport Detector
|
|
3
|
+
*
|
|
4
|
+
* Identifies stdio transport support from multiple sources:
|
|
5
|
+
* 1. server.json manifest (packages[0].transport.type)
|
|
6
|
+
* 2. package.json bin entries (indicates CLI/stdio)
|
|
7
|
+
* 3. Source code scanning for transport patterns
|
|
8
|
+
* 4. Runtime transport configuration
|
|
9
|
+
*
|
|
10
|
+
* This fixes Issue #172: C6/F6 incorrectly fails for valid stdio servers
|
|
11
|
+
* because transport detection previously relied solely on serverInfo metadata.
|
|
12
|
+
*
|
|
13
|
+
* @module helpers/StdioTransportDetector
|
|
14
|
+
*/
|
|
15
|
+
import type { TransportMode } from "../config/architecturePatterns.js";
|
|
16
|
+
/**
|
|
17
|
+
* Evidence source for transport detection
|
|
18
|
+
*/
|
|
19
|
+
export type TransportEvidenceSource = "server.json" | "package.json" | "source-code" | "runtime-config";
|
|
20
|
+
/**
|
|
21
|
+
* Individual piece of transport detection evidence
|
|
22
|
+
*/
|
|
23
|
+
export interface TransportEvidence {
|
|
24
|
+
/** Source of the evidence */
|
|
25
|
+
source: TransportEvidenceSource;
|
|
26
|
+
/** Transport type detected */
|
|
27
|
+
transport: TransportMode;
|
|
28
|
+
/** Confidence level for this evidence */
|
|
29
|
+
confidence: "high" | "medium" | "low";
|
|
30
|
+
/** Human-readable detail about the detection */
|
|
31
|
+
detail: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Transport detection results
|
|
35
|
+
*/
|
|
36
|
+
export interface TransportDetectionResult {
|
|
37
|
+
/** Set of detected transport modes */
|
|
38
|
+
detectedTransports: Set<TransportMode>;
|
|
39
|
+
/** Overall detection confidence */
|
|
40
|
+
confidence: "high" | "medium" | "low";
|
|
41
|
+
/** All evidence collected during detection */
|
|
42
|
+
evidence: TransportEvidence[];
|
|
43
|
+
/** Whether stdio transport is supported */
|
|
44
|
+
supportsStdio: boolean;
|
|
45
|
+
/** Whether HTTP transport is supported */
|
|
46
|
+
supportsHTTP: boolean;
|
|
47
|
+
/** Whether SSE transport is supported */
|
|
48
|
+
supportsSSE: boolean;
|
|
49
|
+
/** Whether source code was scanned */
|
|
50
|
+
sourceCodeScanned: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* server.json structure (partial - transport fields only)
|
|
54
|
+
*/
|
|
55
|
+
export interface ServerJsonTransport {
|
|
56
|
+
packages?: Array<{
|
|
57
|
+
transport?: {
|
|
58
|
+
type?: string;
|
|
59
|
+
};
|
|
60
|
+
}>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* package.json structure (partial - bin field only)
|
|
64
|
+
*/
|
|
65
|
+
export interface PackageJsonBin {
|
|
66
|
+
bin?: Record<string, string> | string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Detects transport capabilities from multiple sources.
|
|
70
|
+
*
|
|
71
|
+
* Detection priority (highest confidence first):
|
|
72
|
+
* 1. Runtime transport configuration (actual runtime proof)
|
|
73
|
+
* 2. server.json transport declaration (explicit manifest)
|
|
74
|
+
* 3. package.json bin entries (strong CLI/stdio indicator)
|
|
75
|
+
* 4. Source code patterns (StdioServerTransport, mcp.run, etc.)
|
|
76
|
+
*
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
export declare class StdioTransportDetector {
|
|
80
|
+
/**
|
|
81
|
+
* TypeScript/JavaScript patterns for stdio transport
|
|
82
|
+
*/
|
|
83
|
+
private readonly STDIO_CODE_PATTERNS;
|
|
84
|
+
/**
|
|
85
|
+
* Python/FastMCP patterns for stdio transport
|
|
86
|
+
*/
|
|
87
|
+
private readonly PYTHON_STDIO_PATTERNS;
|
|
88
|
+
/**
|
|
89
|
+
* HTTP/SSE transport patterns
|
|
90
|
+
*/
|
|
91
|
+
private readonly HTTP_CODE_PATTERNS;
|
|
92
|
+
/**
|
|
93
|
+
* File patterns to skip during source code scanning
|
|
94
|
+
*/
|
|
95
|
+
private readonly SKIP_FILE_PATTERNS;
|
|
96
|
+
/** Maximum file size for source scanning (500KB) */
|
|
97
|
+
private readonly MAX_FILE_SIZE;
|
|
98
|
+
/**
|
|
99
|
+
* Detect transport capabilities from all available sources.
|
|
100
|
+
*
|
|
101
|
+
* @param sourceCodeFiles - Map of file paths to content
|
|
102
|
+
* @param packageJson - Parsed package.json content
|
|
103
|
+
* @param serverJson - Parsed server.json content
|
|
104
|
+
* @param runtimeTransport - Transport type from runtime config
|
|
105
|
+
* @returns Transport detection results
|
|
106
|
+
*/
|
|
107
|
+
detect(sourceCodeFiles?: Map<string, string>, packageJson?: PackageJsonBin, serverJson?: ServerJsonTransport, runtimeTransport?: TransportMode): TransportDetectionResult;
|
|
108
|
+
/**
|
|
109
|
+
* Scan source code files for transport patterns.
|
|
110
|
+
*
|
|
111
|
+
* @param sourceCodeFiles - Map of file paths to content
|
|
112
|
+
* @returns Array of evidence from source code analysis
|
|
113
|
+
*/
|
|
114
|
+
private scanSourceCode;
|
|
115
|
+
/**
|
|
116
|
+
* Check if a transport type is valid.
|
|
117
|
+
*/
|
|
118
|
+
private isValidTransport;
|
|
119
|
+
/**
|
|
120
|
+
* Check if a file should be skipped during scanning.
|
|
121
|
+
*/
|
|
122
|
+
private shouldSkipFile;
|
|
123
|
+
/**
|
|
124
|
+
* Shorten file path for display.
|
|
125
|
+
*/
|
|
126
|
+
private shortenPath;
|
|
127
|
+
/**
|
|
128
|
+
* Compute overall confidence from collected evidence.
|
|
129
|
+
*
|
|
130
|
+
* Confidence rules:
|
|
131
|
+
* - High: Any high-confidence evidence present
|
|
132
|
+
* - Medium: Only medium-confidence evidence OR multiple sources agree
|
|
133
|
+
* - Low: No evidence or only weak patterns
|
|
134
|
+
*/
|
|
135
|
+
private computeConfidence;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=StdioTransportDetector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StdioTransportDetector.d.ts","sourceRoot":"","sources":["../../../../src/services/assessment/helpers/StdioTransportDetector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEvE;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAC/B,aAAa,GACb,cAAc,GACd,aAAa,GACb,gBAAgB,CAAC;AAErB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,6BAA6B;IAC7B,MAAM,EAAE,uBAAuB,CAAC;IAChC,8BAA8B;IAC9B,SAAS,EAAE,aAAa,CAAC;IACzB,yCAAyC;IACzC,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,KAA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