mcp-wordpress 2.4.2 → 2.5.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/README.md +124 -54
- package/bin/status.js +1 -1
- package/dist/cache/CacheInvalidation.d.ts +3 -1
- package/dist/cache/CacheInvalidation.d.ts.map +1 -1
- package/dist/cache/CacheInvalidation.js +10 -4
- package/dist/cache/CacheInvalidation.js.map +1 -1
- package/dist/cache/CacheManager.d.ts +3 -2
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.js +11 -3
- package/dist/cache/CacheManager.js.map +1 -1
- package/dist/cache/HttpCacheWrapper.d.ts +7 -6
- package/dist/cache/HttpCacheWrapper.d.ts.map +1 -1
- package/dist/cache/HttpCacheWrapper.js +8 -5
- package/dist/cache/HttpCacheWrapper.js.map +1 -1
- package/dist/cache/index.d.ts +3 -3
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/index.js +1 -1
- package/dist/cache/index.js.map +1 -1
- package/dist/client/CachedWordPressClient.d.ts +23 -9
- package/dist/client/CachedWordPressClient.d.ts.map +1 -1
- package/dist/client/CachedWordPressClient.js +4 -1
- package/dist/client/CachedWordPressClient.js.map +1 -1
- package/dist/client/MockWordPressClient.d.ts +2 -1
- package/dist/client/MockWordPressClient.d.ts.map +1 -1
- package/dist/client/MockWordPressClient.js +3 -1
- package/dist/client/MockWordPressClient.js.map +1 -1
- package/dist/client/api.d.ts +17 -13
- package/dist/client/api.d.ts.map +1 -1
- package/dist/client/api.js +135 -30
- package/dist/client/api.js.map +1 -1
- package/dist/client/auth.d.ts.map +1 -1
- package/dist/client/auth.js +2 -3
- package/dist/client/auth.js.map +1 -1
- package/dist/client/managers/AuthenticationManager.d.ts +55 -2
- package/dist/client/managers/AuthenticationManager.d.ts.map +1 -1
- package/dist/client/managers/AuthenticationManager.js +269 -71
- package/dist/client/managers/AuthenticationManager.js.map +1 -1
- package/dist/client/managers/BaseManager.d.ts +3 -3
- package/dist/client/managers/BaseManager.d.ts.map +1 -1
- package/dist/client/managers/BaseManager.js +11 -5
- package/dist/client/managers/BaseManager.js.map +1 -1
- package/dist/client/managers/RequestManager.d.ts +2 -2
- package/dist/client/managers/RequestManager.d.ts.map +1 -1
- package/dist/client/managers/RequestManager.js +25 -12
- package/dist/client/managers/RequestManager.js.map +1 -1
- package/dist/config/Config.d.ts +155 -0
- package/dist/config/Config.d.ts.map +1 -0
- package/dist/config/Config.js +215 -0
- package/dist/config/Config.js.map +1 -0
- package/dist/config/ConfigurationSchema.d.ts +21 -21
- package/dist/config/ConfigurationSchema.d.ts.map +1 -1
- package/dist/config/ConfigurationSchema.js +19 -2
- package/dist/config/ConfigurationSchema.js.map +1 -1
- package/dist/config/ServerConfiguration.d.ts +2 -1
- package/dist/config/ServerConfiguration.d.ts.map +1 -1
- package/dist/config/ServerConfiguration.js +73 -43
- package/dist/config/ServerConfiguration.js.map +1 -1
- package/dist/docs/DocumentationGenerator.d.ts +9 -8
- package/dist/docs/DocumentationGenerator.d.ts.map +1 -1
- package/dist/docs/DocumentationGenerator.js +10 -7
- package/dist/docs/DocumentationGenerator.js.map +1 -1
- package/dist/docs/MarkdownFormatter.d.ts.map +1 -1
- package/dist/docs/MarkdownFormatter.js +3 -2
- package/dist/docs/MarkdownFormatter.js.map +1 -1
- package/dist/dxt-entry.js +15 -14
- package/dist/dxt-entry.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37 -21
- package/dist/index.js.map +1 -1
- package/dist/performance/MetricsCollector.d.ts +13 -7
- package/dist/performance/MetricsCollector.d.ts.map +1 -1
- package/dist/performance/MetricsCollector.js +69 -27
- package/dist/performance/MetricsCollector.js.map +1 -1
- package/dist/performance/PerformanceAnalytics.d.ts +8 -2
- package/dist/performance/PerformanceAnalytics.d.ts.map +1 -1
- package/dist/performance/PerformanceAnalytics.js +17 -47
- package/dist/performance/PerformanceAnalytics.js.map +1 -1
- package/dist/performance/PerformanceMonitor.d.ts +2 -1
- package/dist/performance/PerformanceMonitor.d.ts.map +1 -1
- package/dist/performance/PerformanceMonitor.js +12 -13
- package/dist/performance/PerformanceMonitor.js.map +1 -1
- package/dist/performance/index.d.ts +2 -2
- package/dist/performance/index.d.ts.map +1 -1
- package/dist/security/AISecurityScanner.d.ts +1 -0
- package/dist/security/AISecurityScanner.d.ts.map +1 -1
- package/dist/security/AISecurityScanner.js +22 -12
- package/dist/security/AISecurityScanner.js.map +1 -1
- package/dist/security/AutomatedRemediation.d.ts +4 -3
- package/dist/security/AutomatedRemediation.d.ts.map +1 -1
- package/dist/security/AutomatedRemediation.js +46 -15
- package/dist/security/AutomatedRemediation.js.map +1 -1
- package/dist/security/InputValidator.d.ts +13 -9
- package/dist/security/InputValidator.d.ts.map +1 -1
- package/dist/security/InputValidator.js +4 -2
- package/dist/security/InputValidator.js.map +1 -1
- package/dist/security/SecurityCIPipeline.d.ts +1 -1
- package/dist/security/SecurityCIPipeline.d.ts.map +1 -1
- package/dist/security/SecurityCIPipeline.js +38 -29
- package/dist/security/SecurityCIPipeline.js.map +1 -1
- package/dist/security/SecurityConfig.d.ts +3 -3
- package/dist/security/SecurityConfig.d.ts.map +1 -1
- package/dist/security/SecurityConfig.js +13 -9
- package/dist/security/SecurityConfig.js.map +1 -1
- package/dist/security/SecurityConfigManager.d.ts +2 -2
- package/dist/security/SecurityConfigManager.d.ts.map +1 -1
- package/dist/security/SecurityConfigManager.js +20 -15
- package/dist/security/SecurityConfigManager.js.map +1 -1
- package/dist/security/SecurityMonitoring.d.ts +2 -2
- package/dist/security/SecurityMonitoring.d.ts.map +1 -1
- package/dist/security/SecurityMonitoring.js +19 -17
- package/dist/security/SecurityMonitoring.js.map +1 -1
- package/dist/security/SecurityReviewer.d.ts.map +1 -1
- package/dist/security/SecurityReviewer.js +10 -7
- package/dist/security/SecurityReviewer.js.map +1 -1
- package/dist/security/index.d.ts +24 -23
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +52 -23
- package/dist/security/index.js.map +1 -1
- package/dist/server/ConnectionTester.d.ts +12 -4
- package/dist/server/ConnectionTester.d.ts.map +1 -1
- package/dist/server/ConnectionTester.js +96 -22
- package/dist/server/ConnectionTester.js.map +1 -1
- package/dist/server/ToolRegistry.d.ts +2 -2
- package/dist/server/ToolRegistry.d.ts.map +1 -1
- package/dist/server/ToolRegistry.js +10 -5
- package/dist/server/ToolRegistry.js.map +1 -1
- package/dist/src/cache/CacheInvalidation.d.ts +120 -0
- package/dist/src/cache/CacheInvalidation.d.ts.map +1 -0
- package/dist/src/cache/CacheInvalidation.js +355 -0
- package/dist/src/cache/CacheInvalidation.js.map +1 -0
- package/dist/src/cache/CacheManager.d.ts +149 -0
- package/dist/src/cache/CacheManager.d.ts.map +1 -0
- package/dist/src/cache/CacheManager.js +326 -0
- package/dist/src/cache/CacheManager.js.map +1 -0
- package/dist/src/cache/HttpCacheWrapper.d.ts +122 -0
- package/dist/src/cache/HttpCacheWrapper.d.ts.map +1 -0
- package/dist/src/cache/HttpCacheWrapper.js +283 -0
- package/dist/src/cache/HttpCacheWrapper.js.map +1 -0
- package/dist/src/cache/index.d.ts +12 -0
- package/dist/src/cache/index.d.ts.map +1 -0
- package/dist/src/cache/index.js +9 -0
- package/dist/src/cache/index.js.map +1 -0
- package/dist/src/client/CachedWordPressClient.d.ts +174 -0
- package/dist/src/client/CachedWordPressClient.d.ts.map +1 -0
- package/dist/src/client/CachedWordPressClient.js +345 -0
- package/dist/src/client/CachedWordPressClient.js.map +1 -0
- package/dist/src/client/MockWordPressClient.d.ts +56 -0
- package/dist/src/client/MockWordPressClient.d.ts.map +1 -0
- package/dist/src/client/MockWordPressClient.js +371 -0
- package/dist/src/client/MockWordPressClient.js.map +1 -0
- package/dist/src/client/api.d.ts +235 -0
- package/dist/src/client/api.d.ts.map +1 -0
- package/dist/src/client/api.js +896 -0
- package/dist/src/client/api.js.map +1 -0
- package/dist/src/client/auth.d.ts +121 -0
- package/dist/src/client/auth.d.ts.map +1 -0
- package/dist/src/client/auth.js +429 -0
- package/dist/src/client/auth.js.map +1 -0
- package/dist/src/client/managers/AuthenticationManager.d.ts +92 -0
- package/dist/src/client/managers/AuthenticationManager.d.ts.map +1 -0
- package/dist/src/client/managers/AuthenticationManager.js +369 -0
- package/dist/src/client/managers/AuthenticationManager.js.map +1 -0
- package/dist/src/client/managers/BaseManager.d.ts +22 -0
- package/dist/src/client/managers/BaseManager.d.ts.map +1 -0
- package/dist/src/client/managers/BaseManager.js +53 -0
- package/dist/src/client/managers/BaseManager.js.map +1 -0
- package/dist/src/client/managers/RequestManager.d.ts +47 -0
- package/dist/src/client/managers/RequestManager.d.ts.map +1 -0
- package/dist/src/client/managers/RequestManager.js +193 -0
- package/dist/src/client/managers/RequestManager.js.map +1 -0
- package/dist/src/client/managers/index.d.ts +8 -0
- package/dist/src/client/managers/index.d.ts.map +1 -0
- package/dist/src/client/managers/index.js +8 -0
- package/dist/src/client/managers/index.js.map +1 -0
- package/dist/src/config/Config.d.ts +155 -0
- package/dist/src/config/Config.d.ts.map +1 -0
- package/dist/src/config/Config.js +215 -0
- package/dist/src/config/Config.js.map +1 -0
- package/dist/src/config/ConfigurationSchema.d.ts +281 -0
- package/dist/src/config/ConfigurationSchema.d.ts.map +1 -0
- package/dist/src/config/ConfigurationSchema.js +205 -0
- package/dist/src/config/ConfigurationSchema.js.map +1 -0
- package/dist/src/config/ServerConfiguration.d.ts +47 -0
- package/dist/src/config/ServerConfiguration.d.ts.map +1 -0
- package/dist/src/config/ServerConfiguration.js +255 -0
- package/dist/src/config/ServerConfiguration.js.map +1 -0
- package/dist/src/docs/DocumentationGenerator.d.ts +185 -0
- package/dist/src/docs/DocumentationGenerator.d.ts.map +1 -0
- package/dist/src/docs/DocumentationGenerator.js +777 -0
- package/dist/src/docs/DocumentationGenerator.js.map +1 -0
- package/dist/src/docs/MarkdownFormatter.d.ts +84 -0
- package/dist/src/docs/MarkdownFormatter.d.ts.map +1 -0
- package/dist/src/docs/MarkdownFormatter.js +458 -0
- package/dist/src/docs/MarkdownFormatter.js.map +1 -0
- package/dist/src/docs/index.d.ts +8 -0
- package/dist/src/docs/index.d.ts.map +1 -0
- package/dist/src/docs/index.js +7 -0
- package/dist/src/docs/index.js.map +1 -0
- package/dist/src/dxt-entry.d.ts +6 -0
- package/dist/src/dxt-entry.d.ts.map +1 -0
- package/dist/src/dxt-entry.js +39 -0
- package/dist/src/dxt-entry.js.map +1 -0
- package/dist/src/index.d.ts +18 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +143 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/performance/MetricsCollector.d.ts +145 -0
- package/dist/src/performance/MetricsCollector.d.ts.map +1 -0
- package/dist/src/performance/MetricsCollector.js +368 -0
- package/dist/src/performance/MetricsCollector.js.map +1 -0
- package/dist/src/performance/PerformanceAnalytics.d.ts +168 -0
- package/dist/src/performance/PerformanceAnalytics.d.ts.map +1 -0
- package/dist/src/performance/PerformanceAnalytics.js +570 -0
- package/dist/src/performance/PerformanceAnalytics.js.map +1 -0
- package/dist/src/performance/PerformanceMonitor.d.ts +203 -0
- package/dist/src/performance/PerformanceMonitor.d.ts.map +1 -0
- package/dist/src/performance/PerformanceMonitor.js +478 -0
- package/dist/src/performance/PerformanceMonitor.js.map +1 -0
- package/dist/src/performance/index.d.ts +11 -0
- package/dist/src/performance/index.d.ts.map +1 -0
- package/dist/src/performance/index.js +8 -0
- package/dist/src/performance/index.js.map +1 -0
- package/dist/src/security/AISecurityScanner.d.ts +176 -0
- package/dist/src/security/AISecurityScanner.d.ts.map +1 -0
- package/dist/src/security/AISecurityScanner.js +655 -0
- package/dist/src/security/AISecurityScanner.js.map +1 -0
- package/dist/src/security/AutomatedRemediation.d.ts +146 -0
- package/dist/src/security/AutomatedRemediation.d.ts.map +1 -0
- package/dist/src/security/AutomatedRemediation.js +566 -0
- package/dist/src/security/AutomatedRemediation.js.map +1 -0
- package/dist/src/security/InputValidator.d.ts +219 -0
- package/dist/src/security/InputValidator.d.ts.map +1 -0
- package/dist/src/security/InputValidator.js +295 -0
- package/dist/src/security/InputValidator.js.map +1 -0
- package/dist/src/security/SecurityCIPipeline.d.ts +213 -0
- package/dist/src/security/SecurityCIPipeline.d.ts.map +1 -0
- package/dist/src/security/SecurityCIPipeline.js +693 -0
- package/dist/src/security/SecurityCIPipeline.js.map +1 -0
- package/dist/src/security/SecurityConfig.d.ts +129 -0
- package/dist/src/security/SecurityConfig.d.ts.map +1 -0
- package/dist/src/security/SecurityConfig.js +266 -0
- package/dist/src/security/SecurityConfig.js.map +1 -0
- package/dist/src/security/SecurityConfigManager.d.ts +294 -0
- package/dist/src/security/SecurityConfigManager.d.ts.map +1 -0
- package/dist/src/security/SecurityConfigManager.js +558 -0
- package/dist/src/security/SecurityConfigManager.js.map +1 -0
- package/dist/src/security/SecurityMonitoring.d.ts +245 -0
- package/dist/src/security/SecurityMonitoring.d.ts.map +1 -0
- package/dist/src/security/SecurityMonitoring.js +598 -0
- package/dist/src/security/SecurityMonitoring.js.map +1 -0
- package/dist/src/security/SecurityReviewer.d.ts +168 -0
- package/dist/src/security/SecurityReviewer.d.ts.map +1 -0
- package/dist/src/security/SecurityReviewer.js +686 -0
- package/dist/src/security/SecurityReviewer.js.map +1 -0
- package/dist/src/security/index.d.ts +183 -0
- package/dist/src/security/index.d.ts.map +1 -0
- package/dist/src/security/index.js +218 -0
- package/dist/src/security/index.js.map +1 -0
- package/dist/src/server/ConnectionTester.d.ts +32 -0
- package/dist/src/server/ConnectionTester.d.ts.map +1 -0
- package/dist/src/server/ConnectionTester.js +135 -0
- package/dist/src/server/ConnectionTester.js.map +1 -0
- package/dist/src/server/ToolRegistry.d.ts +50 -0
- package/dist/src/server/ToolRegistry.d.ts.map +1 -0
- package/dist/src/server/ToolRegistry.js +219 -0
- package/dist/src/server/ToolRegistry.js.map +1 -0
- package/dist/src/server.d.ts +7 -0
- package/dist/src/server.d.ts.map +1 -0
- package/dist/src/server.js +7 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/tools/BaseToolManager.d.ts +62 -0
- package/dist/src/tools/BaseToolManager.d.ts.map +1 -0
- package/dist/src/tools/BaseToolManager.js +195 -0
- package/dist/src/tools/BaseToolManager.js.map +1 -0
- package/dist/src/tools/auth.d.ts +50 -0
- package/dist/src/tools/auth.d.ts.map +1 -0
- package/dist/src/tools/auth.js +133 -0
- package/dist/src/tools/auth.js.map +1 -0
- package/dist/src/tools/cache.d.ts +260 -0
- package/dist/src/tools/cache.d.ts.map +1 -0
- package/dist/src/tools/cache.js +232 -0
- package/dist/src/tools/cache.js.map +1 -0
- package/dist/src/tools/comments.d.ts +33 -0
- package/dist/src/tools/comments.d.ts.map +1 -0
- package/dist/src/tools/comments.js +235 -0
- package/dist/src/tools/comments.js.map +1 -0
- package/dist/src/tools/index.d.ts +11 -0
- package/dist/src/tools/index.d.ts.map +1 -0
- package/dist/src/tools/index.js +11 -0
- package/dist/src/tools/index.js.map +1 -0
- package/dist/src/tools/media.d.ts +70 -0
- package/dist/src/tools/media.d.ts.map +1 -0
- package/dist/src/tools/media.js +248 -0
- package/dist/src/tools/media.js.map +1 -0
- package/dist/src/tools/pages.d.ts +32 -0
- package/dist/src/tools/pages.d.ts.map +1 -0
- package/dist/src/tools/pages.js +215 -0
- package/dist/src/tools/pages.js.map +1 -0
- package/dist/src/tools/performance.d.ts +73 -0
- package/dist/src/tools/performance.d.ts.map +1 -0
- package/dist/src/tools/performance.js +922 -0
- package/dist/src/tools/performance.js.map +1 -0
- package/dist/src/tools/posts/PostHandlers.d.ts +46 -0
- package/dist/src/tools/posts/PostHandlers.d.ts.map +1 -0
- package/dist/src/tools/posts/PostHandlers.js +400 -0
- package/dist/src/tools/posts/PostHandlers.js.map +1 -0
- package/dist/src/tools/posts/PostToolDefinitions.d.ts +37 -0
- package/dist/src/tools/posts/PostToolDefinitions.d.ts.map +1 -0
- package/dist/src/tools/posts/PostToolDefinitions.js +236 -0
- package/dist/src/tools/posts/PostToolDefinitions.js.map +1 -0
- package/dist/src/tools/posts/index.d.ts +138 -0
- package/dist/src/tools/posts/index.d.ts.map +1 -0
- package/dist/src/tools/posts/index.js +163 -0
- package/dist/src/tools/posts/index.js.map +1 -0
- package/dist/src/tools/posts.d.ts +15 -0
- package/dist/src/tools/posts.d.ts.map +1 -0
- package/dist/src/tools/posts.js +16 -0
- package/dist/src/tools/posts.js.map +1 -0
- package/dist/src/tools/site.d.ts +32 -0
- package/dist/src/tools/site.d.ts.map +1 -0
- package/dist/src/tools/site.js +234 -0
- package/dist/src/tools/site.js.map +1 -0
- package/dist/src/tools/taxonomies.d.ts +36 -0
- package/dist/src/tools/taxonomies.d.ts.map +1 -0
- package/dist/src/tools/taxonomies.js +286 -0
- package/dist/src/tools/taxonomies.js.map +1 -0
- package/dist/src/tools/users.d.ts +33 -0
- package/dist/src/tools/users.d.ts.map +1 -0
- package/dist/src/tools/users.js +308 -0
- package/dist/src/tools/users.js.map +1 -0
- package/dist/src/types/client.d.ts +223 -0
- package/dist/src/types/client.d.ts.map +1 -0
- package/dist/src/types/client.js +97 -0
- package/dist/src/types/client.js.map +1 -0
- package/dist/src/types/enhanced.d.ts +237 -0
- package/dist/src/types/enhanced.d.ts.map +1 -0
- package/dist/src/types/enhanced.js +49 -0
- package/dist/src/types/enhanced.js.map +1 -0
- package/dist/src/types/index.d.ts +160 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +14 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/types/mcp.d.ts +178 -0
- package/dist/src/types/mcp.d.ts.map +1 -0
- package/dist/src/types/mcp.js +7 -0
- package/dist/src/types/mcp.js.map +1 -0
- package/dist/src/types/requests.d.ts +322 -0
- package/dist/src/types/requests.d.ts.map +1 -0
- package/dist/src/types/requests.js +8 -0
- package/dist/src/types/requests.js.map +1 -0
- package/dist/src/types/tools.d.ts +506 -0
- package/dist/src/types/tools.d.ts.map +1 -0
- package/dist/src/types/tools.js +8 -0
- package/dist/src/types/tools.js.map +1 -0
- package/dist/src/types/wordpress.d.ts +471 -0
- package/dist/src/types/wordpress.d.ts.map +1 -0
- package/dist/src/types/wordpress.js +14 -0
- package/dist/src/types/wordpress.js.map +1 -0
- package/dist/src/utils/debug.d.ts +71 -0
- package/dist/src/utils/debug.d.ts.map +1 -0
- package/dist/src/utils/debug.js +235 -0
- package/dist/src/utils/debug.js.map +1 -0
- package/dist/src/utils/enhancedError.d.ts +61 -0
- package/dist/src/utils/enhancedError.d.ts.map +1 -0
- package/dist/src/utils/enhancedError.js +221 -0
- package/dist/src/utils/enhancedError.js.map +1 -0
- package/dist/src/utils/error.d.ts +17 -0
- package/dist/src/utils/error.d.ts.map +1 -0
- package/dist/src/utils/error.js +108 -0
- package/dist/src/utils/error.js.map +1 -0
- package/dist/src/utils/logger.d.ts +106 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/logger.js +280 -0
- package/dist/src/utils/logger.js.map +1 -0
- package/dist/src/utils/streaming.d.ts +104 -0
- package/dist/src/utils/streaming.d.ts.map +1 -0
- package/dist/src/utils/streaming.js +331 -0
- package/dist/src/utils/streaming.js.map +1 -0
- package/dist/src/utils/toolWrapper.d.ts +42 -0
- package/dist/src/utils/toolWrapper.d.ts.map +1 -0
- package/dist/src/utils/toolWrapper.js +101 -0
- package/dist/src/utils/toolWrapper.js.map +1 -0
- package/dist/src/utils/validation/core.d.ts +21 -0
- package/dist/src/utils/validation/core.d.ts.map +1 -0
- package/dist/src/utils/validation/core.js +71 -0
- package/dist/src/utils/validation/core.js.map +1 -0
- package/dist/src/utils/validation/index.d.ts +25 -0
- package/dist/src/utils/validation/index.d.ts.map +1 -0
- package/dist/src/utils/validation/index.js +29 -0
- package/dist/src/utils/validation/index.js.map +1 -0
- package/dist/src/utils/validation/network.d.ts +19 -0
- package/dist/src/utils/validation/network.d.ts.map +1 -0
- package/dist/src/utils/validation/network.js +93 -0
- package/dist/src/utils/validation/network.js.map +1 -0
- package/dist/src/utils/validation/rateLimit.d.ts +21 -0
- package/dist/src/utils/validation/rateLimit.d.ts.map +1 -0
- package/dist/src/utils/validation/rateLimit.js +43 -0
- package/dist/src/utils/validation/rateLimit.js.map +1 -0
- package/dist/src/utils/validation/security.d.ts +29 -0
- package/dist/src/utils/validation/security.d.ts.map +1 -0
- package/dist/src/utils/validation/security.js +327 -0
- package/dist/src/utils/validation/security.js.map +1 -0
- package/dist/src/utils/validation/wordpress.d.ts +31 -0
- package/dist/src/utils/validation/wordpress.d.ts.map +1 -0
- package/dist/src/utils/validation/wordpress.js +146 -0
- package/dist/src/utils/validation/wordpress.js.map +1 -0
- package/dist/src/utils/validation.d.ts +15 -0
- package/dist/src/utils/validation.d.ts.map +1 -0
- package/dist/src/utils/validation.js +27 -0
- package/dist/src/utils/validation.js.map +1 -0
- package/dist/tests/vitest.setup.d.ts +6 -0
- package/dist/tests/vitest.setup.d.ts.map +1 -0
- package/dist/tests/vitest.setup.js +39 -0
- package/dist/tests/vitest.setup.js.map +1 -0
- package/dist/tools/BaseToolManager.d.ts +47 -11
- package/dist/tools/BaseToolManager.d.ts.map +1 -1
- package/dist/tools/BaseToolManager.js +168 -29
- package/dist/tools/BaseToolManager.js.map +1 -1
- package/dist/tools/auth.d.ts +16 -10
- package/dist/tools/auth.d.ts.map +1 -1
- package/dist/tools/auth.js +3 -2
- package/dist/tools/auth.js.map +1 -1
- package/dist/tools/cache.d.ts +30 -30
- package/dist/tools/cache.d.ts.map +1 -1
- package/dist/tools/cache.js +1 -6
- package/dist/tools/cache.js.map +1 -1
- package/dist/tools/comments.d.ts +20 -20
- package/dist/tools/comments.d.ts.map +1 -1
- package/dist/tools/comments.js +16 -9
- package/dist/tools/comments.js.map +1 -1
- package/dist/tools/media.d.ts +18 -16
- package/dist/tools/media.d.ts.map +1 -1
- package/dist/tools/media.js +16 -15
- package/dist/tools/media.js.map +1 -1
- package/dist/tools/pages.d.ts +19 -17
- package/dist/tools/pages.d.ts.map +1 -1
- package/dist/tools/pages.js +16 -12
- package/dist/tools/pages.js.map +1 -1
- package/dist/tools/performance.d.ts +11 -1
- package/dist/tools/performance.d.ts.map +1 -1
- package/dist/tools/performance.js +67 -34
- package/dist/tools/performance.js.map +1 -1
- package/dist/tools/posts/PostHandlers.d.ts +46 -0
- package/dist/tools/posts/PostHandlers.d.ts.map +1 -0
- package/dist/tools/posts/PostHandlers.js +400 -0
- package/dist/tools/posts/PostHandlers.js.map +1 -0
- package/dist/tools/posts/PostToolDefinitions.d.ts +37 -0
- package/dist/tools/posts/PostToolDefinitions.d.ts.map +1 -0
- package/dist/tools/posts/PostToolDefinitions.js +236 -0
- package/dist/tools/posts/PostToolDefinitions.js.map +1 -0
- package/dist/tools/posts/index.d.ts +138 -0
- package/dist/tools/posts/index.d.ts.map +1 -0
- package/dist/tools/posts/index.js +163 -0
- package/dist/tools/posts/index.js.map +1 -0
- package/dist/tools/posts.d.ts +10 -246
- package/dist/tools/posts.d.ts.map +1 -1
- package/dist/tools/posts.js +11 -723
- package/dist/tools/posts.js.map +1 -1
- package/dist/tools/site.d.ts +19 -18
- package/dist/tools/site.d.ts.map +1 -1
- package/dist/tools/site.js +14 -10
- package/dist/tools/site.js.map +1 -1
- package/dist/tools/taxonomies.d.ts +23 -24
- package/dist/tools/taxonomies.d.ts.map +1 -1
- package/dist/tools/taxonomies.js +24 -18
- package/dist/tools/taxonomies.js.map +1 -1
- package/dist/tools/users.d.ts +20 -15
- package/dist/tools/users.d.ts.map +1 -1
- package/dist/tools/users.js +12 -8
- package/dist/tools/users.js.map +1 -1
- package/dist/types/client.d.ts +48 -41
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/client.js +30 -5
- package/dist/types/client.js.map +1 -1
- package/dist/types/enhanced.d.ts +237 -0
- package/dist/types/enhanced.d.ts.map +1 -0
- package/dist/types/enhanced.js +49 -0
- package/dist/types/enhanced.js.map +1 -0
- package/dist/types/index.d.ts +15 -12
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/mcp.d.ts +12 -12
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/types/requests.d.ts +322 -0
- package/dist/types/requests.d.ts.map +1 -0
- package/dist/types/requests.js +8 -0
- package/dist/types/requests.js.map +1 -0
- package/dist/types/tools.d.ts +506 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +8 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/types/wordpress.d.ts +43 -15
- package/dist/types/wordpress.d.ts.map +1 -1
- package/dist/types/wordpress.js +8 -1
- package/dist/types/wordpress.js.map +1 -1
- package/dist/utils/debug.d.ts +19 -11
- package/dist/utils/debug.d.ts.map +1 -1
- package/dist/utils/debug.js +46 -10
- package/dist/utils/debug.js.map +1 -1
- package/dist/utils/enhancedError.d.ts +8 -8
- package/dist/utils/enhancedError.d.ts.map +1 -1
- package/dist/utils/enhancedError.js.map +1 -1
- package/dist/utils/error.d.ts +2 -4
- package/dist/utils/error.d.ts.map +1 -1
- package/dist/utils/error.js +42 -5
- package/dist/utils/error.js.map +1 -1
- package/dist/utils/logger.d.ts +106 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +280 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/streaming.d.ts +9 -9
- package/dist/utils/streaming.d.ts.map +1 -1
- package/dist/utils/streaming.js +71 -52
- package/dist/utils/streaming.js.map +1 -1
- package/dist/utils/toolWrapper.d.ts +9 -7
- package/dist/utils/toolWrapper.d.ts.map +1 -1
- package/dist/utils/toolWrapper.js.map +1 -1
- package/dist/utils/validation/core.d.ts +21 -0
- package/dist/utils/validation/core.d.ts.map +1 -0
- package/dist/utils/validation/core.js +71 -0
- package/dist/utils/validation/core.js.map +1 -0
- package/dist/utils/validation/index.d.ts +25 -0
- package/dist/utils/validation/index.d.ts.map +1 -0
- package/dist/utils/validation/index.js +29 -0
- package/dist/utils/validation/index.js.map +1 -0
- package/dist/utils/validation/network.d.ts +19 -0
- package/dist/utils/validation/network.d.ts.map +1 -0
- package/dist/utils/validation/network.js +93 -0
- package/dist/utils/validation/network.js.map +1 -0
- package/dist/utils/validation/rateLimit.d.ts +21 -0
- package/dist/utils/validation/rateLimit.d.ts.map +1 -0
- package/dist/utils/validation/rateLimit.js +43 -0
- package/dist/utils/validation/rateLimit.js.map +1 -0
- package/dist/utils/validation/security.d.ts +29 -0
- package/dist/utils/validation/security.d.ts.map +1 -0
- package/dist/utils/validation/security.js +327 -0
- package/dist/utils/validation/security.js.map +1 -0
- package/dist/utils/validation/wordpress.d.ts +31 -0
- package/dist/utils/validation/wordpress.d.ts.map +1 -0
- package/dist/utils/validation/wordpress.js +146 -0
- package/dist/utils/validation/wordpress.js.map +1 -0
- package/dist/utils/validation.d.ts +13 -82
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +25 -343
- package/dist/utils/validation.js.map +1 -1
- package/docs/BADGE_UPDATES.md +132 -0
- package/docs/CI_CD_IMPROVEMENTS.md +191 -0
- package/docs/INCREMENTAL_COVERAGE.md +183 -0
- package/docs/INSTALLATION.md +4 -2
- package/docs/TROUBLESHOOTING.md +2 -1
- package/docs/api/README.md +3 -1
- package/docs/api/openapi.json +5 -1
- package/docs/api/summary.json +1 -1
- package/docs/api/tools/wp_create_post.md +12 -14
- package/docs/developer/TESTING.md +24 -19
- package/docs/examples/claude-desktop-config.md +1 -1
- package/docs/examples/docker-production.md +100 -93
- package/docs/examples/multi-site-setup.md +5 -4
- package/docs/examples/single-site-setup.md +3 -4
- package/docs/examples/use-case-workflows.md +4 -5
- package/docs/integrations/claude-desktop.md +39 -34
- package/docs/integrations/cline.md +4 -4
- package/docs/integrations/vs-code.md +9 -8
- package/docs/user-guides/DXT_INSTALLATION.md +2 -1
- package/docs/user-guides/SMITHERY_SETUP.md +10 -10
- package/package.json +57 -39
- package/src/cache/CacheInvalidation.ts +12 -5
- package/src/cache/CacheManager.ts +18 -15
- package/src/cache/HttpCacheWrapper.ts +30 -59
- package/src/cache/__tests__/HttpCacheWrapper.test.ts +6 -5
- package/src/cache/index.ts +3 -14
- package/src/client/CachedWordPressClient.ts +32 -30
- package/src/client/MockWordPressClient.ts +4 -2
- package/src/client/api.ts +186 -64
- package/src/client/auth.ts +15 -40
- package/src/client/managers/AuthenticationManager.ts +337 -77
- package/src/client/managers/BaseManager.ts +18 -30
- package/src/client/managers/RequestManager.ts +39 -44
- package/src/config/Config.ts +308 -0
- package/src/config/ConfigurationSchema.ts +23 -2
- package/src/config/ServerConfiguration.ts +73 -49
- package/src/docs/DocumentationGenerator.ts +50 -39
- package/src/docs/MarkdownFormatter.ts +19 -29
- package/src/dxt-entry.cjs +26 -16
- package/src/dxt-entry.ts +17 -27
- package/src/index.ts +42 -28
- package/src/performance/MetricsCollector.ts +108 -86
- package/src/performance/PerformanceAnalytics.ts +69 -164
- package/src/performance/PerformanceMonitor.ts +32 -47
- package/src/performance/index.ts +2 -10
- package/src/security/AISecurityScanner.ts +22 -12
- package/src/security/AutomatedRemediation.ts +49 -18
- package/src/security/InputValidator.ts +9 -6
- package/src/security/SecurityCIPipeline.ts +53 -37
- package/src/security/SecurityConfig.ts +22 -22
- package/src/security/SecurityConfigManager.ts +23 -19
- package/src/security/SecurityMonitoring.ts +24 -21
- package/src/security/SecurityReviewer.ts +10 -7
- package/src/security/index.ts +64 -29
- package/src/server/ConnectionTester.ts +120 -31
- package/src/server/ToolRegistry.ts +31 -21
- package/src/tools/BaseToolManager.ts +286 -33
- package/src/tools/auth.ts +20 -8
- package/src/tools/cache.ts +5 -15
- package/src/tools/comments.ts +34 -48
- package/src/tools/media.ts +41 -53
- package/src/tools/pages.ts +32 -54
- package/src/tools/performance.ts +141 -176
- package/src/tools/posts/PostHandlers.ts +474 -0
- package/src/tools/posts/PostToolDefinitions.ts +250 -0
- package/src/tools/posts/index.ts +192 -0
- package/src/tools/posts.ts +24 -780
- package/src/tools/site.ts +34 -19
- package/src/tools/taxonomies.ts +41 -57
- package/src/tools/users.ts +28 -16
- package/src/types/client.ts +114 -138
- package/src/types/enhanced.ts +318 -0
- package/src/types/index.ts +51 -30
- package/src/types/mcp.ts +20 -42
- package/src/types/requests.ts +378 -0
- package/src/types/tools.ts +608 -0
- package/src/types/wordpress.ts +56 -34
- package/src/utils/debug.ts +77 -59
- package/src/utils/enhancedError.ts +8 -8
- package/src/utils/error.ts +53 -31
- package/src/utils/logger.ts +351 -0
- package/src/utils/streaming.ts +86 -68
- package/src/utils/toolWrapper.ts +10 -12
- package/src/utils/validation/core.ts +108 -0
- package/src/utils/validation/index.ts +36 -0
- package/src/utils/validation/network.ts +132 -0
- package/src/utils/validation/rateLimit.ts +54 -0
- package/src/utils/validation/security.ts +361 -0
- package/src/utils/validation/wordpress.ts +180 -0
- package/src/utils/validation.ts +47 -470
- package/dist/cache/__tests__/CacheInvalidation.test.d.ts +0 -5
- package/dist/cache/__tests__/CacheInvalidation.test.d.ts.map +0 -1
- package/dist/cache/__tests__/CacheInvalidation.test.js +0 -238
- package/dist/cache/__tests__/CacheInvalidation.test.js.map +0 -1
- package/dist/cache/__tests__/CacheManager.test.d.ts +0 -5
- package/dist/cache/__tests__/CacheManager.test.d.ts.map +0 -1
- package/dist/cache/__tests__/CacheManager.test.js +0 -233
- package/dist/cache/__tests__/CacheManager.test.js.map +0 -1
- package/dist/cache/__tests__/CachedWordPressClient.test.d.ts +0 -5
- package/dist/cache/__tests__/CachedWordPressClient.test.d.ts.map +0 -1
- package/dist/cache/__tests__/CachedWordPressClient.test.js +0 -231
- package/dist/cache/__tests__/CachedWordPressClient.test.js.map +0 -1
- package/dist/cache/__tests__/HttpCacheWrapper.test.d.ts +0 -5
- package/dist/cache/__tests__/HttpCacheWrapper.test.d.ts.map +0 -1
- package/dist/cache/__tests__/HttpCacheWrapper.test.js +0 -299
- package/dist/cache/__tests__/HttpCacheWrapper.test.js.map +0 -1
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI-Powered Security Scanner
|
|
3
|
+
* Provides intelligent vulnerability detection and automated remediation
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from "fs/promises";
|
|
6
|
+
import * as path from "path";
|
|
7
|
+
import { SecurityUtils } from "./SecurityConfig.js";
|
|
8
|
+
import { SecurityValidationError } from "./InputValidator.js";
|
|
9
|
+
import { LoggerFactory } from "../utils/logger.js";
|
|
10
|
+
/**
|
|
11
|
+
* AI-powered security analysis patterns
|
|
12
|
+
*/
|
|
13
|
+
const SECURITY_PATTERNS = {
|
|
14
|
+
// SQL Injection patterns
|
|
15
|
+
sqlInjection: [
|
|
16
|
+
/['"\-\-;]|\/\*|\*\//g, // Match quotes, double hyphens, semicolons, and SQL comments
|
|
17
|
+
/(union|select|insert|update|delete|drop|create|alter)\s+/gi,
|
|
18
|
+
/\b(or|and)\s+['"]?\d+['"]?\s*=\s*['"]?\d+['"]?/gi,
|
|
19
|
+
/\b(char|ascii|substring|length|concat)\s*\(/gi,
|
|
20
|
+
],
|
|
21
|
+
// XSS patterns
|
|
22
|
+
xss: [
|
|
23
|
+
/<script[^>]*>.*?<\/script>/gis, // Match script tags with any attributes
|
|
24
|
+
/javascript\s*:/gi,
|
|
25
|
+
/on\w+\s*=\s*['"][^'"]*['"]?/gi,
|
|
26
|
+
/eval\s*\(/gi,
|
|
27
|
+
/expression\s*\(/gi,
|
|
28
|
+
/<iframe[^>]*>/gi,
|
|
29
|
+
],
|
|
30
|
+
// Path Traversal
|
|
31
|
+
pathTraversal: [/\.\.[\/\\]/g, /[\/\\]\.\.$/g, /%2e%2e/gi, /%252e%252e/gi, /\x2e\x2e/g],
|
|
32
|
+
// Command Injection
|
|
33
|
+
commandInjection: [/[;&|`$]/g, /\b(rm|cat|ls|ps|kill|sudo|su)\s/gi, /\$\([^)]*\)/g, /`[^`]*`/g],
|
|
34
|
+
// Credential Exposure
|
|
35
|
+
credentials: [
|
|
36
|
+
/password\s*[:=]\s*['"][^'"]{8,}/gi,
|
|
37
|
+
/api[_-]?key\s*[:=]\s*['"][^'"]{16,}/gi,
|
|
38
|
+
/token\s*[:=]\s*['"][^'"]{20,}/gi,
|
|
39
|
+
/secret\s*[:=]\s*['"][^'"]{16,}/gi,
|
|
40
|
+
/private[_-]?key/gi,
|
|
41
|
+
],
|
|
42
|
+
// LDAP Injection
|
|
43
|
+
ldapInjection: [/[()&|!]/g, /\*[^*]*\*/g, /\\\d{2}/g],
|
|
44
|
+
// NoSQL Injection
|
|
45
|
+
nosqlInjection: [/\$where/gi, /\$ne/gi, /\$gt/gi, /\$regex/gi, /\$exists/gi],
|
|
46
|
+
// CSRF vulnerabilities
|
|
47
|
+
csrf: [/GET\s+.*(?:delete|remove|update|create)/gi, /action\s*=\s*['"][^'"]*(?:delete|admin|config)/gi],
|
|
48
|
+
// Information Disclosure
|
|
49
|
+
infoDisclosure: [/error\s*[:=]\s*true/gi, /debug\s*[:=]\s*true/gi, /trace\s*[:=]\s*true/gi, /stack\s*trace/gi],
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* AI Security Scanner with machine learning capabilities
|
|
53
|
+
*/
|
|
54
|
+
export class AISecurityScanner {
|
|
55
|
+
logger = LoggerFactory.security();
|
|
56
|
+
vulnerabilities = [];
|
|
57
|
+
scanHistory = [];
|
|
58
|
+
remediationHistory = [];
|
|
59
|
+
/**
|
|
60
|
+
* Perform comprehensive security scan
|
|
61
|
+
*/
|
|
62
|
+
async performScan(options = {}) {
|
|
63
|
+
const scanId = SecurityUtils.generateSecureToken(16);
|
|
64
|
+
const startTime = Date.now();
|
|
65
|
+
this.logger.info("Starting AI-powered security scan", { scanId });
|
|
66
|
+
try {
|
|
67
|
+
this.vulnerabilities = [];
|
|
68
|
+
// Perform different types of scans
|
|
69
|
+
await this.scanCodebase(options.targets);
|
|
70
|
+
if (options.includeRuntime) {
|
|
71
|
+
await this.scanRuntimeEnvironment();
|
|
72
|
+
}
|
|
73
|
+
if (options.includeFileSystem) {
|
|
74
|
+
await this.scanFileSystem();
|
|
75
|
+
}
|
|
76
|
+
await this.scanConfigurations();
|
|
77
|
+
await this.scanDependencies();
|
|
78
|
+
await this.performAIAnalysis();
|
|
79
|
+
const duration = Date.now() - startTime;
|
|
80
|
+
const result = this.generateScanResult(scanId, duration);
|
|
81
|
+
this.scanHistory.push(result);
|
|
82
|
+
this.logger.info("Security scan completed", {
|
|
83
|
+
scanId,
|
|
84
|
+
vulnerabilities: result.summary.total,
|
|
85
|
+
duration,
|
|
86
|
+
critical: result.summary.critical,
|
|
87
|
+
high: result.summary.high,
|
|
88
|
+
medium: result.summary.medium,
|
|
89
|
+
low: result.summary.low,
|
|
90
|
+
});
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
this.logger.error("Security scan failed", { scanId, error: String(error) });
|
|
95
|
+
throw new SecurityValidationError("Security scan failed", [{ message: String(error) }]);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Scan codebase for vulnerabilities
|
|
100
|
+
*/
|
|
101
|
+
async scanCodebase(targets) {
|
|
102
|
+
const defaultTargets = ["src/", "tests/", "scripts/"];
|
|
103
|
+
const scanTargets = targets || defaultTargets;
|
|
104
|
+
for (const target of scanTargets) {
|
|
105
|
+
await this.scanDirectory(target);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Recursively scan directory for security issues
|
|
110
|
+
*/
|
|
111
|
+
async scanDirectory(dirPath) {
|
|
112
|
+
try {
|
|
113
|
+
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
114
|
+
for (const entry of entries) {
|
|
115
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
116
|
+
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
|
|
117
|
+
await this.scanDirectory(fullPath);
|
|
118
|
+
}
|
|
119
|
+
else if (entry.isFile() && this.shouldScanFile(entry.name)) {
|
|
120
|
+
await this.scanFile(fullPath);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
// Directory might not exist or be accessible
|
|
126
|
+
this.logger.warn("Cannot scan directory", { dirPath, error: String(error) });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Check if file should be scanned
|
|
131
|
+
*/
|
|
132
|
+
shouldScanFile(filename) {
|
|
133
|
+
const scanExtensions = [".ts", ".js", ".json", ".yml", ".yaml", ".env", ".config"];
|
|
134
|
+
const ext = path.extname(filename).toLowerCase();
|
|
135
|
+
return scanExtensions.includes(ext) || filename.startsWith(".");
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Scan individual file for vulnerabilities
|
|
139
|
+
*/
|
|
140
|
+
async scanFile(filePath) {
|
|
141
|
+
try {
|
|
142
|
+
const content = await fs.readFile(filePath, "utf-8");
|
|
143
|
+
const lines = content.split("\n");
|
|
144
|
+
// Scan for different vulnerability types
|
|
145
|
+
this.scanForSQLInjection(filePath, content, lines);
|
|
146
|
+
this.scanForXSS(filePath, content, lines);
|
|
147
|
+
this.scanForPathTraversal(filePath, content, lines);
|
|
148
|
+
this.scanForCommandInjection(filePath, content, lines);
|
|
149
|
+
this.scanForCredentialExposure(filePath, content, lines);
|
|
150
|
+
this.scanForLDAPInjection(filePath, content, lines);
|
|
151
|
+
this.scanForNoSQLInjection(filePath, content, lines);
|
|
152
|
+
this.scanForCSRF(filePath, content, lines);
|
|
153
|
+
this.scanForInfoDisclosure(filePath, content, lines);
|
|
154
|
+
this.scanForInsecureConfiguration(filePath, content, lines);
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
this.logger.warn("Cannot scan file", { filePath, error: String(error) });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Scan for SQL injection vulnerabilities
|
|
162
|
+
*/
|
|
163
|
+
scanForSQLInjection(filePath, content, lines) {
|
|
164
|
+
SECURITY_PATTERNS.sqlInjection.forEach((pattern, index) => {
|
|
165
|
+
const matches = Array.from(content.matchAll(pattern));
|
|
166
|
+
matches.forEach((match) => {
|
|
167
|
+
const lineNumber = this.getLineNumber(content, match.index || 0);
|
|
168
|
+
this.addVulnerability({
|
|
169
|
+
id: `sql-${Date.now()}-${index}`,
|
|
170
|
+
severity: "high",
|
|
171
|
+
type: "SQL Injection",
|
|
172
|
+
description: `Potential SQL injection vulnerability detected: ${match[0]}`,
|
|
173
|
+
location: {
|
|
174
|
+
file: filePath,
|
|
175
|
+
line: lineNumber,
|
|
176
|
+
context: lines[lineNumber - 1]?.trim(),
|
|
177
|
+
},
|
|
178
|
+
remediation: {
|
|
179
|
+
suggested: "Use parameterized queries or prepared statements",
|
|
180
|
+
automated: true,
|
|
181
|
+
confidence: 0.8,
|
|
182
|
+
},
|
|
183
|
+
metadata: {
|
|
184
|
+
cweId: "CWE-89",
|
|
185
|
+
cvssScore: 8.1,
|
|
186
|
+
exploitability: "high",
|
|
187
|
+
detected: new Date(),
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Scan for XSS vulnerabilities
|
|
195
|
+
*/
|
|
196
|
+
scanForXSS(filePath, content, lines) {
|
|
197
|
+
SECURITY_PATTERNS.xss.forEach((pattern, index) => {
|
|
198
|
+
const matches = Array.from(content.matchAll(pattern));
|
|
199
|
+
matches.forEach((match) => {
|
|
200
|
+
const lineNumber = this.getLineNumber(content, match.index || 0);
|
|
201
|
+
this.addVulnerability({
|
|
202
|
+
id: `xss-${Date.now()}-${index}`,
|
|
203
|
+
severity: "high",
|
|
204
|
+
type: "Cross-Site Scripting (XSS)",
|
|
205
|
+
description: `Potential XSS vulnerability detected: ${match[0]}`,
|
|
206
|
+
location: {
|
|
207
|
+
file: filePath,
|
|
208
|
+
line: lineNumber,
|
|
209
|
+
context: lines[lineNumber - 1]?.trim(),
|
|
210
|
+
},
|
|
211
|
+
remediation: {
|
|
212
|
+
suggested: "Sanitize user input and encode output",
|
|
213
|
+
automated: true,
|
|
214
|
+
confidence: 0.7,
|
|
215
|
+
},
|
|
216
|
+
metadata: {
|
|
217
|
+
cweId: "CWE-79",
|
|
218
|
+
cvssScore: 7.5,
|
|
219
|
+
exploitability: "medium",
|
|
220
|
+
detected: new Date(),
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Scan for path traversal vulnerabilities
|
|
228
|
+
*/
|
|
229
|
+
scanForPathTraversal(filePath, content, lines) {
|
|
230
|
+
SECURITY_PATTERNS.pathTraversal.forEach((pattern, index) => {
|
|
231
|
+
const matches = Array.from(content.matchAll(pattern));
|
|
232
|
+
matches.forEach((match) => {
|
|
233
|
+
const lineNumber = this.getLineNumber(content, match.index || 0);
|
|
234
|
+
this.addVulnerability({
|
|
235
|
+
id: `path-${Date.now()}-${index}`,
|
|
236
|
+
severity: "medium",
|
|
237
|
+
type: "Path Traversal",
|
|
238
|
+
description: `Potential path traversal vulnerability detected: ${match[0]}`,
|
|
239
|
+
location: {
|
|
240
|
+
file: filePath,
|
|
241
|
+
line: lineNumber,
|
|
242
|
+
context: lines[lineNumber - 1]?.trim(),
|
|
243
|
+
},
|
|
244
|
+
remediation: {
|
|
245
|
+
suggested: "Validate and sanitize file paths",
|
|
246
|
+
automated: true,
|
|
247
|
+
confidence: 0.9,
|
|
248
|
+
},
|
|
249
|
+
metadata: {
|
|
250
|
+
cweId: "CWE-22",
|
|
251
|
+
cvssScore: 6.5,
|
|
252
|
+
exploitability: "medium",
|
|
253
|
+
detected: new Date(),
|
|
254
|
+
},
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Scan for command injection vulnerabilities
|
|
261
|
+
*/
|
|
262
|
+
scanForCommandInjection(filePath, content, lines) {
|
|
263
|
+
SECURITY_PATTERNS.commandInjection.forEach((pattern, index) => {
|
|
264
|
+
const matches = Array.from(content.matchAll(pattern));
|
|
265
|
+
matches.forEach((match) => {
|
|
266
|
+
const lineNumber = this.getLineNumber(content, match.index || 0);
|
|
267
|
+
this.addVulnerability({
|
|
268
|
+
id: `cmd-${Date.now()}-${index}`,
|
|
269
|
+
severity: "critical",
|
|
270
|
+
type: "Command Injection",
|
|
271
|
+
description: `Potential command injection vulnerability detected: ${match[0]}`,
|
|
272
|
+
location: {
|
|
273
|
+
file: filePath,
|
|
274
|
+
line: lineNumber,
|
|
275
|
+
context: lines[lineNumber - 1]?.trim(),
|
|
276
|
+
},
|
|
277
|
+
remediation: {
|
|
278
|
+
suggested: "Use safe APIs and validate input",
|
|
279
|
+
automated: false,
|
|
280
|
+
confidence: 0.6,
|
|
281
|
+
},
|
|
282
|
+
metadata: {
|
|
283
|
+
cweId: "CWE-78",
|
|
284
|
+
cvssScore: 9.0,
|
|
285
|
+
exploitability: "high",
|
|
286
|
+
detected: new Date(),
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Scan for credential exposure
|
|
294
|
+
*/
|
|
295
|
+
scanForCredentialExposure(filePath, content, lines) {
|
|
296
|
+
SECURITY_PATTERNS.credentials.forEach((pattern, index) => {
|
|
297
|
+
const matches = Array.from(content.matchAll(pattern));
|
|
298
|
+
matches.forEach((match) => {
|
|
299
|
+
const lineNumber = this.getLineNumber(content, match.index || 0);
|
|
300
|
+
this.addVulnerability({
|
|
301
|
+
id: `cred-${Date.now()}-${index}`,
|
|
302
|
+
severity: "critical",
|
|
303
|
+
type: "Credential Exposure",
|
|
304
|
+
description: `Potential hardcoded credential detected`,
|
|
305
|
+
location: {
|
|
306
|
+
file: filePath,
|
|
307
|
+
line: lineNumber,
|
|
308
|
+
context: "[REDACTED FOR SECURITY]",
|
|
309
|
+
},
|
|
310
|
+
remediation: {
|
|
311
|
+
suggested: "Move credentials to environment variables or secure vault",
|
|
312
|
+
automated: true,
|
|
313
|
+
confidence: 0.85,
|
|
314
|
+
},
|
|
315
|
+
metadata: {
|
|
316
|
+
cweId: "CWE-798",
|
|
317
|
+
cvssScore: 9.8,
|
|
318
|
+
exploitability: "high",
|
|
319
|
+
detected: new Date(),
|
|
320
|
+
},
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Scan for LDAP injection vulnerabilities
|
|
327
|
+
*/
|
|
328
|
+
scanForLDAPInjection(filePath, content, lines) {
|
|
329
|
+
SECURITY_PATTERNS.ldapInjection.forEach((pattern, index) => {
|
|
330
|
+
const matches = Array.from(content.matchAll(pattern));
|
|
331
|
+
matches.forEach((match) => {
|
|
332
|
+
const lineNumber = this.getLineNumber(content, match.index || 0);
|
|
333
|
+
this.addVulnerability({
|
|
334
|
+
id: `ldap-${Date.now()}-${index}`,
|
|
335
|
+
severity: "medium",
|
|
336
|
+
type: "LDAP Injection",
|
|
337
|
+
description: `Potential LDAP injection vulnerability detected: ${match[0]}`,
|
|
338
|
+
location: {
|
|
339
|
+
file: filePath,
|
|
340
|
+
line: lineNumber,
|
|
341
|
+
context: lines[lineNumber - 1]?.trim(),
|
|
342
|
+
},
|
|
343
|
+
remediation: {
|
|
344
|
+
suggested: "Escape LDAP special characters",
|
|
345
|
+
automated: true,
|
|
346
|
+
confidence: 0.7,
|
|
347
|
+
},
|
|
348
|
+
metadata: {
|
|
349
|
+
cweId: "CWE-90",
|
|
350
|
+
cvssScore: 6.8,
|
|
351
|
+
exploitability: "medium",
|
|
352
|
+
detected: new Date(),
|
|
353
|
+
},
|
|
354
|
+
});
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Scan for NoSQL injection vulnerabilities
|
|
360
|
+
*/
|
|
361
|
+
scanForNoSQLInjection(filePath, content, lines) {
|
|
362
|
+
SECURITY_PATTERNS.nosqlInjection.forEach((pattern, index) => {
|
|
363
|
+
const matches = Array.from(content.matchAll(pattern));
|
|
364
|
+
matches.forEach((match) => {
|
|
365
|
+
const lineNumber = this.getLineNumber(content, match.index || 0);
|
|
366
|
+
this.addVulnerability({
|
|
367
|
+
id: `nosql-${Date.now()}-${index}`,
|
|
368
|
+
severity: "high",
|
|
369
|
+
type: "NoSQL Injection",
|
|
370
|
+
description: `Potential NoSQL injection vulnerability detected: ${match[0]}`,
|
|
371
|
+
location: {
|
|
372
|
+
file: filePath,
|
|
373
|
+
line: lineNumber,
|
|
374
|
+
context: lines[lineNumber - 1]?.trim(),
|
|
375
|
+
},
|
|
376
|
+
remediation: {
|
|
377
|
+
suggested: "Validate and sanitize NoSQL queries",
|
|
378
|
+
automated: true,
|
|
379
|
+
confidence: 0.75,
|
|
380
|
+
},
|
|
381
|
+
metadata: {
|
|
382
|
+
cweId: "CWE-943",
|
|
383
|
+
cvssScore: 7.8,
|
|
384
|
+
exploitability: "medium",
|
|
385
|
+
detected: new Date(),
|
|
386
|
+
},
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Scan for CSRF vulnerabilities
|
|
393
|
+
*/
|
|
394
|
+
scanForCSRF(filePath, content, lines) {
|
|
395
|
+
SECURITY_PATTERNS.csrf.forEach((pattern, index) => {
|
|
396
|
+
const matches = Array.from(content.matchAll(pattern));
|
|
397
|
+
matches.forEach((match) => {
|
|
398
|
+
const lineNumber = this.getLineNumber(content, match.index || 0);
|
|
399
|
+
this.addVulnerability({
|
|
400
|
+
id: `csrf-${Date.now()}-${index}`,
|
|
401
|
+
severity: "medium",
|
|
402
|
+
type: "Cross-Site Request Forgery (CSRF)",
|
|
403
|
+
description: `Potential CSRF vulnerability detected: ${match[0]}`,
|
|
404
|
+
location: {
|
|
405
|
+
file: filePath,
|
|
406
|
+
line: lineNumber,
|
|
407
|
+
context: lines[lineNumber - 1]?.trim(),
|
|
408
|
+
},
|
|
409
|
+
remediation: {
|
|
410
|
+
suggested: "Implement CSRF tokens and verify HTTP methods",
|
|
411
|
+
automated: false,
|
|
412
|
+
confidence: 0.6,
|
|
413
|
+
},
|
|
414
|
+
metadata: {
|
|
415
|
+
cweId: "CWE-352",
|
|
416
|
+
cvssScore: 6.5,
|
|
417
|
+
exploitability: "medium",
|
|
418
|
+
detected: new Date(),
|
|
419
|
+
},
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Scan for information disclosure vulnerabilities
|
|
426
|
+
*/
|
|
427
|
+
scanForInfoDisclosure(filePath, content, lines) {
|
|
428
|
+
SECURITY_PATTERNS.infoDisclosure.forEach((pattern, index) => {
|
|
429
|
+
const matches = Array.from(content.matchAll(pattern));
|
|
430
|
+
matches.forEach((match) => {
|
|
431
|
+
const lineNumber = this.getLineNumber(content, match.index || 0);
|
|
432
|
+
this.addVulnerability({
|
|
433
|
+
id: `info-${Date.now()}-${index}`,
|
|
434
|
+
severity: "low",
|
|
435
|
+
type: "Information Disclosure",
|
|
436
|
+
description: `Potential information disclosure detected: ${match[0]}`,
|
|
437
|
+
location: {
|
|
438
|
+
file: filePath,
|
|
439
|
+
line: lineNumber,
|
|
440
|
+
context: lines[lineNumber - 1]?.trim(),
|
|
441
|
+
},
|
|
442
|
+
remediation: {
|
|
443
|
+
suggested: "Disable debug information in production",
|
|
444
|
+
automated: true,
|
|
445
|
+
confidence: 0.8,
|
|
446
|
+
},
|
|
447
|
+
metadata: {
|
|
448
|
+
cweId: "CWE-200",
|
|
449
|
+
cvssScore: 4.3,
|
|
450
|
+
exploitability: "low",
|
|
451
|
+
detected: new Date(),
|
|
452
|
+
},
|
|
453
|
+
});
|
|
454
|
+
});
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Scan for insecure configuration
|
|
459
|
+
*/
|
|
460
|
+
scanForInsecureConfiguration(filePath, content, lines) {
|
|
461
|
+
const insecurePatterns = [
|
|
462
|
+
{ pattern: /ssl\s*[:=]\s*false/gi, desc: "SSL disabled" },
|
|
463
|
+
{ pattern: /verify\s*[:=]\s*false/gi, desc: "Certificate verification disabled" },
|
|
464
|
+
{ pattern: /secure\s*[:=]\s*false/gi, desc: "Insecure configuration" },
|
|
465
|
+
{ pattern: /http:\/\//gi, desc: "HTTP instead of HTTPS" },
|
|
466
|
+
];
|
|
467
|
+
insecurePatterns.forEach((item, index) => {
|
|
468
|
+
const matches = Array.from(content.matchAll(item.pattern));
|
|
469
|
+
matches.forEach((match) => {
|
|
470
|
+
const lineNumber = this.getLineNumber(content, match.index || 0);
|
|
471
|
+
this.addVulnerability({
|
|
472
|
+
id: `config-${Date.now()}-${index}`,
|
|
473
|
+
severity: "medium",
|
|
474
|
+
type: "Insecure Configuration",
|
|
475
|
+
description: `${item.desc}: ${match[0]}`,
|
|
476
|
+
location: {
|
|
477
|
+
file: filePath,
|
|
478
|
+
line: lineNumber,
|
|
479
|
+
context: lines[lineNumber - 1]?.trim(),
|
|
480
|
+
},
|
|
481
|
+
remediation: {
|
|
482
|
+
suggested: "Enable secure configuration options",
|
|
483
|
+
automated: true,
|
|
484
|
+
confidence: 0.9,
|
|
485
|
+
},
|
|
486
|
+
metadata: {
|
|
487
|
+
cweId: "CWE-16",
|
|
488
|
+
cvssScore: 5.0,
|
|
489
|
+
exploitability: "medium",
|
|
490
|
+
detected: new Date(),
|
|
491
|
+
},
|
|
492
|
+
});
|
|
493
|
+
});
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Scan runtime environment for security issues
|
|
498
|
+
*/
|
|
499
|
+
async scanRuntimeEnvironment() {
|
|
500
|
+
// Check environment variables for exposed secrets
|
|
501
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
502
|
+
if (this.containsSensitiveData(key, value || "")) {
|
|
503
|
+
this.addVulnerability({
|
|
504
|
+
id: `env-${Date.now()}-${key}`,
|
|
505
|
+
severity: "high",
|
|
506
|
+
type: "Environment Variable Exposure",
|
|
507
|
+
description: `Sensitive data in environment variable: ${key}`,
|
|
508
|
+
location: {
|
|
509
|
+
context: "Runtime Environment",
|
|
510
|
+
},
|
|
511
|
+
remediation: {
|
|
512
|
+
suggested: "Use secure secret management",
|
|
513
|
+
automated: false,
|
|
514
|
+
confidence: 0.9,
|
|
515
|
+
},
|
|
516
|
+
metadata: {
|
|
517
|
+
cweId: "CWE-200",
|
|
518
|
+
cvssScore: 7.5,
|
|
519
|
+
exploitability: "medium",
|
|
520
|
+
detected: new Date(),
|
|
521
|
+
},
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Scan file system for security issues
|
|
528
|
+
*/
|
|
529
|
+
async scanFileSystem() {
|
|
530
|
+
const sensitiveFiles = [
|
|
531
|
+
".env",
|
|
532
|
+
".env.local",
|
|
533
|
+
".env.production",
|
|
534
|
+
"config.json",
|
|
535
|
+
"secrets.json",
|
|
536
|
+
"private.key",
|
|
537
|
+
"id_rsa",
|
|
538
|
+
];
|
|
539
|
+
for (const fileName of sensitiveFiles) {
|
|
540
|
+
try {
|
|
541
|
+
await fs.access(fileName);
|
|
542
|
+
this.addVulnerability({
|
|
543
|
+
id: `fs-${Date.now()}-${fileName}`,
|
|
544
|
+
severity: "medium",
|
|
545
|
+
type: "Sensitive File Exposure",
|
|
546
|
+
description: `Sensitive file found: ${fileName}`,
|
|
547
|
+
location: {
|
|
548
|
+
file: fileName,
|
|
549
|
+
},
|
|
550
|
+
remediation: {
|
|
551
|
+
suggested: "Ensure file permissions are restrictive and file is in .gitignore",
|
|
552
|
+
automated: true,
|
|
553
|
+
confidence: 0.8,
|
|
554
|
+
},
|
|
555
|
+
metadata: {
|
|
556
|
+
cweId: "CWE-200",
|
|
557
|
+
cvssScore: 6.0,
|
|
558
|
+
exploitability: "low",
|
|
559
|
+
detected: new Date(),
|
|
560
|
+
},
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
catch {
|
|
564
|
+
// File doesn't exist, which is good
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Scan configurations for security issues
|
|
570
|
+
*/
|
|
571
|
+
async scanConfigurations() {
|
|
572
|
+
// This would scan various config files for insecure settings
|
|
573
|
+
this.logger.debug("Scanning configurations for security issues");
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Scan dependencies for known vulnerabilities
|
|
577
|
+
*/
|
|
578
|
+
async scanDependencies() {
|
|
579
|
+
// This would integrate with npm audit or similar tools
|
|
580
|
+
this.logger.debug("Scanning dependencies for vulnerabilities");
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Perform AI-powered analysis for complex patterns
|
|
584
|
+
*/
|
|
585
|
+
async performAIAnalysis() {
|
|
586
|
+
// Advanced AI analysis would go here
|
|
587
|
+
this.logger.debug("Performing AI-powered security analysis");
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Add vulnerability to the list
|
|
591
|
+
*/
|
|
592
|
+
addVulnerability(vulnerability) {
|
|
593
|
+
this.vulnerabilities.push(vulnerability);
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Get line number from string index
|
|
597
|
+
*/
|
|
598
|
+
getLineNumber(content, index) {
|
|
599
|
+
return content.substring(0, index).split("\n").length;
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Check if string contains sensitive data
|
|
603
|
+
*/
|
|
604
|
+
containsSensitiveData(key, value) {
|
|
605
|
+
const sensitiveKeys = ["password", "secret", "key", "token", "auth"];
|
|
606
|
+
const keyLower = key.toLowerCase();
|
|
607
|
+
return (sensitiveKeys.some((sensitive) => keyLower.includes(sensitive)) &&
|
|
608
|
+
value.length > 8 &&
|
|
609
|
+
!/^(true|false|null|undefined|\d+)$/i.test(value));
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Generate scan result summary
|
|
613
|
+
*/
|
|
614
|
+
generateScanResult(scanId, duration) {
|
|
615
|
+
const summary = this.vulnerabilities.reduce((acc, vuln) => {
|
|
616
|
+
acc.total++;
|
|
617
|
+
acc[vuln.severity]++;
|
|
618
|
+
return acc;
|
|
619
|
+
}, { total: 0, critical: 0, high: 0, medium: 0, low: 0 });
|
|
620
|
+
const remediationAvailable = this.vulnerabilities.filter((v) => v.remediation.automated).length;
|
|
621
|
+
return {
|
|
622
|
+
scanId,
|
|
623
|
+
timestamp: new Date(),
|
|
624
|
+
duration,
|
|
625
|
+
vulnerabilities: [...this.vulnerabilities],
|
|
626
|
+
summary,
|
|
627
|
+
remediationAvailable,
|
|
628
|
+
compliance: {
|
|
629
|
+
owasp: summary.critical === 0 && summary.high < 3,
|
|
630
|
+
cwe: summary.total < 10,
|
|
631
|
+
gdpr: this.vulnerabilities.filter((v) => v.type.includes("Disclosure")).length === 0,
|
|
632
|
+
},
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Get scan history
|
|
637
|
+
*/
|
|
638
|
+
getScanHistory() {
|
|
639
|
+
return [...this.scanHistory];
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Get latest scan result
|
|
643
|
+
*/
|
|
644
|
+
getLatestScan() {
|
|
645
|
+
return this.scanHistory.length > 0 ? this.scanHistory[this.scanHistory.length - 1] : null;
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Clear scan history
|
|
649
|
+
*/
|
|
650
|
+
clearHistory() {
|
|
651
|
+
this.scanHistory = [];
|
|
652
|
+
this.remediationHistory = [];
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
//# sourceMappingURL=AISecurityScanner.js.map
|