/// import { Request } from '@loopback/rest'; import { ValidationConfig } from '../types'; import { SecurityLogger } from '../utils/security-logger'; /** * Input validator that sanitizes and validates incoming request data */ export declare class InputValidator { private config?; private logger?; private readonly maxBodySizeBytes; private skipFields; constructor(config?: ValidationConfig | undefined, logger?: SecurityLogger | undefined, skipFields?: string[]); /** * Validate and sanitize input from request */ validateAndSanitizeInput(req: Request): Promise; /** * Validate body size */ private validateBodySize; /** * Check if a field should be skipped from validation */ private shouldSkipField; /** * Process object recursively for validation and sanitization */ private processObject; /** * Process individual string value */ private processStringValue; /** * Check if field should preserve forward slashes (like S3 keys, file paths) */ private shouldPreserveSlashes; /** * Sanitize string input */ private sanitizeString; /** * Validate field based on its type/name */ private validateFieldType; /** * Check if field name indicates email */ private isEmailField; /** * Check if field name indicates URL */ private isUrlField; /** * Check if field name indicates phone number */ isPhoneField(fieldName: string): boolean; /** * Validate email format */ private isValidEmail; /** * Validate URL format */ private isValidUrl; /** * Validate phone number format * Supports multiple international formats */ isValidPhoneNumber(phone?: string): boolean; /** * Check for suspicious patterns */ private checkForSuspiciousPatterns; /** * Validate parameter lengths */ private validateParameterLengths; /** * Recursively check object lengths */ private checkObjectLengthsRecursive; /** * Parse size string to bytes */ private parseSize; /** * Format bytes for human readable display */ private formatBytes; /** * Sanitize value for logging */ private sanitizeLogValue; /** * Check if value contains CSV injection patterns */ private containsCsvInjectionPattern; /** * Get the CSV injection pattern from the value */ private getCsvInjectionPattern; /** * Check if field is whitelisted for CSV injection (typically phone fields) */ private isWhitelistedCsvField; /** * Get validation statistics */ getStats(): { maxBodySizeBytes: number; maxParameterLength: number; sanitizeInput: boolean; strictMode: boolean; validateEmails: boolean; validateUrls: boolean; }; /** * Update configuration */ updateConfig(config: Partial): void; }