import { ErrorResponseConfig } from '../types'; /** * Custom security error class for handling security violations */ export declare class SecurityError extends Error { readonly type: string; readonly statusCode: 400 | 403 | 404 | 500; readonly severity: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL'; readonly publicMessage: string; readonly metadata?: Record; constructor(message: string, type?: string, statusCode?: 400 | 403 | 404 | 500, severity?: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL', publicMessage?: string, metadata?: Record); /** * Create SecurityError from unknown error */ static fromError(error: unknown): SecurityError; /** /** * Create SQL injection error */ static sqlInjectionDetected(location: string, pattern?: string, metadata?: Record): SecurityError; /** * Create CSV injection error */ static csvInjectionDetected(location: string, pattern?: string, metadata?: Record): SecurityError; /** * Create XSS attack error */ static xssAttackDetected(location: string, pattern?: string, metadata?: Record): SecurityError; /** * Create input validation error */ static validationFailed(field: string, reason: string, metadata?: Record): SecurityError; /** * Create file upload error */ static fileUploadError(reason: string, filename?: string, metadata?: Record): SecurityError; /** * Create malware detection error */ static malwareDetected(filename: string, threatType?: string, metadata?: Record): SecurityError; /** * Create CORS error */ static corsViolation(origin: string, reason?: string, metadata?: Record): SecurityError; /** * Create security header error */ static securityHeaderError(header: string, reason: string, metadata?: Record): SecurityError; /** * Create file upload violation error */ static fileUploadViolation(message: string, metadata?: Record): SecurityError; /** * Create a generic security violation error with detailed internal logging * but simple public message */ static genericViolation(internalMessage: string, violationType: string, severity?: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL', metadata?: Record): SecurityError; /** * Create a security violation with custom public message */ static customViolation(internalMessage: string, violationType: string, publicMessage: string, severity?: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL', statusCode?: 400 | 403 | 404 | 500, metadata?: Record): SecurityError; /** * Get error details for logging */ getDetails(): Record; /** * Get public error response (safe for client) */ getPublicResponse(): Record; /** * Get public error response with configuration support * @param errorResponseConfig - Error response configuration to determine error exposure level */ getPublicResponseWithConfig(errorResponseConfig?: ErrorResponseConfig): Record; /** * Convert to JSON for serialization */ toJSON(): Record; }