UNPKG

codecrucible-synth

Version:

Production-Ready AI Development Platform with Multi-Voice Synthesis, Smithery MCP Integration, Enterprise Security, and Zero-Timeout Reliability

93 lines 2.81 kB
/** * Comprehensive Input Validation and Sanitization System * * Provides robust input validation, sanitization, and security * measures to prevent injection attacks and ensure data integrity. */ import { z } from 'zod'; import { ServiceResponse } from '../error-handling/structured-error-system.js'; export declare enum ValidationLevel { BASIC = "basic", STANDARD = "standard", STRICT = "strict", PARANOID = "paranoid" } export interface ValidationOptions { level: ValidationLevel; allowHtml: boolean; allowScripts: boolean; allowFileOperations: boolean; allowSystemCommands: boolean; maxLength: number; customPatterns: RegExp[]; } export interface SanitizationOptions { removeHtml: boolean; escapeSpecialChars: boolean; normalizeWhitespace: boolean; removeControlChars: boolean; maxLength: number; allowedChars: RegExp | null; } export interface ValidationResult { isValid: boolean; sanitizedValue: string; threats: string[]; warnings: string[]; confidence: number; } /** * Advanced Input Validator with threat detection */ export declare class AdvancedInputValidator { private static defaultValidationOptions; private static defaultSanitizationOptions; /** * Comprehensive input validation with threat detection */ static validateInput(input: any, fieldName: string, options?: Partial<ValidationOptions>): ServiceResponse<ValidationResult>; /** * Validate file path with security checks */ static validateFilePath(path: any): ServiceResponse<string>; /** * Validate command input with strict security */ static validateCommand(command: any): ServiceResponse<string>; /** * Validate URL with security checks */ static validateUrl(url: any): ServiceResponse<string>; /** * Detect security threats in input */ private static detectThreats; /** * Detect potential warnings in input */ private static detectWarnings; /** * Get pattern groups based on validation level */ private static getPatternGroups; /** * Assess security risk score (0-1, higher is more dangerous) */ private static assessSecurityRisk; /** * Sanitize input by removing/escaping dangerous content */ private static sanitizeInput; } /** * Schema-based validator with Zod integration */ export declare class SchemaValidator { /** * Validate data against Zod schema with security checks */ static validateWithSchema<T>(data: any, schema: z.ZodSchema<T>, options?: Partial<ValidationOptions>): ServiceResponse<T>; private static performSecurityValidation; private static recursiveSecurityCheck; } //# sourceMappingURL=input-validation-system.d.ts.map