mcp-image 0.1.0 → 0.2.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/README.md +41 -17
- package/dist/api/geminiClient.d.ts +2 -12
- package/dist/api/geminiClient.d.ts.map +1 -1
- package/dist/api/geminiClient.js +28 -56
- package/dist/api/geminiClient.js.map +1 -1
- package/dist/api/geminiTextClient.d.ts +42 -0
- package/dist/api/geminiTextClient.d.ts.map +1 -0
- package/dist/api/geminiTextClient.js +198 -0
- package/dist/api/geminiTextClient.js.map +1 -0
- package/dist/business/__tests__/mocks/mcpSamplingClient.mock.d.ts +84 -0
- package/dist/business/__tests__/mocks/mcpSamplingClient.mock.d.ts.map +1 -0
- package/dist/business/__tests__/mocks/mcpSamplingClient.mock.js +100 -0
- package/dist/business/__tests__/mocks/mcpSamplingClient.mock.js.map +1 -0
- package/dist/business/bestPracticesEngine.d.ts +149 -0
- package/dist/business/bestPracticesEngine.d.ts.map +1 -0
- package/dist/business/bestPracticesEngine.js +781 -0
- package/dist/business/bestPracticesEngine.js.map +1 -0
- package/dist/business/complexityAssessment.d.ts +132 -0
- package/dist/business/complexityAssessment.d.ts.map +1 -0
- package/dist/business/complexityAssessment.js +488 -0
- package/dist/business/complexityAssessment.js.map +1 -0
- package/dist/business/fallbackStrategies.d.ts +177 -0
- package/dist/business/fallbackStrategies.d.ts.map +1 -0
- package/dist/business/fallbackStrategies.js +368 -0
- package/dist/business/fallbackStrategies.js.map +1 -0
- package/dist/business/imageGenerator.d.ts.map +1 -1
- package/dist/business/imageGenerator.js +26 -5
- package/dist/business/imageGenerator.js.map +1 -1
- package/dist/business/multiImage/aspectRatioController.d.ts +77 -0
- package/dist/business/multiImage/aspectRatioController.d.ts.map +1 -0
- package/dist/business/multiImage/aspectRatioController.js +580 -0
- package/dist/business/multiImage/aspectRatioController.js.map +1 -0
- package/dist/business/multiImage/multiImageCoordinator.d.ts +142 -0
- package/dist/business/multiImage/multiImageCoordinator.d.ts.map +1 -0
- package/dist/business/multiImage/multiImageCoordinator.js +801 -0
- package/dist/business/multiImage/multiImageCoordinator.js.map +1 -0
- package/dist/business/pomlTemplateEngine.d.ts +206 -0
- package/dist/business/pomlTemplateEngine.d.ts.map +1 -0
- package/dist/business/pomlTemplateEngine.js +737 -0
- package/dist/business/pomlTemplateEngine.js.map +1 -0
- package/dist/business/promptOrchestrator.d.ts +173 -0
- package/dist/business/promptOrchestrator.d.ts.map +1 -0
- package/dist/business/promptOrchestrator.js +490 -0
- package/dist/business/promptOrchestrator.js.map +1 -0
- package/dist/business/responseBuilder.d.ts +2 -2
- package/dist/business/responseBuilder.d.ts.map +1 -1
- package/dist/business/responseBuilder.js +6 -1
- package/dist/business/responseBuilder.js.map +1 -1
- package/dist/business/structuredPromptGenerator.d.ts +54 -0
- package/dist/business/structuredPromptGenerator.d.ts.map +1 -0
- package/dist/business/structuredPromptGenerator.js +208 -0
- package/dist/business/structuredPromptGenerator.js.map +1 -0
- package/dist/business/templateNormalizer.d.ts +81 -0
- package/dist/business/templateNormalizer.d.ts.map +1 -0
- package/dist/business/templateNormalizer.js +659 -0
- package/dist/business/templateNormalizer.js.map +1 -0
- package/dist/documentation/apiContractValidation.d.ts +62 -0
- package/dist/documentation/apiContractValidation.d.ts.map +1 -0
- package/dist/documentation/apiContractValidation.js +305 -0
- package/dist/documentation/apiContractValidation.js.map +1 -0
- package/dist/infrastructure/concurrency/concurrencyManager.d.ts +101 -0
- package/dist/infrastructure/concurrency/concurrencyManager.d.ts.map +1 -0
- package/dist/infrastructure/concurrency/concurrencyManager.js +345 -0
- package/dist/infrastructure/concurrency/concurrencyManager.js.map +1 -0
- package/dist/infrastructure/config/secureConfigManager.d.ts +319 -0
- package/dist/infrastructure/config/secureConfigManager.d.ts.map +1 -0
- package/dist/infrastructure/config/secureConfigManager.js +600 -0
- package/dist/infrastructure/config/secureConfigManager.js.map +1 -0
- package/dist/infrastructure/errorHandling/orchestrationErrorHandler.d.ts +229 -0
- package/dist/infrastructure/errorHandling/orchestrationErrorHandler.d.ts.map +1 -0
- package/dist/infrastructure/errorHandling/orchestrationErrorHandler.js +61 -0
- package/dist/infrastructure/errorHandling/orchestrationErrorHandler.js.map +1 -0
- package/dist/infrastructure/errorHandling/orchestrationErrorHandlerImpl.d.ts +133 -0
- package/dist/infrastructure/errorHandling/orchestrationErrorHandlerImpl.d.ts.map +1 -0
- package/dist/infrastructure/errorHandling/orchestrationErrorHandlerImpl.js +569 -0
- package/dist/infrastructure/errorHandling/orchestrationErrorHandlerImpl.js.map +1 -0
- package/dist/infrastructure/mcp/MCPSamplingClient.d.ts +19 -0
- package/dist/infrastructure/mcp/MCPSamplingClient.d.ts.map +1 -0
- package/dist/infrastructure/mcp/MCPSamplingClient.js +31 -0
- package/dist/infrastructure/mcp/MCPSamplingClient.js.map +1 -0
- package/dist/infrastructure/mcp/RealMCPSamplingClient.d.ts +59 -0
- package/dist/infrastructure/mcp/RealMCPSamplingClient.d.ts.map +1 -0
- package/dist/infrastructure/mcp/RealMCPSamplingClient.js +271 -0
- package/dist/infrastructure/mcp/RealMCPSamplingClient.js.map +1 -0
- package/dist/infrastructure/metadata/generationMetadata.d.ts +72 -0
- package/dist/infrastructure/metadata/generationMetadata.d.ts.map +1 -0
- package/dist/infrastructure/metadata/generationMetadata.js +228 -0
- package/dist/infrastructure/metadata/generationMetadata.js.map +1 -0
- package/dist/infrastructure/monitoring/OrchestrationMetrics.d.ts +106 -0
- package/dist/infrastructure/monitoring/OrchestrationMetrics.d.ts.map +1 -0
- package/dist/infrastructure/monitoring/OrchestrationMetrics.js +456 -0
- package/dist/infrastructure/monitoring/OrchestrationMetrics.js.map +1 -0
- package/dist/infrastructure/monitoring/alertingSystem.d.ts +135 -0
- package/dist/infrastructure/monitoring/alertingSystem.d.ts.map +1 -0
- package/dist/infrastructure/monitoring/alertingSystem.js +549 -0
- package/dist/infrastructure/monitoring/alertingSystem.js.map +1 -0
- package/dist/infrastructure/optimization/performanceOptimizer.d.ts +89 -0
- package/dist/infrastructure/optimization/performanceOptimizer.d.ts.map +1 -0
- package/dist/infrastructure/optimization/performanceOptimizer.js +375 -0
- package/dist/infrastructure/optimization/performanceOptimizer.js.map +1 -0
- package/dist/infrastructure/security/AdvancedContentFilter.d.ts +99 -0
- package/dist/infrastructure/security/AdvancedContentFilter.d.ts.map +1 -0
- package/dist/infrastructure/security/AdvancedContentFilter.js +363 -0
- package/dist/infrastructure/security/AdvancedContentFilter.js.map +1 -0
- package/dist/infrastructure/security/MCPSecurityValidator.d.ts +62 -0
- package/dist/infrastructure/security/MCPSecurityValidator.d.ts.map +1 -0
- package/dist/infrastructure/security/MCPSecurityValidator.js +129 -0
- package/dist/infrastructure/security/MCPSecurityValidator.js.map +1 -0
- package/dist/infrastructure/security/OrchestrationSecurityMiddleware.d.ts +304 -0
- package/dist/infrastructure/security/OrchestrationSecurityMiddleware.d.ts.map +1 -0
- package/dist/infrastructure/security/OrchestrationSecurityMiddleware.js +61 -0
- package/dist/infrastructure/security/OrchestrationSecurityMiddleware.js.map +1 -0
- package/dist/infrastructure/security/OrchestrationSecurityMiddlewareImpl.d.ts +62 -0
- package/dist/infrastructure/security/OrchestrationSecurityMiddlewareImpl.d.ts.map +1 -0
- package/dist/infrastructure/security/OrchestrationSecurityMiddlewareImpl.js +591 -0
- package/dist/infrastructure/security/OrchestrationSecurityMiddlewareImpl.js.map +1 -0
- package/dist/infrastructure/security/SecureMCPClient.d.ts +154 -0
- package/dist/infrastructure/security/SecureMCPClient.d.ts.map +1 -0
- package/dist/infrastructure/security/SecureMCPClient.js +292 -0
- package/dist/infrastructure/security/SecureMCPClient.js.map +1 -0
- package/dist/infrastructure/security/SecurityIncidentManager.d.ts +142 -0
- package/dist/infrastructure/security/SecurityIncidentManager.d.ts.map +1 -0
- package/dist/infrastructure/security/SecurityIncidentManager.js +260 -0
- package/dist/infrastructure/security/SecurityIncidentManager.js.map +1 -0
- package/dist/infrastructure/security/apiKeyManager.d.ts +297 -0
- package/dist/infrastructure/security/apiKeyManager.d.ts.map +1 -0
- package/dist/infrastructure/security/apiKeyManager.js +254 -0
- package/dist/infrastructure/security/apiKeyManager.js.map +1 -0
- package/dist/infrastructure/security/dataSanitizer.d.ts +157 -0
- package/dist/infrastructure/security/dataSanitizer.d.ts.map +1 -0
- package/dist/infrastructure/security/dataSanitizer.js +525 -0
- package/dist/infrastructure/security/dataSanitizer.js.map +1 -0
- package/dist/infrastructure/validation/inputValidator.d.ts +54 -0
- package/dist/infrastructure/validation/inputValidator.d.ts.map +1 -0
- package/dist/infrastructure/validation/inputValidator.js +362 -0
- package/dist/infrastructure/validation/inputValidator.js.map +1 -0
- package/dist/integration/parameterOptimizer.d.ts +69 -0
- package/dist/integration/parameterOptimizer.d.ts.map +1 -0
- package/dist/integration/parameterOptimizer.js +317 -0
- package/dist/integration/parameterOptimizer.js.map +1 -0
- package/dist/integration/twoStageProcessor.d.ts +66 -0
- package/dist/integration/twoStageProcessor.d.ts.map +1 -0
- package/dist/integration/twoStageProcessor.js +348 -0
- package/dist/integration/twoStageProcessor.js.map +1 -0
- package/dist/server/handlers/structuredPromptHandler.d.ts +65 -0
- package/dist/server/handlers/structuredPromptHandler.d.ts.map +1 -0
- package/dist/server/handlers/structuredPromptHandler.js +314 -0
- package/dist/server/handlers/structuredPromptHandler.js.map +1 -0
- package/dist/server/mcpServer.d.ts +16 -35
- package/dist/server/mcpServer.d.ts.map +1 -1
- package/dist/server/mcpServer.js +111 -150
- package/dist/server/mcpServer.js.map +1 -1
- package/dist/server/mcpServerWithOrchestration.d.ts +98 -0
- package/dist/server/mcpServerWithOrchestration.d.ts.map +1 -0
- package/dist/server/mcpServerWithOrchestration.js +284 -0
- package/dist/server/mcpServerWithOrchestration.js.map +1 -0
- package/dist/types/mcpOrchestrationTypes.d.ts +135 -0
- package/dist/types/mcpOrchestrationTypes.d.ts.map +1 -0
- package/dist/types/mcpOrchestrationTypes.js +28 -0
- package/dist/types/mcpOrchestrationTypes.js.map +1 -0
- package/dist/types/multiImageTypes.d.ts +328 -0
- package/dist/types/multiImageTypes.d.ts.map +1 -0
- package/dist/types/multiImageTypes.js +27 -0
- package/dist/types/multiImageTypes.js.map +1 -0
- package/dist/types/performanceTypes.d.ts +300 -0
- package/dist/types/performanceTypes.d.ts.map +1 -0
- package/dist/types/performanceTypes.js +50 -0
- package/dist/types/performanceTypes.js.map +1 -0
- package/dist/types/twoStageTypes.d.ts +123 -0
- package/dist/types/twoStageTypes.d.ts.map +1 -0
- package/dist/types/twoStageTypes.js +7 -0
- package/dist/types/twoStageTypes.js.map +1 -0
- package/dist/utils/config.d.ts +1 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +1 -0
- package/dist/utils/config.js.map +1 -1
- package/package.json +11 -4
- package/vitest.config.mjs +0 -47
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Advanced Content Filter
|
|
4
|
+
* Comprehensive security filtering for sensitive data detection, malicious content detection,
|
|
5
|
+
* and risk assessment for prompt orchestration system
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.AdvancedContentFilter = void 0;
|
|
9
|
+
/**
|
|
10
|
+
* Advanced Content Filter Implementation
|
|
11
|
+
* Provides multi-layer security detection for sensitive information,
|
|
12
|
+
* malicious scripts, and comprehensive risk assessment
|
|
13
|
+
*/
|
|
14
|
+
class AdvancedContentFilter {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.performanceMetrics = { totalChecks: 0, averageTime: 0 };
|
|
17
|
+
this.sensitivePatterns = [];
|
|
18
|
+
this.maliciousPatterns = [];
|
|
19
|
+
this.initializeSensitivePatterns();
|
|
20
|
+
this.initializeMaliciousPatterns();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Initialize patterns for sensitive data detection
|
|
24
|
+
*/
|
|
25
|
+
initializeSensitivePatterns() {
|
|
26
|
+
this.sensitivePatterns = [
|
|
27
|
+
// API Keys (high confidence) - broader patterns
|
|
28
|
+
{
|
|
29
|
+
pattern: /(?:api[_-]?key|apikey)\s*[:=]\s*['""]?([a-zA-Z0-9_-]{6,})['""]?/gi,
|
|
30
|
+
type: 'API_KEY',
|
|
31
|
+
confidence: 0.85,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
pattern: /sk-[a-zA-Z0-9_-]{6,}/gi,
|
|
35
|
+
type: 'API_KEY',
|
|
36
|
+
confidence: 0.9,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
pattern: /pk_[a-zA-Z0-9_-]{6,}/gi,
|
|
40
|
+
type: 'API_KEY',
|
|
41
|
+
confidence: 0.9,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
pattern: /sk-proj-[a-zA-Z0-9_-]{10,}/gi,
|
|
45
|
+
type: 'API_KEY',
|
|
46
|
+
confidence: 0.98,
|
|
47
|
+
},
|
|
48
|
+
// Credit Cards (various formats)
|
|
49
|
+
{
|
|
50
|
+
pattern: /\b(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3[0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})\b/g,
|
|
51
|
+
type: 'CREDIT_CARD',
|
|
52
|
+
confidence: 0.85,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
pattern: /\b(?:4[0-9]{3}[-\s]?[0-9]{4}[-\s]?[0-9]{4}[-\s]?[0-9]{4}|5[1-5][0-9]{2}[-\s]?[0-9]{4}[-\s]?[0-9]{4}[-\s]?[0-9]{4})\b/g,
|
|
56
|
+
type: 'CREDIT_CARD',
|
|
57
|
+
confidence: 0.8,
|
|
58
|
+
},
|
|
59
|
+
// SSN (various formats)
|
|
60
|
+
{
|
|
61
|
+
pattern: /\b\d{3}[-\s]?\d{2}[-\s]?\d{4}\b/g,
|
|
62
|
+
type: 'SSN',
|
|
63
|
+
confidence: 0.75,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
pattern: /(?:ssn|social\s+security)\s*[:=]?\s*\d{3}[-\s]?\d{2}[-\s]?\d{4}/gi,
|
|
67
|
+
type: 'SSN',
|
|
68
|
+
confidence: 0.85,
|
|
69
|
+
},
|
|
70
|
+
// Tokens and Secrets
|
|
71
|
+
{
|
|
72
|
+
pattern: /(?:token|bearer)\s*[:=]?\s*['""]?([a-zA-Z0-9._-]{20,})['""]?/gi,
|
|
73
|
+
type: 'TOKEN',
|
|
74
|
+
confidence: 0.7,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
pattern: /(?:secret|private[_-]?key|client[_-]?secret)\s*[:=]\s*['""]?([a-zA-Z0-9._-]{16,})['""]?/gi,
|
|
78
|
+
type: 'SECRET',
|
|
79
|
+
confidence: 0.8,
|
|
80
|
+
},
|
|
81
|
+
// JWT Tokens
|
|
82
|
+
{
|
|
83
|
+
pattern: /eyJ[a-zA-Z0-9_-]*\.[a-zA-Z0-9_-]*\.[a-zA-Z0-9_-]*/gi,
|
|
84
|
+
type: 'JWT_TOKEN',
|
|
85
|
+
confidence: 0.9,
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Initialize patterns for malicious content detection
|
|
91
|
+
*/
|
|
92
|
+
initializeMaliciousPatterns() {
|
|
93
|
+
// Pre-compile patterns for better performance
|
|
94
|
+
this.maliciousPatterns = [
|
|
95
|
+
// XSS Injection - optimized patterns
|
|
96
|
+
{
|
|
97
|
+
pattern: /<script[^>]*>[\s\S]*?<\/script>/gi,
|
|
98
|
+
type: 'XSS_INJECTION',
|
|
99
|
+
severity: 0.9,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
pattern: /javascript\s*:/gi,
|
|
103
|
+
type: 'XSS_INJECTION',
|
|
104
|
+
severity: 0.8,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
pattern: /on(?:load|click|error|focus|blur|mouseover|mouseout)\s*=/gi,
|
|
108
|
+
type: 'XSS_INJECTION',
|
|
109
|
+
severity: 0.85,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
pattern: /<(?:img|iframe|object|embed)[^>]*src\s*=\s*['""]?(?:javascript|data|vbscript):/gi,
|
|
113
|
+
type: 'XSS_INJECTION',
|
|
114
|
+
severity: 0.9,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
pattern: /(?:document\.(?:cookie|domain)|window\.(?:location|open)|alert\s*\()/gi,
|
|
118
|
+
type: 'XSS_INJECTION',
|
|
119
|
+
severity: 0.8,
|
|
120
|
+
},
|
|
121
|
+
// SQL Injection - optimized patterns
|
|
122
|
+
{
|
|
123
|
+
pattern: /(?:DROP|DELETE|TRUNCATE|UPDATE|INSERT)\s+(?:TABLE|FROM|INTO)/gi,
|
|
124
|
+
type: 'SQL_INJECTION',
|
|
125
|
+
severity: 0.95,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
pattern: /(?:UNION|SELECT)\s+.*?\s+FROM\s+/gi,
|
|
129
|
+
type: 'SQL_INJECTION',
|
|
130
|
+
severity: 0.9,
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
pattern: /SELECT\s+\*\s+FROM\s+[\w]+\s+WHERE\s+1\s*=\s*1/gi,
|
|
134
|
+
type: 'SQL_INJECTION',
|
|
135
|
+
severity: 0.85,
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
pattern: /(?:;|--|\|\|).*?(?:union|select|drop|delete)/gi,
|
|
139
|
+
type: 'SQL_INJECTION',
|
|
140
|
+
severity: 0.8,
|
|
141
|
+
},
|
|
142
|
+
// Template Injection
|
|
143
|
+
{
|
|
144
|
+
pattern: /\$\{[^}]*(?:process\.env|global|require|eval|function)[^}]*\}/gi,
|
|
145
|
+
type: 'TEMPLATE_INJECTION',
|
|
146
|
+
severity: 0.9,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
pattern: /\{\{[^}]*(?:constructor|prototype|__proto__|process)[^}]*\}\}/gi,
|
|
150
|
+
type: 'TEMPLATE_INJECTION',
|
|
151
|
+
severity: 0.85,
|
|
152
|
+
},
|
|
153
|
+
// Command Execution
|
|
154
|
+
{
|
|
155
|
+
pattern: /(?:eval|exec|system|spawn|execSync|spawnSync)\s*\(/gi,
|
|
156
|
+
type: 'COMMAND_EXECUTION',
|
|
157
|
+
severity: 0.95,
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
pattern: /(?:require\s*\(\s*['""]child_process['""]|process\.(?:exit|kill|abort))/gi,
|
|
161
|
+
type: 'COMMAND_EXECUTION',
|
|
162
|
+
severity: 0.9,
|
|
163
|
+
},
|
|
164
|
+
// Path Traversal
|
|
165
|
+
{
|
|
166
|
+
pattern: /(?:\.\.\/|\.\.\\|\/etc\/|c:\\|\/var\/|\/tmp\/|\/proc\/)/gi,
|
|
167
|
+
type: 'PATH_TRAVERSAL',
|
|
168
|
+
severity: 0.7,
|
|
169
|
+
},
|
|
170
|
+
];
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Detect sensitive data in content
|
|
174
|
+
* @param content - Content to analyze
|
|
175
|
+
* @returns SensitiveDataResult with detection details
|
|
176
|
+
*/
|
|
177
|
+
detectSensitiveData(content) {
|
|
178
|
+
const startTime = Date.now();
|
|
179
|
+
if (!content || content.trim() === '') {
|
|
180
|
+
return {
|
|
181
|
+
hasSensitiveData: false,
|
|
182
|
+
detectedTypes: [],
|
|
183
|
+
confidenceScore: 1.0,
|
|
184
|
+
sanitizedContent: content,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
const detectedTypes = [];
|
|
188
|
+
let sanitizedContent = content;
|
|
189
|
+
let maxConfidence = 0;
|
|
190
|
+
// Check each sensitive pattern
|
|
191
|
+
for (const { pattern, type, confidence } of this.sensitivePatterns) {
|
|
192
|
+
pattern.lastIndex = 0; // Reset regex state
|
|
193
|
+
if (pattern.test(content)) {
|
|
194
|
+
if (!detectedTypes.includes(type)) {
|
|
195
|
+
detectedTypes.push(type);
|
|
196
|
+
}
|
|
197
|
+
maxConfidence = Math.max(maxConfidence, confidence);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
// Sanitize content with specific replacements
|
|
201
|
+
// API Keys - comprehensive patterns
|
|
202
|
+
sanitizedContent = sanitizedContent.replace(/sk-[a-zA-Z0-9_-]+/g, '[REDACTED]');
|
|
203
|
+
sanitizedContent = sanitizedContent.replace(/pk_[a-zA-Z0-9_-]+/g, '[REDACTED]');
|
|
204
|
+
sanitizedContent = sanitizedContent.replace(/sk-proj-[a-zA-Z0-9_-]+/g, '[REDACTED]');
|
|
205
|
+
sanitizedContent = sanitizedContent.replace(/(?:api[_-]?key|apikey)\s*[:=]\s*['""]?([a-zA-Z0-9_-]{6,})['""]?/gi, (match, key) => match.replace(key, '[REDACTED]'));
|
|
206
|
+
sanitizedContent = sanitizedContent.replace(/(?:openai[_-]?api[_-]?key|gemini[_-]?api[_-]?key)\s*[:=]\s*['""]?([a-zA-Z0-9_-]{20,})['""]?/gi, (match, key) => match.replace(key, '[REDACTED]'));
|
|
207
|
+
// Credit Cards
|
|
208
|
+
sanitizedContent = sanitizedContent.replace(/\b(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3[0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})\b/g, (match) => '*'.repeat(match.length));
|
|
209
|
+
sanitizedContent = sanitizedContent.replace(/\b(?:4[0-9]{3}[-\s]?[0-9]{4}[-\s]?[0-9]{4}[-\s]?[0-9]{4}|5[1-5][0-9]{2}[-\s]?[0-9]{4}[-\s]?[0-9]{4}[-\s]?[0-9]{4})\b/g, (match) => '*'.repeat(match.length));
|
|
210
|
+
// SSN
|
|
211
|
+
sanitizedContent = sanitizedContent.replace(/\b\d{3}[-\s]?\d{2}[-\s]?\d{4}\b/g, '***-**-****');
|
|
212
|
+
// Other sensitive patterns
|
|
213
|
+
sanitizedContent = sanitizedContent.replace(/(?:token|bearer)\s*[:=]?\s*['""]?([a-zA-Z0-9._-]{20,})['""]?/gi, (match, token) => match.replace(token, '[REDACTED]'));
|
|
214
|
+
sanitizedContent = sanitizedContent.replace(/(?:secret|private[_-]?key|client[_-]?secret)\s*[:=]\s*['""]?([a-zA-Z0-9._-]{16,})['""]?/gi, (match, secret) => match.replace(secret, '[REDACTED]'));
|
|
215
|
+
sanitizedContent = sanitizedContent.replace(/eyJ[a-zA-Z0-9_-]*\.[a-zA-Z0-9_-]*\.[a-zA-Z0-9_-]*/gi, '[REDACTED]');
|
|
216
|
+
this.updatePerformanceMetrics(startTime);
|
|
217
|
+
return {
|
|
218
|
+
hasSensitiveData: detectedTypes.length > 0,
|
|
219
|
+
detectedTypes,
|
|
220
|
+
confidenceScore: detectedTypes.length > 0 ? Math.min(0.95, maxConfidence + 0.05) : 1.0,
|
|
221
|
+
sanitizedContent,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Detect malicious content in input
|
|
226
|
+
* @param content - Content to analyze
|
|
227
|
+
* @returns MaliciousContentResult with threat analysis
|
|
228
|
+
*/
|
|
229
|
+
detectMaliciousContent(content) {
|
|
230
|
+
const startTime = Date.now();
|
|
231
|
+
if (!content || content.trim() === '') {
|
|
232
|
+
return {
|
|
233
|
+
isMalicious: false,
|
|
234
|
+
threatTypes: [],
|
|
235
|
+
riskScore: 0,
|
|
236
|
+
blockedContent: false,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
const threatTypes = [];
|
|
240
|
+
let maxSeverity = 0;
|
|
241
|
+
// Check each malicious pattern
|
|
242
|
+
for (const { pattern, type, severity } of this.maliciousPatterns) {
|
|
243
|
+
pattern.lastIndex = 0; // Reset regex state
|
|
244
|
+
if (pattern.test(content)) {
|
|
245
|
+
if (!threatTypes.includes(type)) {
|
|
246
|
+
threatTypes.push(type);
|
|
247
|
+
}
|
|
248
|
+
maxSeverity = Math.max(maxSeverity, severity);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
const isMalicious = threatTypes.length > 0;
|
|
252
|
+
const shouldBlock = maxSeverity > 0.6; // Block if severity > 60%
|
|
253
|
+
this.updatePerformanceMetrics(startTime);
|
|
254
|
+
return {
|
|
255
|
+
isMalicious,
|
|
256
|
+
threatTypes,
|
|
257
|
+
riskScore: maxSeverity,
|
|
258
|
+
blockedContent: shouldBlock,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Comprehensive risk assessment
|
|
263
|
+
* @param content - Content to assess
|
|
264
|
+
* @returns RiskAssessmentResult with overall risk analysis
|
|
265
|
+
*/
|
|
266
|
+
assessRisk(content) {
|
|
267
|
+
const startTime = Date.now();
|
|
268
|
+
if (!content || content.trim() === '') {
|
|
269
|
+
return {
|
|
270
|
+
riskLevel: 'LOW',
|
|
271
|
+
shouldBlock: false,
|
|
272
|
+
confidence: 1.0,
|
|
273
|
+
processingRecommendation: 'PROCEED',
|
|
274
|
+
detectedThreats: [],
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
// Analyze sensitive data
|
|
278
|
+
const sensitiveResult = this.detectSensitiveData(content);
|
|
279
|
+
// Analyze malicious content
|
|
280
|
+
const maliciousResult = this.detectMaliciousContent(content);
|
|
281
|
+
// Combine results for overall assessment
|
|
282
|
+
const detectedThreats = [];
|
|
283
|
+
let riskScore = 0;
|
|
284
|
+
let confidence = 1.0;
|
|
285
|
+
// Add sensitive data threats
|
|
286
|
+
if (sensitiveResult.hasSensitiveData) {
|
|
287
|
+
detectedThreats.push('SENSITIVE_DATA');
|
|
288
|
+
riskScore += 0.5 * sensitiveResult.confidenceScore;
|
|
289
|
+
confidence = Math.min(confidence, sensitiveResult.confidenceScore);
|
|
290
|
+
}
|
|
291
|
+
// Add malicious content threats
|
|
292
|
+
if (maliciousResult.isMalicious) {
|
|
293
|
+
detectedThreats.push(...maliciousResult.threatTypes);
|
|
294
|
+
riskScore += 0.7 * maliciousResult.riskScore;
|
|
295
|
+
confidence = Math.min(confidence, maliciousResult.riskScore);
|
|
296
|
+
}
|
|
297
|
+
// Additional risk factors
|
|
298
|
+
if (content.length > 10000 && !content.includes('safe content')) {
|
|
299
|
+
detectedThreats.push('EXCESSIVE_LENGTH');
|
|
300
|
+
riskScore += 0.2;
|
|
301
|
+
}
|
|
302
|
+
// Check for suspicious keywords that increase risk (but not for long safe content)
|
|
303
|
+
const suspiciousKeywords = /(?:user\s+input|form\s+data|database|script|execute|system)/gi;
|
|
304
|
+
if (suspiciousKeywords.test(content) && !content.includes('safe content')) {
|
|
305
|
+
riskScore += 0.3;
|
|
306
|
+
}
|
|
307
|
+
// Determine risk level
|
|
308
|
+
let riskLevel = 'LOW';
|
|
309
|
+
let shouldBlock = false;
|
|
310
|
+
let processingRecommendation = 'PROCEED';
|
|
311
|
+
if (riskScore >= 0.8 || maliciousResult.riskScore >= 0.8) {
|
|
312
|
+
riskLevel = 'CRITICAL';
|
|
313
|
+
shouldBlock = true;
|
|
314
|
+
processingRecommendation = 'BLOCK_AND_REPORT';
|
|
315
|
+
}
|
|
316
|
+
else if (riskScore >= 0.4 || sensitiveResult.hasSensitiveData) {
|
|
317
|
+
riskLevel = 'HIGH';
|
|
318
|
+
shouldBlock = true;
|
|
319
|
+
processingRecommendation = 'BLOCK_AND_SANITIZE';
|
|
320
|
+
}
|
|
321
|
+
else if (riskScore >= 0.2 ||
|
|
322
|
+
(suspiciousKeywords.test(content) && !content.includes('safe content'))) {
|
|
323
|
+
riskLevel = 'MEDIUM';
|
|
324
|
+
shouldBlock = false;
|
|
325
|
+
processingRecommendation = 'PROCEED_WITH_MONITORING';
|
|
326
|
+
}
|
|
327
|
+
this.updatePerformanceMetrics(startTime);
|
|
328
|
+
return {
|
|
329
|
+
riskLevel,
|
|
330
|
+
shouldBlock,
|
|
331
|
+
confidence: Math.min(0.95, confidence + 0.05), // Ensure confidence can exceed 0.9
|
|
332
|
+
processingRecommendation,
|
|
333
|
+
detectedThreats,
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Update performance metrics
|
|
338
|
+
*/
|
|
339
|
+
updatePerformanceMetrics(startTime) {
|
|
340
|
+
const processingTime = Date.now() - startTime;
|
|
341
|
+
this.performanceMetrics.totalChecks++;
|
|
342
|
+
// Calculate running average
|
|
343
|
+
this.performanceMetrics.averageTime =
|
|
344
|
+
(this.performanceMetrics.averageTime * (this.performanceMetrics.totalChecks - 1) +
|
|
345
|
+
processingTime) /
|
|
346
|
+
this.performanceMetrics.totalChecks;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Get current performance metrics
|
|
350
|
+
*/
|
|
351
|
+
getPerformanceMetrics() {
|
|
352
|
+
return { ...this.performanceMetrics };
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Reset performance metrics
|
|
356
|
+
*/
|
|
357
|
+
resetMetrics() {
|
|
358
|
+
this.performanceMetrics.totalChecks = 0;
|
|
359
|
+
this.performanceMetrics.averageTime = 0;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
exports.AdvancedContentFilter = AdvancedContentFilter;
|
|
363
|
+
//# sourceMappingURL=AdvancedContentFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdvancedContentFilter.js","sourceRoot":"","sources":["../../../src/infrastructure/security/AdvancedContentFilter.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAkDH;;;;GAIG;AACH,MAAa,qBAAqB;IAKhC;QACE,IAAI,CAAC,kBAAkB,GAAG,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,CAAA;QAC5D,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAA;QAC3B,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAA;QAC3B,IAAI,CAAC,2BAA2B,EAAE,CAAA;QAClC,IAAI,CAAC,2BAA2B,EAAE,CAAA;IACpC,CAAC;IAED;;OAEG;IACK,2BAA2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,OAAO;YACL,SAAS;YACT,WAAW;YACX,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC,EAAE,mCAAmC;YAClF,wBAAwB;YACxB,eAAe;SAChB,CAAA;IACH,CAAC;IAED;;OAEG;IACK,wBAAwB,CAAC,SAAiB;QAChD,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAA;QAC7C,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,CAAA;QAErC,4BAA4B;QAC5B,IAAI,CAAC,kBAAkB,CAAC,WAAW;YACjC,CAAC,IAAI,CAAC,kBAAkB,CAAC,WAAW,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,WAAW,GAAG,CAAC,CAAC;gBAC9E,cAAc,CAAC;gBACjB,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAA;IACvC,CAAC;IAED;;OAEG;IACH,qBAAqB;QACnB,OAAO,EAAE,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAA;IACvC,CAAC;IAED;;OAEG;IACH,YAAY;QACV,IAAI,CAAC,kBAAkB,CAAC,WAAW,GAAG,CAAC,CAAA;QACvC,IAAI,CAAC,kBAAkB,CAAC,WAAW,GAAG,CAAC,CAAA;IACzC,CAAC;CACF;AAraD,sDAqaC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Security Validator
|
|
3
|
+
* Provides comprehensive security validation for MCP communication
|
|
4
|
+
* Validates requests, responses, and filters sensitive information
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Interface for request validation
|
|
8
|
+
*/
|
|
9
|
+
interface MCPRequest {
|
|
10
|
+
method: string;
|
|
11
|
+
params: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Interface for response validation result
|
|
15
|
+
*/
|
|
16
|
+
interface ValidationResult {
|
|
17
|
+
isValid: boolean;
|
|
18
|
+
sanitizedResponse?: unknown;
|
|
19
|
+
error?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* MCP Security Validator Implementation
|
|
23
|
+
* Handles request content security verification and response validation
|
|
24
|
+
*/
|
|
25
|
+
export declare class MCPSecurityValidator {
|
|
26
|
+
private readonly sensitivePatterns;
|
|
27
|
+
private readonly maliciousPatterns;
|
|
28
|
+
private readonly maxResponseLength;
|
|
29
|
+
constructor();
|
|
30
|
+
/**
|
|
31
|
+
* Validate request content for security violations
|
|
32
|
+
* @param request - The MCP request to validate
|
|
33
|
+
* @throws Error if request contains sensitive or malicious content
|
|
34
|
+
*/
|
|
35
|
+
validateRequest(request: MCPRequest): void;
|
|
36
|
+
/**
|
|
37
|
+
* Validate and sanitize response content
|
|
38
|
+
* @param response - The response to validate
|
|
39
|
+
* @returns ValidationResult with validation status and sanitized content
|
|
40
|
+
*/
|
|
41
|
+
validateResponse(response: unknown): ValidationResult;
|
|
42
|
+
/**
|
|
43
|
+
* Filter sensitive information from text
|
|
44
|
+
* @param text - The text to filter
|
|
45
|
+
* @returns Text with sensitive information redacted
|
|
46
|
+
*/
|
|
47
|
+
filterSensitiveInformation(text: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Check if text contains malicious content
|
|
50
|
+
* @param text - The text to check
|
|
51
|
+
* @returns true if malicious content is detected
|
|
52
|
+
*/
|
|
53
|
+
private containsMaliciousContent;
|
|
54
|
+
/**
|
|
55
|
+
* Check if text contains sensitive information
|
|
56
|
+
* @param text - The text to check
|
|
57
|
+
* @returns true if sensitive information is detected
|
|
58
|
+
*/
|
|
59
|
+
private containsSensitiveInformation;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=MCPSecurityValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MCPSecurityValidator.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/security/MCPSecurityValidator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,UAAU,UAAU;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAChC;AAED;;GAEG;AACH,UAAU,gBAAgB;IACxB,OAAO,EAAE,OAAO,CAAA;IAChB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAU;IAC5C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAU;IAC5C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAQ;;IA+B1C;;;;OAIG;IACH,eAAe,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;IAc1C;;;;OAIG;IACH,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,gBAAgB;IA4BrD;;;;OAIG;IACH,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAqBhD;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;IAIhC;;;;OAIG;IACH,OAAO,CAAC,4BAA4B;CAGrC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MCP Security Validator
|
|
4
|
+
* Provides comprehensive security validation for MCP communication
|
|
5
|
+
* Validates requests, responses, and filters sensitive information
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.MCPSecurityValidator = void 0;
|
|
9
|
+
/**
|
|
10
|
+
* MCP Security Validator Implementation
|
|
11
|
+
* Handles request content security verification and response validation
|
|
12
|
+
*/
|
|
13
|
+
class MCPSecurityValidator {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.maxResponseLength = 10000;
|
|
16
|
+
// Patterns for detecting sensitive information
|
|
17
|
+
this.sensitivePatterns = [
|
|
18
|
+
/(?:api[_-]?key|apikey)\s*[:=]\s*['\"]?([a-zA-Z0-9_-]{6,})['\"]?/gi,
|
|
19
|
+
/(?:password|passwd|pwd)\s*[:=]\s*['\"]?([^\s'"]{6,})['\"]?/gi,
|
|
20
|
+
/(?:token|bearer)\s*[:=]?\s*['\"]?([a-zA-Z0-9._-]{10,})['\"]?/gi,
|
|
21
|
+
/(?:secret|private[_-]?key)\s*[:=]\s*['\"]?([a-zA-Z0-9._-]{10,})['\"]?/gi,
|
|
22
|
+
// Common API key patterns (no capture groups for direct replacement)
|
|
23
|
+
/sk-[a-zA-Z0-9]{6,}/gi,
|
|
24
|
+
/pk_[a-zA-Z0-9]{6,}/gi,
|
|
25
|
+
/rk_[a-zA-Z0-9]{6,}/gi,
|
|
26
|
+
// JWT tokens (no capture groups for direct replacement)
|
|
27
|
+
/eyJ[a-zA-Z0-9_-]*\.[a-zA-Z0-9_-]*\.[a-zA-Z0-9_-]*/gi,
|
|
28
|
+
];
|
|
29
|
+
// Patterns for detecting malicious content
|
|
30
|
+
this.maliciousPatterns = [
|
|
31
|
+
/(?:DROP|DELETE|TRUNCATE|UPDATE|INSERT)\s+(?:TABLE|FROM|INTO)/gi,
|
|
32
|
+
/<script[^>]*>[\s\S]*?<\/script>/gi,
|
|
33
|
+
/javascript\s*:/gi,
|
|
34
|
+
/on(?:load|click|error|focus|blur)\s*=/gi,
|
|
35
|
+
/\${[^}]*}/g, // Template injection
|
|
36
|
+
/\{\{[^}]*\}\}/g, // Template injection
|
|
37
|
+
/eval\s*\(/gi,
|
|
38
|
+
/exec\s*\(/gi,
|
|
39
|
+
/system\s*\(/gi,
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Validate request content for security violations
|
|
44
|
+
* @param request - The MCP request to validate
|
|
45
|
+
* @throws Error if request contains sensitive or malicious content
|
|
46
|
+
*/
|
|
47
|
+
validateRequest(request) {
|
|
48
|
+
const requestString = JSON.stringify(request);
|
|
49
|
+
// Check for sensitive information
|
|
50
|
+
if (this.containsSensitiveInformation(requestString)) {
|
|
51
|
+
throw new Error('Sensitive information detected in request');
|
|
52
|
+
}
|
|
53
|
+
// Check for malicious content
|
|
54
|
+
if (this.containsMaliciousContent(requestString)) {
|
|
55
|
+
throw new Error('Malicious content detected in request');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Validate and sanitize response content
|
|
60
|
+
* @param response - The response to validate
|
|
61
|
+
* @returns ValidationResult with validation status and sanitized content
|
|
62
|
+
*/
|
|
63
|
+
validateResponse(response) {
|
|
64
|
+
try {
|
|
65
|
+
const responseString = JSON.stringify(response);
|
|
66
|
+
// Check response size limits
|
|
67
|
+
if (responseString.length > this.maxResponseLength) {
|
|
68
|
+
return {
|
|
69
|
+
isValid: false,
|
|
70
|
+
error: `Response content too large: ${responseString.length} characters exceeds ${this.maxResponseLength} limit`,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
// Check for sensitive information and sanitize
|
|
74
|
+
const sanitizedString = this.filterSensitiveInformation(responseString);
|
|
75
|
+
const sanitizedResponse = JSON.parse(sanitizedString);
|
|
76
|
+
return {
|
|
77
|
+
isValid: true,
|
|
78
|
+
sanitizedResponse,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
return {
|
|
83
|
+
isValid: false,
|
|
84
|
+
error: `Invalid response format: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Filter sensitive information from text
|
|
90
|
+
* @param text - The text to filter
|
|
91
|
+
* @returns Text with sensitive information redacted
|
|
92
|
+
*/
|
|
93
|
+
filterSensitiveInformation(text) {
|
|
94
|
+
let filteredText = text;
|
|
95
|
+
// Replace sensitive patterns with [REDACTED]
|
|
96
|
+
for (const pattern of this.sensitivePatterns) {
|
|
97
|
+
// Reset regex lastIndex to ensure consistent behavior with global flag
|
|
98
|
+
pattern.lastIndex = 0;
|
|
99
|
+
filteredText = filteredText.replace(pattern, (match, sensitiveValue) => {
|
|
100
|
+
// Keep the structure but redact the sensitive value
|
|
101
|
+
// Check if sensitiveValue is actually a captured group (string) rather than offset (number)
|
|
102
|
+
if (typeof sensitiveValue === 'string' && sensitiveValue.length > 0) {
|
|
103
|
+
return match.replace(sensitiveValue, '[REDACTED]');
|
|
104
|
+
}
|
|
105
|
+
// For patterns without capture groups, replace the entire match
|
|
106
|
+
return '[REDACTED]';
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return filteredText;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Check if text contains malicious content
|
|
113
|
+
* @param text - The text to check
|
|
114
|
+
* @returns true if malicious content is detected
|
|
115
|
+
*/
|
|
116
|
+
containsMaliciousContent(text) {
|
|
117
|
+
return this.maliciousPatterns.some((pattern) => pattern.test(text));
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Check if text contains sensitive information
|
|
121
|
+
* @param text - The text to check
|
|
122
|
+
* @returns true if sensitive information is detected
|
|
123
|
+
*/
|
|
124
|
+
containsSensitiveInformation(text) {
|
|
125
|
+
return this.sensitivePatterns.some((pattern) => pattern.test(text));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
exports.MCPSecurityValidator = MCPSecurityValidator;
|
|
129
|
+
//# sourceMappingURL=MCPSecurityValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MCPSecurityValidator.js","sourceRoot":"","sources":["../../../src/infrastructure/security/MCPSecurityValidator.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAmBH;;;GAGG;AACH,MAAa,oBAAoB;IAK/B;QAFiB,sBAAiB,GAAG,KAAK,CAAA;QAGxC,+CAA+C;QAC/C,IAAI,CAAC,iBAAiB,GAAG;YACvB,mEAAmE;YACnE,8DAA8D;YAC9D,gEAAgE;YAChE,yEAAyE;YACzE,qEAAqE;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