/** * Image security utilities and Sharp configuration * Prevents pixel bomb attacks and validates image dimensions */ import { type ResizeOptions, type Sharp } from 'sharp'; /** * Initialize Sharp with security settings * Should be called once at application startup */ export declare function initializeSharpSecurity(): void; /** * Validate image buffer before processing and return the safe bytes to process. * SVG input may be sanitized, while raster input is returned unchanged. */ export declare function validateImageBuffer(imageBuffer: Buffer, allowSvg?: boolean): Promise; /** * Validate SVG content for security risks using DOMPurify and return cleaned bytes */ export declare function validateSvgContent(svgBuffer: Buffer): Promise; /** * Sanitize SVG content and return cleaned result for testing */ export declare function sanitizeSvgContent(svgContent: string): string; /** * Create a secure Sharp instance with safety checks */ export declare function createSecureSharpInstance(imageBuffer: Buffer): Sharp; /** * Execute a Sharp operation with direct instance creation * Use this for one-shot operations */ export declare function withSecureSharp(imageBuffer: Buffer, operation: (sharp: Sharp) => Promise): Promise; /** * Safely resize image with dimension validation */ export declare function secureResize(sharpInstance: Sharp, width: number, height: number, options?: ResizeOptions): Sharp; /** * Create a Sharp instance with metadata removal for privacy and security */ export declare function createSecureSharpWithCleanMetadata(imageBuffer: Buffer): Sharp; /** * Execute a Sharp operation with direct instance creation and clean metadata * Use this for one-shot operations that need automatic cleanup */ export declare function withSecureSharpCleanMetadata(imageBuffer: Buffer, operation: (sharp: Sharp) => Promise): Promise; /** * Validate Sharp processing limits before operations */ export declare function validateSharpLimits(width: number, height: number): void; /** * Export security constants for use in other modules */ export declare const IMAGE_SECURITY_LIMITS: { readonly MAX_INPUT_PIXELS: number; readonly MAX_IMAGE_WIDTH: 8192; readonly MAX_IMAGE_HEIGHT: 8192; readonly MAX_FILE_SIZE: number; readonly MAX_SVG_SIZE: number; readonly MAX_DPI: 600; readonly PROCESSING_TIMEOUT: 30000; readonly ALLOWED_IMAGE_FORMATS: ("png" | "jpeg" | "webp" | "jpg" | "gif" | "bmp" | "tiff")[]; };