/** * Security utilities for XSS prevention and URL validation * Provides centralized functions for safe URL handling and input sanitization */ /** * Validates if a URL is safe to use (only allows http and https protocols) * Prevents javascript: and other dangerous URL schemes */ export declare const isValidUrl: (url: string) => boolean; /** * Safely encodes URL parameters to prevent injection attacks * Encodes special characters that could be used for URL manipulation */ export declare const safeEncodeURIComponent: (str: string) => string; /** * Validates and sanitizes external URLs from user input * Returns null if URL is invalid or dangerous */ export declare const validateExternalUrl: (url: string) => string | null; /** * Sanitizes CSS content to prevent CSS injection attacks * Removes dangerous CSS properties and values that could be used for attacks */ export declare const sanitizeCSS: (css: string) => string; /** * Validates phone numbers with timeout protection against ReDoS attacks * Uses a simple, efficient pattern that prevents catastrophic backtracking */ export declare const validatePhoneNumber: (phone: string) => boolean; /** * Validates and sanitizes string inputs with length and content restrictions * Prevents injection attacks and ensures data integrity */ export declare const validateStringInput: (input: unknown, maxLength?: number, allowedChars?: RegExp) => string | null; /** * Validates numeric inputs with range constraints * Ensures numbers are within safe bounds and prevents NaN/Infinity */ export declare const validateNumericInput: (input: unknown, min?: number, max?: number) => number | null; /** * Validates boolean inputs and converts string representations * Safely handles various boolean representations */ export declare const validateBooleanInput: (input: unknown) => boolean | null; /** * Validates color values (hex, rgb, rgba, named colors) * Prevents CSS injection through color values */ export declare const validateColorInput: (input: unknown) => string | null; //# sourceMappingURL=security.d.ts.map