@bryan-thompson/inspector-assessment-client 1.26.4 → 1.26.6
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/dist/assets/{OAuthCallback-DRmaIku9.js → OAuthCallback-CCWVtjr7.js} +1 -1
- package/dist/assets/{OAuthDebugCallback-BU8UZdx8.js → OAuthDebugCallback-DqbXfUi4.js} +1 -1
- package/dist/assets/{index-Dd4pL57l.js → index-CsDJSSWq.js} +4 -4
- package/dist/index.html +1 -1
- package/lib/lib/securityPatterns.d.ts.map +1 -1
- package/lib/lib/securityPatterns.js +26 -0
- package/lib/services/assessment/modules/securityTests/ConfidenceScorer.d.ts +57 -0
- package/lib/services/assessment/modules/securityTests/ConfidenceScorer.d.ts.map +1 -0
- package/lib/services/assessment/modules/securityTests/ConfidenceScorer.js +199 -0
- package/lib/services/assessment/modules/securityTests/ErrorClassifier.d.ts +57 -0
- package/lib/services/assessment/modules/securityTests/ErrorClassifier.d.ts.map +1 -0
- package/lib/services/assessment/modules/securityTests/ErrorClassifier.js +113 -0
- package/lib/services/assessment/modules/securityTests/ExecutionArtifactDetector.d.ts +49 -0
- package/lib/services/assessment/modules/securityTests/ExecutionArtifactDetector.d.ts.map +1 -0
- package/lib/services/assessment/modules/securityTests/ExecutionArtifactDetector.js +74 -0
- package/lib/services/assessment/modules/securityTests/MathAnalyzer.d.ts +58 -0
- package/lib/services/assessment/modules/securityTests/MathAnalyzer.d.ts.map +1 -0
- package/lib/services/assessment/modules/securityTests/MathAnalyzer.js +251 -0
- package/lib/services/assessment/modules/securityTests/SafeResponseDetector.d.ts +59 -0
- package/lib/services/assessment/modules/securityTests/SafeResponseDetector.d.ts.map +1 -0
- package/lib/services/assessment/modules/securityTests/SafeResponseDetector.js +151 -0
- package/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.d.ts +229 -0
- package/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.d.ts.map +1 -0
- package/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.js +566 -0
- package/lib/services/assessment/modules/securityTests/SecurityPayloadGenerator.d.ts.map +1 -1
- package/lib/services/assessment/modules/securityTests/SecurityPayloadGenerator.js +49 -1
- package/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.d.ts +63 -85
- package/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.d.ts.map +1 -1
- package/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.js +270 -1159
- package/package.json +1 -1
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Security Response Analyzer
|
|
2
|
+
* Security Response Analyzer (Facade)
|
|
3
3
|
* Analyzes tool responses for evidence-based vulnerability detection
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* REFACTORED in Issue #53 (v2.0.0): Converted to facade pattern
|
|
6
|
+
* Delegates to focused classes for maintainability (CC 218 → ~50)
|
|
7
|
+
*
|
|
8
|
+
* Extracted classes:
|
|
9
|
+
* - ErrorClassifier: Error classification and connection error detection
|
|
10
|
+
* - ExecutionArtifactDetector: Execution evidence detection
|
|
11
|
+
* - MathAnalyzer: Math computation detection (Calculator Injection)
|
|
12
|
+
* - SafeResponseDetector: Safe response pattern detection
|
|
13
|
+
* - ConfidenceScorer: Confidence level calculation
|
|
7
14
|
*/
|
|
8
15
|
import { CompatibilityCallToolResult, Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
9
16
|
import { SecurityPayload } from "../../../../lib/securityPatterns.js";
|
|
10
17
|
import type { SanitizationDetectionResult } from "./SanitizationDetector.js";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export
|
|
15
|
-
confidence: "high" | "medium" | "low";
|
|
16
|
-
requiresManualReview: boolean;
|
|
17
|
-
manualReviewReason?: string;
|
|
18
|
-
reviewGuidance?: string;
|
|
19
|
-
}
|
|
18
|
+
import { MathResultAnalysis } from "./MathAnalyzer.js";
|
|
19
|
+
import { ConfidenceResult } from "./ConfidenceScorer.js";
|
|
20
|
+
export type { ConfidenceResult } from "./ConfidenceScorer.js";
|
|
21
|
+
export type { MathResultAnalysis } from "./MathAnalyzer.js";
|
|
20
22
|
/**
|
|
21
23
|
* Result of response analysis
|
|
22
24
|
*/
|
|
@@ -24,14 +26,6 @@ export interface AnalysisResult {
|
|
|
24
26
|
isVulnerable: boolean;
|
|
25
27
|
evidence?: string;
|
|
26
28
|
}
|
|
27
|
-
/**
|
|
28
|
-
* Result of computed math analysis with confidence level (Issue #58)
|
|
29
|
-
*/
|
|
30
|
-
export interface MathResultAnalysis {
|
|
31
|
-
isComputed: boolean;
|
|
32
|
-
confidence: "high" | "medium" | "low";
|
|
33
|
-
reason?: string;
|
|
34
|
-
}
|
|
35
29
|
/**
|
|
36
30
|
* Result of auth bypass response analysis (Issue #75)
|
|
37
31
|
* Detects fail-open authentication vulnerabilities (CVE-2025-52882)
|
|
@@ -48,8 +42,17 @@ export type ErrorClassification = "connection" | "server" | "protocol";
|
|
|
48
42
|
/**
|
|
49
43
|
* Analyzes tool responses for security vulnerabilities
|
|
50
44
|
* Distinguishes between safe reflection and actual execution
|
|
45
|
+
*
|
|
46
|
+
* This class serves as a facade, delegating to focused analyzers
|
|
47
|
+
* while maintaining the same public API for backward compatibility.
|
|
51
48
|
*/
|
|
52
49
|
export declare class SecurityResponseAnalyzer {
|
|
50
|
+
private errorClassifier;
|
|
51
|
+
private executionDetector;
|
|
52
|
+
private mathAnalyzer;
|
|
53
|
+
private safeDetector;
|
|
54
|
+
private confidenceScorer;
|
|
55
|
+
constructor();
|
|
53
56
|
/**
|
|
54
57
|
* Analyze response with evidence-based detection
|
|
55
58
|
* CRITICAL: Distinguish between safe reflection and actual execution
|
|
@@ -59,24 +62,34 @@ export declare class SecurityResponseAnalyzer {
|
|
|
59
62
|
*/
|
|
60
63
|
analyzeResponse(response: CompatibilityCallToolResult, payload: SecurityPayload, tool: Tool): AnalysisResult;
|
|
61
64
|
/**
|
|
62
|
-
*
|
|
63
|
-
* Handles: MCP validation errors (-32602), HTTP 4xx/5xx errors
|
|
65
|
+
* Calculate confidence level and manual review requirements
|
|
64
66
|
*/
|
|
65
|
-
|
|
67
|
+
calculateConfidence(tool: Tool, isVulnerable: boolean, evidence: string, responseText: string, payload: SecurityPayload, sanitizationResult?: SanitizationDetectionResult): ConfidenceResult;
|
|
66
68
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
+
* Analyze response for auth bypass patterns (Issue #75)
|
|
70
|
+
* Detects fail-open authentication vulnerabilities (CVE-2025-52882)
|
|
69
71
|
*/
|
|
70
|
-
|
|
72
|
+
analyzeAuthBypassResponse(response: CompatibilityCallToolResult): AuthBypassResult;
|
|
71
73
|
/**
|
|
72
|
-
* Check
|
|
73
|
-
* Handles: Evidence pattern matching, fallback injection analysis
|
|
74
|
+
* Check if response indicates connection/server failure
|
|
74
75
|
*/
|
|
75
|
-
|
|
76
|
+
isConnectionError(response: CompatibilityCallToolResult): boolean;
|
|
76
77
|
/**
|
|
77
|
-
* Check if
|
|
78
|
+
* Check if caught exception indicates connection/server failure
|
|
78
79
|
*/
|
|
79
|
-
|
|
80
|
+
isConnectionErrorFromException(error: unknown): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Classify error type for reporting
|
|
83
|
+
*/
|
|
84
|
+
classifyError(response: CompatibilityCallToolResult): ErrorClassification;
|
|
85
|
+
/**
|
|
86
|
+
* Classify error type from caught exception
|
|
87
|
+
*/
|
|
88
|
+
classifyErrorFromException(error: unknown): ErrorClassification;
|
|
89
|
+
/**
|
|
90
|
+
* Extract response content from MCP response
|
|
91
|
+
*/
|
|
92
|
+
extractResponseContent(response: CompatibilityCallToolResult): string;
|
|
80
93
|
/**
|
|
81
94
|
* Check if response is an MCP validation error (safe rejection)
|
|
82
95
|
*/
|
|
@@ -98,45 +111,19 @@ export declare class SecurityResponseAnalyzer {
|
|
|
98
111
|
hasExecutionEvidence(responseText: string): boolean;
|
|
99
112
|
/**
|
|
100
113
|
* Check if a math expression payload was computed (execution evidence)
|
|
114
|
+
* @deprecated Use analyzeComputedMathResult instead
|
|
101
115
|
*/
|
|
102
116
|
isComputedMathResult(payload: string, responseText: string): boolean;
|
|
103
117
|
/**
|
|
104
|
-
* Check if numeric value appears in structured data context
|
|
105
|
-
* Distinguishes {"records": 4} from computed "4" (Issue #58)
|
|
106
|
-
*
|
|
107
|
-
* @param result The computed numeric result to check for
|
|
108
|
-
* @param responseText The response text to analyze
|
|
109
|
-
* @returns true if the number appears to be coincidental data, not a computed result
|
|
118
|
+
* Check if numeric value appears in structured data context
|
|
110
119
|
*/
|
|
111
120
|
isCoincidentalNumericInStructuredData(result: number, responseText: string): boolean;
|
|
112
121
|
/**
|
|
113
122
|
* Enhanced computed math result analysis with tool context (Issue #58)
|
|
114
|
-
*
|
|
115
|
-
* Returns a confidence level indicating how likely this is a real Calculator Injection:
|
|
116
|
-
* - high: Strong evidence of computation (should flag as vulnerable)
|
|
117
|
-
* - medium: Ambiguous (excluded from vulnerability count per user decision)
|
|
118
|
-
* - low: Likely coincidental data (excluded from vulnerability count)
|
|
119
123
|
*/
|
|
120
124
|
analyzeComputedMathResult(payload: string, responseText: string, tool?: Tool): MathResultAnalysis;
|
|
121
|
-
/**
|
|
122
|
-
* Check if response indicates connection/server failure
|
|
123
|
-
*/
|
|
124
|
-
isConnectionError(response: CompatibilityCallToolResult): boolean;
|
|
125
|
-
/**
|
|
126
|
-
* Check if caught exception indicates connection/server failure
|
|
127
|
-
*/
|
|
128
|
-
isConnectionErrorFromException(error: unknown): boolean;
|
|
129
|
-
/**
|
|
130
|
-
* Classify error type for reporting
|
|
131
|
-
*/
|
|
132
|
-
classifyError(response: CompatibilityCallToolResult): ErrorClassification;
|
|
133
|
-
/**
|
|
134
|
-
* Classify error type from caught exception
|
|
135
|
-
*/
|
|
136
|
-
classifyErrorFromException(error: unknown): ErrorClassification;
|
|
137
125
|
/**
|
|
138
126
|
* Check if response is just reflection (safe)
|
|
139
|
-
* Two-layer defense: Match reflection patterns, verify NO execution evidence
|
|
140
127
|
*/
|
|
141
128
|
isReflectionResponse(responseText: string): boolean;
|
|
142
129
|
/**
|
|
@@ -148,21 +135,9 @@ export declare class SecurityResponseAnalyzer {
|
|
|
148
135
|
*/
|
|
149
136
|
containsEchoedInjectionPayload(responseText: string): boolean;
|
|
150
137
|
/**
|
|
151
|
-
*
|
|
152
|
-
*/
|
|
153
|
-
analyzeInjectionResponse(response: CompatibilityCallToolResult, _payload: string): AnalysisResult;
|
|
154
|
-
/**
|
|
155
|
-
* Calculate confidence level and manual review requirements
|
|
156
|
-
*
|
|
157
|
-
* @param tool - The tool being tested
|
|
158
|
-
* @param isVulnerable - Whether the tool was flagged as vulnerable
|
|
159
|
-
* @param evidence - Evidence string from vulnerability detection
|
|
160
|
-
* @param responseText - The response text from the tool
|
|
161
|
-
* @param payload - The security payload used for testing
|
|
162
|
-
* @param sanitizationResult - Optional sanitization detection result (Issue #56)
|
|
163
|
-
* @returns Confidence result with manual review requirements
|
|
138
|
+
* Check if tool explicitly rejected input with validation error (SAFE)
|
|
164
139
|
*/
|
|
165
|
-
|
|
140
|
+
isValidationRejection(response: CompatibilityCallToolResult): boolean;
|
|
166
141
|
/**
|
|
167
142
|
* Check if tool is a structured data tool
|
|
168
143
|
*/
|
|
@@ -171,25 +146,28 @@ export declare class SecurityResponseAnalyzer {
|
|
|
171
146
|
* Check if response is returning search results
|
|
172
147
|
*/
|
|
173
148
|
isSearchResultResponse(responseText: string): boolean;
|
|
174
|
-
/**
|
|
175
|
-
* Analyze response for auth bypass patterns (Issue #75)
|
|
176
|
-
* Detects fail-open authentication vulnerabilities (CVE-2025-52882)
|
|
177
|
-
*
|
|
178
|
-
* @param response The tool response to analyze
|
|
179
|
-
* @returns AuthBypassResult with detection status and failure mode classification
|
|
180
|
-
*/
|
|
181
|
-
analyzeAuthBypassResponse(response: CompatibilityCallToolResult): AuthBypassResult;
|
|
182
149
|
/**
|
|
183
150
|
* Check if response is from a creation/modification operation
|
|
184
151
|
*/
|
|
185
152
|
isCreationResponse(responseText: string): boolean;
|
|
186
153
|
/**
|
|
187
|
-
*
|
|
154
|
+
* Check for safe error responses that indicate proper input rejection
|
|
155
|
+
* Handles: MCP validation errors (-32602), HTTP 4xx/5xx errors
|
|
188
156
|
*/
|
|
189
|
-
|
|
157
|
+
private checkSafeErrorResponses;
|
|
190
158
|
/**
|
|
191
|
-
*
|
|
159
|
+
* Check for safe tool behavior patterns
|
|
160
|
+
* Handles: Tool categories, reflection, computed math, validation rejection
|
|
161
|
+
*/
|
|
162
|
+
private checkSafeToolBehavior;
|
|
163
|
+
/**
|
|
164
|
+
* Check for vulnerability evidence in response
|
|
165
|
+
* Handles: Evidence pattern matching, fallback injection analysis
|
|
166
|
+
*/
|
|
167
|
+
private checkVulnerabilityEvidence;
|
|
168
|
+
/**
|
|
169
|
+
* Analyze injection response (fallback logic)
|
|
192
170
|
*/
|
|
193
|
-
private
|
|
171
|
+
private analyzeInjectionResponse;
|
|
194
172
|
}
|
|
195
173
|
//# sourceMappingURL=SecurityResponseAnalyzer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecurityResponseAnalyzer.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/securityTests/SecurityResponseAnalyzer.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"SecurityResponseAnalyzer.d.ts","sourceRoot":"","sources":["../../../../../src/services/assessment/modules/securityTests/SecurityResponseAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,2BAA2B,EAC3B,IAAI,EACL,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAK1E,OAAO,EAAgB,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAoB,gBA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