UNPKG

mcp-cve-intelligence-server-lite-test

Version:

Lite Model Context Protocol server for comprehensive CVE intelligence gathering with multi-source exploit discovery, designed for security professionals and cybersecurity researchers - Alpha Release

78 lines 2.52 kB
/** * Secure error handling utilities * Prevents sensitive information disclosure through error messages */ export declare enum ErrorType { VALIDATION = "validation", AUTHENTICATION = "authentication", AUTHORIZATION = "authorization", NOT_FOUND = "not_found", RATE_LIMIT = "rate_limit", INTERNAL = "internal", EXTERNAL_API = "external_api", NETWORK = "network", TIMEOUT = "timeout", CONFIGURATION = "configuration" } export interface SafeError { error: string; message: string; code?: string; timestamp?: string; requestId?: string; } export interface ErrorDetails { type: ErrorType; originalError: Error; context?: Record<string, unknown>; sensitive?: boolean; statusCode?: number; userMessage?: string; } export declare class SecureErrorHandler { private static instance; private isDevelopment; constructor(); static getInstance(): SecureErrorHandler; /** * Creates a safe error response for clients */ createSafeError(errorDetails: ErrorDetails, requestId?: string): SafeError; /** * Sanitizes error messages to remove sensitive information */ sanitizeErrorMessage(message: string): string; /** * Determines if an error contains sensitive information */ containsSensitiveInfo(error: Error): boolean; /** * Creates standardized error messages based on error type */ private createSafeMessage; private getErrorTitle; private getErrorCode; private logError; /** * Helper method to create validation errors */ static createValidationError(message: string, context?: Record<string, unknown>): ErrorDetails; /** * Helper method to create not found errors */ static createNotFoundError(resource: string, context?: Record<string, unknown>): ErrorDetails; /** * Helper method to create internal errors */ static createInternalError(originalError: Error, context?: Record<string, unknown>): ErrorDetails; /** * Helper method to create external API errors */ static createExternalApiError(service: string, originalError: Error, context?: Record<string, unknown>): ErrorDetails; /** * Helper method to create rate limit errors */ static createRateLimitError(limit: number, window: string, context?: Record<string, unknown>): ErrorDetails; } export declare const secureErrorHandler: SecureErrorHandler; //# sourceMappingURL=secure-error-handler.d.ts.map