/** * Input validation and sanitization for Slack events and content * Prevents injection attacks and validates event structure */ import type { SlackMentionEvent } from '../multi-agent/slack-multi-bot-manager.js'; export interface SlackEventValidationError extends Error { name: 'SlackEventValidationError'; field?: string; value?: unknown; } export interface ValidationOptions { /** Maximum message content length (default: 4000) */ maxContentLength?: number; /** Whether to allow bot messages (default: true) */ allowBotMessages?: boolean; /** Custom forbidden patterns */ forbiddenPatterns?: RegExp[]; /** Whether to strip HTML/markdown (default: true) */ stripMarkdown?: boolean; /** Whitelist of allowed characters/patterns (default: null for no whitelist) */ allowedCharacters?: RegExp; /** Whether to use strict whitelist validation (default: false) */ useWhitelistValidation?: boolean; } /** * Validates Slack channel ID format (C followed by alphanumeric) */ export declare function validateChannelId(channelId: string): boolean; /** * Validates Slack user ID format (U followed by alphanumeric) */ export declare function validateUserId(userId: string): boolean; /** * Validates Slack bot ID format (B followed by alphanumeric) */ export declare function validateBotId(botId: string): boolean; /** * Validates Slack timestamp format (Unix timestamp with microseconds) */ export declare function validateTimestamp(ts: string): boolean; /** * Sanitizes message content by removing potentially dangerous patterns */ export declare function sanitizeMessageContent(content: string, options?: ValidationOptions): string; /** * Validates a Slack mention event structure and sanitizes content */ export declare function validateMentionEvent(event: unknown, options?: ValidationOptions): SlackMentionEvent; /** * Creates a validation error with consistent structure */ export declare function createValidationError(message: string, field?: string, value?: unknown): SlackEventValidationError; /** * Checks if an error is a Slack event validation error */ export declare function isValidationError(error: unknown): error is SlackEventValidationError; /** * Safe wrapper for validation that returns result or null on error */ export declare function safeValidateMentionEvent(event: unknown, options?: ValidationOptions): SlackMentionEvent | null; /** * Validation presets for different security levels */ export declare const ValidationPresets: { /** Strict validation with maximum security */ STRICT: ValidationOptions; /** Standard validation for normal use */ STANDARD: ValidationOptions; /** Permissive validation with basic checks only */ PERMISSIVE: ValidationOptions; /** Whitelist-only validation for ultra-secure environments */ WHITELIST_ONLY: ValidationOptions; }; //# sourceMappingURL=slack-input-validator.d.ts.map