UNPKG

datapilot-cli

Version:

Enterprise-grade streaming multi-format data analysis with comprehensive statistical insights and intelligent relationship detection - supports CSV, JSON, Excel, TSV, Parquet - memory-efficient, cross-platform

74 lines 2.04 kB
/** * Input Validation and Sanitization * Security layer for file paths and CSV content */ import { DataPilotError } from '../utils/error-handler'; export interface ValidationResult { isValid: boolean; valid: boolean; sanitizedValue?: string; sanitized?: string; errors: (string | DataPilotError)[]; warnings: string[]; } export interface SecurityConfig { allowedExtensions: string[]; maxFileSize: number; maxPathLength: number; allowedDirectories: string[]; blockedPatterns: RegExp[]; } export declare class InputValidator { private config; constructor(config?: Partial<SecurityConfig>); /** * Validate and sanitize file path */ validateFilePath(inputPath: string): ValidationResult; /** * Validate CSV content header */ validateCSVHeader(header: string): ValidationResult; /** * Validate individual CSV field */ validateCSVField(field: string, maxLength?: number): ValidationResult; /** * Validate configuration object */ validateConfig(config: any): ValidationResult; /** * Validate CLI input options */ validateCLIInput(options: Record<string, unknown>, context?: any): ValidationResult; /** * Comprehensive security validation */ validateInput(input: { filePath?: string; config?: any; csvHeader?: string; }): ValidationResult; private getFileExtension; } export declare const globalInputValidator: InputValidator; /** * Factory function for easy access */ export declare function getInputValidator(): InputValidator; /** * External data validator for additional security checks */ export declare class ExternalDataValidator { private validator; constructor(); /** * Validate external data sources */ validateDataSource(source: string, context?: any): ValidationResult; /** * Sanitize external input */ sanitizeInput(input: string): string; } //# sourceMappingURL=input-validator.d.ts.map