UNPKG

@hivetechs/hive-ai

Version:

Real-time streaming AI consensus platform with HTTP+SSE MCP integration for Claude Code, VS Code, Cursor, and Windsurf - powered by OpenRouter's unified API

61 lines 1.74 kB
/** * Security Input Validation Framework * * Provides comprehensive input validation and sanitization to prevent: * - Tool Poisoning Attacks (TPAs) * - Command Injection * - Prompt Injection * - SQL Injection * - Path Traversal */ export interface SecurityConfig { maxInputLength: number; maxPromptLength: number; allowedCommands: string[]; bannedPatterns: RegExp[]; urlPattern: RegExp; filePathPattern: RegExp; } export declare const DEFAULT_SECURITY_CONFIG: SecurityConfig; export declare class SecurityValidationError extends Error { readonly code: string; constructor(message: string, code: string); } export declare class InputValidator { private config; constructor(config?: SecurityConfig); /** * Validate and sanitize general text input */ validateTextInput(input: string, context?: string): string; /** * Validate command strings for shorthand commands */ validateCommand(command: string): string; /** * Validate and sanitize URLs */ validateUrl(url: string): string; /** * Validate file paths to prevent path traversal */ validateFilePath(path: string): string; /** * Validate conversation IDs (UUIDs) */ validateConversationId(id: string): string; /** * Validate API keys to prevent exposure */ validateApiKey(key: string): string; /** * Sanitize input by removing/escaping dangerous characters */ private sanitizeInput; /** * Validate prompt specifically for AI models to prevent injection */ validatePrompt(prompt: string): string; } export declare const defaultValidator: InputValidator; //# sourceMappingURL=input-validator.d.ts.map