@bryan-thompson/inspector-assessment 1.6.0 → 1.7.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/cli/build/assess-full.js +528 -0
- package/cli/build/assess-security.js +342 -0
- package/client/dist/assets/{OAuthCallback-ZcXdfhZQ.js → OAuthCallback-cGhwkoyY.js} +1 -1
- package/client/dist/assets/{OAuthDebugCallback-xt1SlIHS.js → OAuthDebugCallback-2rmUqser.js} +1 -1
- package/client/dist/assets/{index-B3lTiDVe.js → index-BnFixpvH.js} +4 -4
- package/client/dist/index.html +1 -1
- package/client/lib/lib/assessmentTypes.d.ts +670 -0
- package/client/lib/lib/assessmentTypes.d.ts.map +1 -0
- package/client/lib/lib/assessmentTypes.js +220 -0
- package/client/lib/lib/aupPatterns.d.ts +63 -0
- package/client/lib/lib/aupPatterns.d.ts.map +1 -0
- package/client/lib/lib/aupPatterns.js +344 -0
- package/client/lib/lib/prohibitedLibraries.d.ts +76 -0
- package/client/lib/lib/prohibitedLibraries.d.ts.map +1 -0
- package/client/lib/lib/prohibitedLibraries.js +364 -0
- package/client/lib/lib/securityPatterns.d.ts +64 -0
- package/client/lib/lib/securityPatterns.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns.js +453 -0
- package/client/lib/services/assessment/AssessmentOrchestrator.d.ts +88 -0
- package/client/lib/services/assessment/AssessmentOrchestrator.d.ts.map +1 -0
- package/client/lib/services/assessment/AssessmentOrchestrator.js +418 -0
- package/client/lib/services/assessment/ResponseValidator.d.ts +69 -0
- package/client/lib/services/assessment/ResponseValidator.d.ts.map +1 -0
- package/client/lib/services/assessment/ResponseValidator.js +1038 -0
- package/client/lib/services/assessment/TestDataGenerator.d.ts +86 -0
- package/client/lib/services/assessment/TestDataGenerator.d.ts.map +1 -0
- package/client/lib/services/assessment/TestDataGenerator.js +669 -0
- package/client/lib/services/assessment/TestScenarioEngine.d.ts +91 -0
- package/client/lib/services/assessment/TestScenarioEngine.d.ts.map +1 -0
- package/client/lib/services/assessment/TestScenarioEngine.js +505 -0
- package/client/lib/services/assessment/ToolClassifier.d.ts +61 -0
- package/client/lib/services/assessment/ToolClassifier.d.ts.map +1 -0
- package/client/lib/services/assessment/ToolClassifier.js +349 -0
- package/client/lib/services/assessment/lib/claudeCodeBridge.d.ts +160 -0
- package/client/lib/services/assessment/lib/claudeCodeBridge.d.ts.map +1 -0
- package/client/lib/services/assessment/lib/claudeCodeBridge.js +357 -0
- package/client/lib/services/assessment/modules/AUPComplianceAssessor.d.ts +100 -0
- package/client/lib/services/assessment/modules/AUPComplianceAssessor.d.ts.map +1 -0
- package/client/lib/services/assessment/modules/AUPComplianceAssessor.js +474 -0
- package/client/lib/services/assessment/modules/BaseAssessor.d.ts +71 -0
- package/client/lib/services/assessment/modules/BaseAssessor.d.ts.map +1 -0
- package/client/lib/services/assessment/modules/BaseAssessor.js +171 -0
- package/client/lib/services/assessment/modules/DocumentationAssessor.d.ts +45 -0
- package/client/lib/services/assessment/modules/DocumentationAssessor.d.ts.map +1 -0
- package/client/lib/services/assessment/modules/DocumentationAssessor.js +355 -0
- package/client/lib/services/assessment/modules/ErrorHandlingAssessor.d.ts +25 -0
- package/client/lib/services/assessment/modules/ErrorHandlingAssessor.d.ts.map +1 -0
- package/client/lib/services/assessment/modules/ErrorHandlingAssessor.js +564 -0
- package/client/lib/services/assessment/modules/FunctionalityAssessor.d.ts +20 -0
- package/client/lib/services/assessment/modules/FunctionalityAssessor.d.ts.map +1 -0
- package/client/lib/services/assessment/modules/FunctionalityAssessor.js +253 -0
- package/client/lib/services/assessment/modules/MCPSpecComplianceAssessor.d.ts +70 -0
- package/client/lib/services/assessment/modules/MCPSpecComplianceAssessor.d.ts.map +1 -0
- package/client/lib/services/assessment/modules/MCPSpecComplianceAssessor.js +508 -0
- package/client/lib/services/assessment/modules/ManifestValidationAssessor.d.ts +70 -0
- package/client/lib/services/assessment/modules/ManifestValidationAssessor.d.ts.map +1 -0
- package/client/lib/services/assessment/modules/ManifestValidationAssessor.js +430 -0
- package/client/lib/services/assessment/modules/PortabilityAssessor.d.ts +43 -0
- package/client/lib/services/assessment/modules/PortabilityAssessor.d.ts.map +1 -0
- package/client/lib/services/assessment/modules/PortabilityAssessor.js +347 -0
- package/client/lib/services/assessment/modules/ProhibitedLibrariesAssessor.d.ts +41 -0
- package/client/lib/services/assessment/modules/ProhibitedLibrariesAssessor.d.ts.map +1 -0
- package/client/lib/services/assessment/modules/ProhibitedLibrariesAssessor.js +256 -0
- package/client/lib/services/assessment/modules/SecurityAssessor.d.ts +176 -0
- package/client/lib/services/assessment/modules/SecurityAssessor.d.ts.map +1 -0
- package/client/lib/services/assessment/modules/SecurityAssessor.js +1333 -0
- package/client/lib/services/assessment/modules/ToolAnnotationAssessor.d.ts +96 -0
- package/client/lib/services/assessment/modules/ToolAnnotationAssessor.d.ts.map +1 -0
- package/client/lib/services/assessment/modules/ToolAnnotationAssessor.js +593 -0
- package/client/lib/services/assessment/modules/UsabilityAssessor.d.ts +21 -0
- package/client/lib/services/assessment/modules/UsabilityAssessor.d.ts.map +1 -0
- package/client/lib/services/assessment/modules/UsabilityAssessor.js +241 -0
- package/client/lib/services/assessment/modules/index.d.ts +33 -0
- package/client/lib/services/assessment/modules/index.d.ts.map +1 -0
- package/client/lib/services/assessment/modules/index.js +35 -0
- package/package.json +5 -2
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security Assessor Module
|
|
3
|
+
* Tests for backend API security vulnerabilities using 8 focused patterns
|
|
4
|
+
* - Critical Injection (3): Command, SQL, Path Traversal
|
|
5
|
+
* - Input Validation (3): Type Safety, Boundary Testing, Required Fields
|
|
6
|
+
* - Protocol Compliance (2): MCP Error Format, Timeout Handling
|
|
7
|
+
*/
|
|
8
|
+
import { SecurityAssessment } from "../../../lib/assessmentTypes.js";
|
|
9
|
+
import { BaseAssessor } from "./BaseAssessor.js";
|
|
10
|
+
import { AssessmentContext } from "../AssessmentOrchestrator.js";
|
|
11
|
+
export declare class SecurityAssessor extends BaseAssessor {
|
|
12
|
+
assess(context: AssessmentContext): Promise<SecurityAssessment>;
|
|
13
|
+
/**
|
|
14
|
+
* Select tools for testing based on configuration
|
|
15
|
+
*/
|
|
16
|
+
private selectToolsForTesting;
|
|
17
|
+
/**
|
|
18
|
+
* Run comprehensive security tests (advanced mode)
|
|
19
|
+
* Tests selected tools with ALL 8 security patterns using diverse payloads
|
|
20
|
+
* Includes injection tests, validation tests, and protocol compliance checks
|
|
21
|
+
*/
|
|
22
|
+
private runUniversalSecurityTests;
|
|
23
|
+
/**
|
|
24
|
+
* Run basic security tests (fast mode)
|
|
25
|
+
* Tests only 3 critical injection patterns with 1 generic payload each
|
|
26
|
+
* Used when enableDomainTesting = false
|
|
27
|
+
*/
|
|
28
|
+
private runBasicSecurityTests;
|
|
29
|
+
/**
|
|
30
|
+
* Test tool with a specific payload
|
|
31
|
+
*/
|
|
32
|
+
private testPayload;
|
|
33
|
+
/**
|
|
34
|
+
* Check if response indicates connection/server failure
|
|
35
|
+
* Returns true if test couldn't complete due to infrastructure issues
|
|
36
|
+
*
|
|
37
|
+
* CRITICAL: Only match transport/infrastructure errors, NOT tool business logic
|
|
38
|
+
*/
|
|
39
|
+
private isConnectionError;
|
|
40
|
+
/**
|
|
41
|
+
* Check if caught exception indicates connection/server failure
|
|
42
|
+
* CRITICAL: Only match transport/infrastructure errors, NOT tool business logic
|
|
43
|
+
*/
|
|
44
|
+
private isConnectionErrorFromException;
|
|
45
|
+
/**
|
|
46
|
+
* Classify error type for reporting
|
|
47
|
+
*/
|
|
48
|
+
private classifyError;
|
|
49
|
+
/**
|
|
50
|
+
* Classify error type from caught exception
|
|
51
|
+
*/
|
|
52
|
+
private classifyErrorFromException;
|
|
53
|
+
/**
|
|
54
|
+
* Analyze response with evidence-based detection
|
|
55
|
+
* CRITICAL: Distinguish between safe reflection and actual execution
|
|
56
|
+
*/
|
|
57
|
+
private analyzeResponse;
|
|
58
|
+
/**
|
|
59
|
+
* Check if tool explicitly rejected input with validation error (SAFE)
|
|
60
|
+
* Returns true if tool properly rejected invalid input (SECURE)
|
|
61
|
+
*
|
|
62
|
+
* Distinguishes between:
|
|
63
|
+
* - SAFE: {"valid": false, "errors": ["Input too long"]} (rejection)
|
|
64
|
+
* - VULNERABLE: {"result": "deleted 5 rows"} (execution)
|
|
65
|
+
*/
|
|
66
|
+
private isValidationRejection;
|
|
67
|
+
/**
|
|
68
|
+
* Check if response is an MCP validation error (safe rejection)
|
|
69
|
+
* Returns true if tool rejected input before processing (SECURE)
|
|
70
|
+
*
|
|
71
|
+
* Validation errors indicate proper input sanitization and are NOT vulnerabilities.
|
|
72
|
+
* Examples:
|
|
73
|
+
* - MCP error -32602 (JSON-RPC Invalid params standard)
|
|
74
|
+
* - "parameter validation failed: invalid url"
|
|
75
|
+
* - "schema validation error: must be a string"
|
|
76
|
+
*/
|
|
77
|
+
private isMCPValidationError;
|
|
78
|
+
/**
|
|
79
|
+
* Check if evidence pattern is ambiguous (can match both validation and execution)
|
|
80
|
+
* These patterns appear in BOTH:
|
|
81
|
+
* - Secure validation errors: "parameter validation failed: invalid type"
|
|
82
|
+
* - Vulnerable execution errors: "SQL executed: type error in result"
|
|
83
|
+
*/
|
|
84
|
+
private isValidationPattern;
|
|
85
|
+
/**
|
|
86
|
+
* Check if response contains evidence of actual execution
|
|
87
|
+
* Returns true only if malicious input was actually PROCESSED/EXECUTED
|
|
88
|
+
*
|
|
89
|
+
* Distinguishes between:
|
|
90
|
+
* - SECURE: "Parameter validation failed: invalid type" (rejected BEFORE execution)
|
|
91
|
+
* - VULNERABLE: "SQL executed: syntax error" (error DURING execution)
|
|
92
|
+
*/
|
|
93
|
+
private hasExecutionEvidence;
|
|
94
|
+
/**
|
|
95
|
+
* Perform additional security checks
|
|
96
|
+
*/
|
|
97
|
+
private performAdditionalSecurityChecks;
|
|
98
|
+
/**
|
|
99
|
+
* Determine overall risk level
|
|
100
|
+
*/
|
|
101
|
+
private determineOverallRiskLevel;
|
|
102
|
+
/**
|
|
103
|
+
* Determine security status based on confidence levels
|
|
104
|
+
*/
|
|
105
|
+
private determineSecurityStatus;
|
|
106
|
+
/**
|
|
107
|
+
* Generate security explanation
|
|
108
|
+
*/
|
|
109
|
+
private generateSecurityExplanation;
|
|
110
|
+
/**
|
|
111
|
+
* Calculate confidence level and manual review requirements
|
|
112
|
+
* Detects ambiguous patterns that need human verification
|
|
113
|
+
*/
|
|
114
|
+
private calculateConfidence;
|
|
115
|
+
/**
|
|
116
|
+
* Check if tool is a structured data tool (search, lookup, retrieval)
|
|
117
|
+
* These tools naturally echo input patterns in their results
|
|
118
|
+
*/
|
|
119
|
+
private isStructuredDataTool;
|
|
120
|
+
/**
|
|
121
|
+
* Check if response is just reflection (safe)
|
|
122
|
+
* Expanded to catch more reflection patterns including echo, repeat, display
|
|
123
|
+
* IMPROVED: Bidirectional patterns, safety indicators, and two-layer defense
|
|
124
|
+
*
|
|
125
|
+
* CRITICAL: This check distinguishes between:
|
|
126
|
+
* - SAFE: Tool stores/echoes malicious input as data (reflection)
|
|
127
|
+
* - VULNERABLE: Tool executes malicious input and returns results (execution)
|
|
128
|
+
*
|
|
129
|
+
* Two-layer defense:
|
|
130
|
+
* Layer 1: Match reflection/status patterns
|
|
131
|
+
* Layer 2: Verify NO execution evidence (defense-in-depth)
|
|
132
|
+
*/
|
|
133
|
+
private isReflectionResponse;
|
|
134
|
+
/**
|
|
135
|
+
* Detect execution artifacts in response
|
|
136
|
+
* Returns true if response contains evidence of actual code execution
|
|
137
|
+
*
|
|
138
|
+
* HIGH confidence: System files, commands, directory listings
|
|
139
|
+
* MEDIUM confidence: Contextual patterns (root alone, paths)
|
|
140
|
+
*/
|
|
141
|
+
private detectExecutionArtifacts;
|
|
142
|
+
/**
|
|
143
|
+
* Analyze injection response (existing logic)
|
|
144
|
+
* Note: payload parameter unused after refactoring to two-layer defense
|
|
145
|
+
*/
|
|
146
|
+
private analyzeInjectionResponse;
|
|
147
|
+
/**
|
|
148
|
+
* Extract response content
|
|
149
|
+
*/
|
|
150
|
+
private extractResponseContent;
|
|
151
|
+
/**
|
|
152
|
+
* Check if tool has input parameters
|
|
153
|
+
*/
|
|
154
|
+
private hasInputParameters;
|
|
155
|
+
private createTestParameters;
|
|
156
|
+
/**
|
|
157
|
+
* Check if tool is an API wrapper (safe data-passing tool)
|
|
158
|
+
*/
|
|
159
|
+
private isApiWrapper;
|
|
160
|
+
/**
|
|
161
|
+
* Check if attack is an execution-based test
|
|
162
|
+
* These tests assume the tool executes input as code, which doesn't apply to API wrappers
|
|
163
|
+
*/
|
|
164
|
+
private isExecutionTest;
|
|
165
|
+
/**
|
|
166
|
+
* Check if response is returning search results
|
|
167
|
+
* Search tools return query results as data, not execute them
|
|
168
|
+
*/
|
|
169
|
+
private isSearchResultResponse;
|
|
170
|
+
/**
|
|
171
|
+
* Check if response is from a creation/modification operation
|
|
172
|
+
* CRUD tools create/modify resources, not execute code
|
|
173
|
+
*/
|
|
174
|
+
private isCreationResponse;
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=SecurityAssessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SecurityAssessor.d.ts","sourceRoot":"","sources":["../../../../src/services/assessment/modules/SecurityAssessor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,kBAAkB,EAInB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAS9D,qBAAa,gBAAiB,SAAQ,YAAY;IAC1C,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAuFrE;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAkC7B;;;;OAIG;YACW,yBAAyB;IA+FvC;;;;OAIG;YACW,qBAAqB;IAwGnC;;OAEG;YACW,WAAW;IA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