@bryan-thompson/inspector-assessment-client 1.35.2 → 1.36.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.
Files changed (48) hide show
  1. package/dist/assets/{OAuthCallback-jfmizOMH.js → OAuthCallback-Cfp3Vzdz.js} +1 -1
  2. package/dist/assets/{OAuthDebugCallback-bU5kKvnt.js → OAuthDebugCallback-7BLaxlcq.js} +1 -1
  3. package/dist/assets/{index-Ce63ds7G.js → index-B21S7_ML.js} +4 -4
  4. package/dist/index.html +1 -1
  5. package/lib/lib/assessment/coreTypes.d.ts +23 -0
  6. package/lib/lib/assessment/coreTypes.d.ts.map +1 -1
  7. package/lib/lib/assessment/extendedTypes.d.ts +49 -2
  8. package/lib/lib/assessment/extendedTypes.d.ts.map +1 -1
  9. package/lib/lib/assessment/jsonlEventSchemas.d.ts +4 -4
  10. package/lib/lib/assessment/resultTypes.d.ts +32 -1
  11. package/lib/lib/assessment/resultTypes.d.ts.map +1 -1
  12. package/lib/lib/aupPatterns.d.ts +50 -0
  13. package/lib/lib/aupPatterns.d.ts.map +1 -1
  14. package/lib/lib/aupPatterns.js +140 -0
  15. package/lib/lib/moduleScoring.d.ts.map +1 -1
  16. package/lib/lib/moduleScoring.js +39 -2
  17. package/lib/lib/securityPatterns.d.ts.map +1 -1
  18. package/lib/lib/securityPatterns.js +92 -0
  19. package/lib/services/assessment/modules/DeveloperExperienceAssessor.d.ts +26 -1
  20. package/lib/services/assessment/modules/DeveloperExperienceAssessor.d.ts.map +1 -1
  21. package/lib/services/assessment/modules/DeveloperExperienceAssessor.js +160 -1
  22. package/lib/services/assessment/modules/ErrorHandlingAssessor.d.ts.map +1 -1
  23. package/lib/services/assessment/modules/ErrorHandlingAssessor.js +15 -0
  24. package/lib/services/assessment/modules/ManifestValidationAssessor.d.ts +32 -0
  25. package/lib/services/assessment/modules/ManifestValidationAssessor.d.ts.map +1 -1
  26. package/lib/services/assessment/modules/ManifestValidationAssessor.js +218 -20
  27. package/lib/services/assessment/modules/ProhibitedLibrariesAssessor.d.ts +5 -0
  28. package/lib/services/assessment/modules/ProhibitedLibrariesAssessor.d.ts.map +1 -1
  29. package/lib/services/assessment/modules/ProhibitedLibrariesAssessor.js +29 -0
  30. package/lib/services/assessment/modules/SecurityAssessor.d.ts.map +1 -1
  31. package/lib/services/assessment/modules/SecurityAssessor.js +13 -0
  32. package/lib/services/assessment/modules/annotations/AlignmentChecker.d.ts +7 -2
  33. package/lib/services/assessment/modules/annotations/AlignmentChecker.d.ts.map +1 -1
  34. package/lib/services/assessment/modules/annotations/AlignmentChecker.js +116 -18
  35. package/lib/services/assessment/modules/annotations/index.d.ts +1 -1
  36. package/lib/services/assessment/modules/annotations/index.d.ts.map +1 -1
  37. package/lib/services/assessment/modules/annotations/index.js +2 -1
  38. package/lib/services/assessment/modules/securityTests/ConfidenceScorer.d.ts.map +1 -1
  39. package/lib/services/assessment/modules/securityTests/ConfidenceScorer.js +28 -0
  40. package/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.d.ts +95 -0
  41. package/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.d.ts.map +1 -1
  42. package/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.js +174 -0
  43. package/lib/services/assessment/modules/securityTests/SecurityPayloadTester.d.ts.map +1 -1
  44. package/lib/services/assessment/modules/securityTests/SecurityPayloadTester.js +15 -0
  45. package/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.d.ts +40 -0
  46. package/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.d.ts.map +1 -1
  47. package/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.js +143 -131
  48. package/package.json +1 -1
@@ -20,7 +20,15 @@ import { MathAnalyzer } from "./MathAnalyzer.js";
20
20
  import { SafeResponseDetector } from "./SafeResponseDetector.js";
21
21
  import { ConfidenceScorer } from "./ConfidenceScorer.js";
22
22
  // Import pattern library for chain exploitation analysis
23
- import { CHAIN_EXPLOIT_VULNERABLE_PATTERNS, CHAIN_EXPLOIT_SAFE_PATTERNS, CHAIN_VULNERABLE_THRESHOLD, CHAIN_SAFE_THRESHOLD, detectVulnerabilityCategories, } from "./SecurityPatternLibrary.js";
23
+ import { CHAIN_EXPLOIT_VULNERABLE_PATTERNS, CHAIN_EXPLOIT_SAFE_PATTERNS, CHAIN_VULNERABLE_THRESHOLD, CHAIN_SAFE_THRESHOLD, detectVulnerabilityCategories,
24
+ // Issue #144: Excessive permissions scope patterns (Challenge #22)
25
+ SCOPE_VIOLATION_PATTERNS, SCOPE_ENFORCED_PATTERNS,
26
+ // Issue #146: Error context patterns for false positive reduction
27
+ isPayloadInErrorContext, hasSuccessContext, hasErrorContext,
28
+ // Issue #75: Auth bypass patterns (CVE-2025-52882)
29
+ AUTH_FAIL_OPEN_PATTERNS, AUTH_FAIL_CLOSED_PATTERNS,
30
+ // Issue #92: State-based auth patterns (Challenge #7)
31
+ STATE_AUTH_VULNERABLE_PATTERNS, STATE_AUTH_SAFE_PATTERNS, } from "./SecurityPatternLibrary.js";
24
32
  /**
25
33
  * Analyzes tool responses for security vulnerabilities
26
34
  * Distinguishes between safe reflection and actual execution
@@ -64,7 +72,13 @@ export class SecurityResponseAnalyzer {
64
72
  if (behaviorResult)
65
73
  return behaviorResult;
66
74
  // Check 3: Vulnerability evidence matching
67
- return this.checkVulnerabilityEvidence(response, payload, responseText);
75
+ const vulnResult = this.checkVulnerabilityEvidence(response, payload, responseText);
76
+ // Issue #146: If vulnerable, classify execution context to reduce false positives
77
+ // This distinguishes between actual execution and payload reflection in errors
78
+ if (vulnResult.isVulnerable) {
79
+ return this.classifyVulnerabilityContext(vulnResult, responseText, payload);
80
+ }
81
+ return vulnResult;
68
82
  }
69
83
  /**
70
84
  * Calculate confidence level and manual review requirements
@@ -78,77 +92,14 @@ export class SecurityResponseAnalyzer {
78
92
  */
79
93
  analyzeAuthBypassResponse(response) {
80
94
  const responseText = this.extractResponseContent(response);
81
- // Fail-open indicators (VULNERABLE - CVE-2025-52882 pattern)
82
- const failOpenPatterns = [
83
- {
84
- pattern: /"auth_type"\s*:\s*"fail-open"/i,
85
- evidence: "auth_type: fail-open (CVE-2025-52882)",
86
- },
87
- {
88
- pattern: /"auth_status"\s*:\s*"bypassed"/i,
89
- evidence: "auth_status: bypassed",
90
- },
91
- {
92
- pattern: /access.*granted.*despite/i,
93
- evidence: "access granted despite failure",
94
- },
95
- {
96
- pattern: /authentication.*skipped/i,
97
- evidence: "authentication skipped",
98
- },
99
- { pattern: /fail[\s-]?open/i, evidence: "fail-open pattern detected" },
100
- { pattern: /bypassed.*auth/i, evidence: "auth bypassed" },
101
- {
102
- pattern: /authentication.*bypassed/i,
103
- evidence: "authentication bypassed",
104
- },
105
- {
106
- pattern: /"vulnerable"\s*:\s*true[^}]*(?:"auth_status"|"auth_type"|"auth_error")|(?:"auth_status"|"auth_type"|"auth_error")[^}]*"vulnerable"\s*:\s*true/i,
107
- evidence: "vulnerable flag with auth context",
108
- },
109
- {
110
- pattern: /auth.*succeeded.*null/i,
111
- evidence: "auth succeeded with null token",
112
- },
113
- {
114
- pattern: /granted.*without.*valid/i,
115
- evidence: "granted without valid token",
116
- },
117
- {
118
- pattern: /"action_performed"/i,
119
- evidence: "action performed indicator",
120
- },
121
- ];
122
- // Fail-closed indicators (SAFE - proper auth handling)
123
- const failClosedPatterns = [
124
- {
125
- pattern: /"auth_type"\s*:\s*"fail-closed"/i,
126
- evidence: "auth_type: fail-closed (secure)",
127
- },
128
- {
129
- pattern: /"auth_status"\s*:\s*"denied"/i,
130
- evidence: "auth_status: denied",
131
- },
132
- { pattern: /access.*denied/i, evidence: "access denied" },
133
- { pattern: /authentication.*failed/i, evidence: "authentication failed" },
134
- {
135
- pattern: /fail[\s-]?closed/i,
136
- evidence: "fail-closed pattern detected",
137
- },
138
- { pattern: /"status"\s*:\s*"blocked"/i, evidence: "status: blocked" },
139
- { pattern: /invalid.*token/i, evidence: "invalid token rejection" },
140
- { pattern: /token.*required/i, evidence: "token required" },
141
- { pattern: /unauthorized/i, evidence: "unauthorized response" },
142
- { pattern: /"denial_reason"/i, evidence: "denial reason provided" },
143
- ];
144
95
  // Check for fail-open (vulnerable) patterns first
145
- for (const { pattern, evidence } of failOpenPatterns) {
96
+ for (const { pattern, evidence } of AUTH_FAIL_OPEN_PATTERNS) {
146
97
  if (pattern.test(responseText)) {
147
98
  return { detected: true, failureMode: "FAIL_OPEN", evidence };
148
99
  }
149
100
  }
150
101
  // Check for fail-closed (safe) patterns
151
- for (const { pattern, evidence } of failClosedPatterns) {
102
+ for (const { pattern, evidence } of AUTH_FAIL_CLOSED_PATTERNS) {
152
103
  if (pattern.test(responseText)) {
153
104
  return { detected: false, failureMode: "FAIL_CLOSED", evidence };
154
105
  }
@@ -167,70 +118,8 @@ export class SecurityResponseAnalyzer {
167
118
  */
168
119
  analyzeStateBasedAuthBypass(response) {
169
120
  const responseText = this.extractResponseContent(response);
170
- // Vulnerable patterns - shared state authorization (Challenge #7)
171
- const vulnerablePatterns = [
172
- {
173
- pattern: /"admin_mode"\s*:\s*true/i,
174
- evidence: "admin_mode enabled in response",
175
- },
176
- {
177
- pattern: /hint.*use\s+config_modifier/i,
178
- evidence: "Tool hints at cross-tool state dependency",
179
- },
180
- {
181
- pattern: /admin_mode.*set\s+by.*another\s+tool/i,
182
- evidence: "Explicit cross-tool state dependency",
183
- },
184
- {
185
- pattern: /"evidence".*cross-tool.*privilege/i,
186
- evidence: "Cross-tool privilege escalation detected",
187
- },
188
- {
189
- pattern: /elevated\s+privileges?\s+granted/i,
190
- evidence: "Elevated privileges granted",
191
- },
192
- {
193
- pattern: /admin\s+mode\s+activated/i,
194
- evidence: "Admin mode activated (state modifier)",
195
- },
196
- {
197
- pattern: /"hint".*config_modifier.*admin_mode/i,
198
- evidence: "Response hints at config_modifier for admin_mode",
199
- },
200
- {
201
- pattern: /Use\s+config_modifier.*enable.*admin_mode/i,
202
- evidence: "Tool depends on config_modifier for authorization",
203
- },
204
- ];
205
- // Safe patterns - independent authorization (secure)
206
- const safePatterns = [
207
- {
208
- pattern: /"shared_state_checked"\s*:\s*false/i,
209
- evidence: "Tool explicitly states it doesn't use shared state",
210
- },
211
- {
212
- pattern: /"independent_auth_required"\s*:\s*true/i,
213
- evidence: "Tool requires independent per-request auth",
214
- },
215
- {
216
- pattern: /requires\s+independent\s+authorization/i,
217
- evidence: "Independent authorization required",
218
- },
219
- {
220
- pattern: /(?:not|does\s+not|doesn't)\s+(?:use\s+)?shared\s+state/i,
221
- evidence: "Tool confirms it does not use shared state",
222
- },
223
- {
224
- pattern: /stored.*for.*admin.*review/i,
225
- evidence: "Request stored for admin review (no auto-execution)",
226
- },
227
- {
228
- pattern: /per-request\s+auth/i,
229
- evidence: "Per-request authentication enforced",
230
- },
231
- ];
232
121
  // Check vulnerable patterns first (SHARED_STATE)
233
- for (const { pattern, evidence } of vulnerablePatterns) {
122
+ for (const { pattern, evidence } of STATE_AUTH_VULNERABLE_PATTERNS) {
234
123
  if (pattern.test(responseText)) {
235
124
  return {
236
125
  vulnerable: true,
@@ -241,7 +130,7 @@ export class SecurityResponseAnalyzer {
241
130
  }
242
131
  }
243
132
  // Check safe patterns (INDEPENDENT)
244
- for (const { pattern, evidence } of safePatterns) {
133
+ for (const { pattern, evidence } of STATE_AUTH_SAFE_PATTERNS) {
245
134
  if (pattern.test(responseText)) {
246
135
  return {
247
136
  vulnerable: false,
@@ -1230,6 +1119,129 @@ export class SecurityResponseAnalyzer {
1230
1119
  // Fall back to injection response analysis
1231
1120
  return this.analyzeInjectionResponse(response);
1232
1121
  }
1122
+ // ============================================================================
1123
+ // Issue #146: Execution Context Classification (False Positive Reduction)
1124
+ // ============================================================================
1125
+ /**
1126
+ * Issue #146: Classify vulnerability context to reduce false positives
1127
+ * Distinguishes between actual execution and payload reflection in errors
1128
+ *
1129
+ * Context classification:
1130
+ * - CONFIRMED: Operation succeeded, payload was actually executed (HIGH risk)
1131
+ * - LIKELY_FALSE_POSITIVE: Operation failed, payload just reflected in error (LOW risk)
1132
+ * - SUSPECTED: Ambiguous case requiring manual review (MEDIUM risk)
1133
+ *
1134
+ * @param vulnResult The vulnerability analysis result from checkVulnerabilityEvidence
1135
+ * @param responseText The full response text (lowercase)
1136
+ * @param payload The security payload that was tested
1137
+ * @returns Updated AnalysisResult with context classification
1138
+ */
1139
+ classifyVulnerabilityContext(vulnResult, responseText, payload) {
1140
+ // Use pattern library helpers to detect context
1141
+ const hasError = hasErrorContext(responseText);
1142
+ const hasSuccess = hasSuccessContext(responseText);
1143
+ const payloadInError = isPayloadInErrorContext(responseText, payload.payload);
1144
+ // CONFIRMED: Success patterns present, no error patterns
1145
+ // This indicates the operation actually executed and returned results
1146
+ if (hasSuccess && !hasError) {
1147
+ return {
1148
+ ...vulnResult,
1149
+ evidence: `${vulnResult.evidence} [Context: CONFIRMED - operation succeeded]`,
1150
+ };
1151
+ }
1152
+ // LIKELY_FALSE_POSITIVE: Error context with payload reflection
1153
+ // The server rejected the operation but echoed the payload in the error message
1154
+ if (payloadInError && hasError) {
1155
+ return {
1156
+ isVulnerable: false,
1157
+ evidence: `Operation failed with error containing reflected payload. ` +
1158
+ `Original detection: ${vulnResult.evidence} ` +
1159
+ `[Context: LIKELY_FALSE_POSITIVE - payload reflected in error message, not executed]`,
1160
+ };
1161
+ }
1162
+ // SUSPECTED: Ambiguous (neither clear success nor clear error)
1163
+ // Mark as requiring manual review
1164
+ return {
1165
+ ...vulnResult,
1166
+ evidence: `${vulnResult.evidence} [Context: SUSPECTED - requires manual review]`,
1167
+ };
1168
+ }
1169
+ // ============================================================================
1170
+ // Issue #144: Excessive Permissions Scope Analysis (Challenge #22)
1171
+ // ============================================================================
1172
+ /**
1173
+ * Analyze response for excessive permissions scope violations (Issue #144, Challenge #22)
1174
+ * Detects when tools exceed their declared annotation scope:
1175
+ * - scope_violation: Tool performed privileged action despite restrictive annotations
1176
+ * - scope_escalation: Keyword triggered hidden admin/privilege mode
1177
+ * - scope_enforced: Tool properly blocked the privileged action (safe)
1178
+ *
1179
+ * CWE-250: Execution with Unnecessary Privileges
1180
+ * CWE-269: Improper Privilege Management
1181
+ */
1182
+ analyzeExcessivePermissionsResponse(response) {
1183
+ const responseText = this.extractResponseContent(response);
1184
+ const cweIds = [];
1185
+ // Check for safe/hardened patterns first (scope enforced)
1186
+ for (const { pattern, evidence } of SCOPE_ENFORCED_PATTERNS) {
1187
+ if (pattern.test(responseText)) {
1188
+ return {
1189
+ detected: false,
1190
+ violationType: "SAFE",
1191
+ cweIds: [],
1192
+ evidence,
1193
+ };
1194
+ }
1195
+ }
1196
+ // Check for scope violation patterns
1197
+ for (const { pattern, evidence } of SCOPE_VIOLATION_PATTERNS) {
1198
+ if (pattern.test(responseText)) {
1199
+ // Determine specific violation type based on pattern
1200
+ if (/"scope_escalation"\s*:\s*true/i.test(responseText)) {
1201
+ // Scope escalation - keyword-triggered privilege escalation
1202
+ cweIds.push("CWE-269");
1203
+ // Extract trigger keyword if present
1204
+ const keywordMatch = responseText.match(/"trigger_keyword"\s*:\s*"([^"]+)"/i);
1205
+ const triggerPayload = keywordMatch?.[1];
1206
+ return {
1207
+ detected: true,
1208
+ violationType: "SCOPE_ESCALATION",
1209
+ triggerPayload,
1210
+ cweIds,
1211
+ evidence,
1212
+ };
1213
+ }
1214
+ if (/"scope_violation"\s*:\s*true/i.test(responseText)) {
1215
+ // Scope violation - action exceeded declared scope
1216
+ cweIds.push("CWE-250", "CWE-269");
1217
+ // Extract actual scope if present
1218
+ const scopeMatch = responseText.match(/"actual_scope"\s*:\s*"([^"]+)"/i);
1219
+ const actualScope = scopeMatch?.[1];
1220
+ return {
1221
+ detected: true,
1222
+ violationType: "SCOPE_VIOLATION",
1223
+ actualScope,
1224
+ cweIds,
1225
+ evidence,
1226
+ };
1227
+ }
1228
+ // Generic detection (privileged_data, system_secrets, admin_mode_activated)
1229
+ cweIds.push("CWE-250", "CWE-269");
1230
+ return {
1231
+ detected: true,
1232
+ violationType: "SCOPE_VIOLATION",
1233
+ cweIds,
1234
+ evidence,
1235
+ };
1236
+ }
1237
+ }
1238
+ // No scope violation or enforcement detected
1239
+ return {
1240
+ detected: false,
1241
+ violationType: "UNKNOWN",
1242
+ cweIds: [],
1243
+ };
1244
+ }
1233
1245
  /**
1234
1246
  * Analyze injection response (fallback logic)
1235
1247
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bryan-thompson/inspector-assessment-client",
3
- "version": "1.35.2",
3
+ "version": "1.36.0",
4
4
  "description": "Client-side application for the Enhanced MCP Inspector with assessment capabilities",
5
5
  "license": "MIT",
6
6
  "author": "Bryan Thompson <bryan@triepod.ai>",