import sanitizeHtml from 'sanitize-html';
/**
 * Options for path sanitization
 */
export interface PathSanitizeOptions {
    /** Restrict paths to a specific root directory */
    rootDir?: string;
    /** Normalize Windows-style paths to POSIX-style */
    toPosix?: boolean;
    /** Allow absolute paths (if false, converts to relative paths) */
    allowAbsolute?: boolean;
}
/**
 * Context-specific input sanitization options
 */
export interface SanitizeStringOptions {
    /** Handle content differently based on context */
    context?: 'text' | 'html' | 'attribute' | 'url' | 'javascript';
    /** Custom allowed tags when using html context */
    allowedTags?: string[];
    /** Custom allowed attributes when using html context */
    allowedAttributes?: Record<string, string[]>;
}
/**
 * Configuration for HTML sanitization
 */
export interface HtmlSanitizeConfig {
    /** Allowed HTML tags */
    allowedTags?: string[];
    /** Allowed HTML attributes (global or per-tag) */
    allowedAttributes?: sanitizeHtml.IOptions['allowedAttributes'];
    /** Allow preserving comments - uses allowedTags internally */
    preserveComments?: boolean;
    /** Custom URL sanitizer */
    transformTags?: sanitizeHtml.IOptions['transformTags'];
}
/**
 * Sanitization class for handling various input sanitization tasks
 */
export declare class Sanitization {
    private static instance;
    /** Default list of sensitive fields for sanitizing logs */
    private sensitiveFields;
    /** Default sanitize-html configuration */
    private defaultHtmlSanitizeConfig;
    /**
     * Private constructor to enforce singleton pattern
     */
    private constructor();
    /**
     * Get the singleton Sanitization instance
     * @returns Sanitization instance
     */
    static getInstance(): Sanitization;
    /**
     * Set sensitive fields for log sanitization
     * @param fields Array of field names to consider sensitive
     */
    setSensitiveFields(fields: string[]): void;
    /**
     * Get the current list of sensitive fields
     * @returns Array of sensitive field names
     */
    getSensitiveFields(): string[];
    /**
     * Sanitize HTML content using sanitize-html library
     * @param input HTML string to sanitize
     * @param config Optional custom sanitization config
     * @returns Sanitized HTML
     */
    sanitizeHtml(input: string, config?: HtmlSanitizeConfig): string;
    /**
     * Sanitize string input based on context.
     *
     * **Important:** Using `context: 'javascript'` is explicitly disallowed and will throw an `McpError`.
     * This is a security measure to prevent accidental execution or ineffective sanitization of JavaScript code.
     *
     * @param input String to sanitize
     * @param options Sanitization options
     * @returns Sanitized string
     * @throws {McpError} If `context: 'javascript'` is used.
     */
    sanitizeString(input: string, options?: SanitizeStringOptions): string;
    /**
     * Sanitize URL with robust validation and sanitization
     * @param input URL to sanitize
     * @param allowedProtocols Allowed URL protocols
     * @returns Sanitized URL
     * @throws {McpError} If URL is invalid
     */
    sanitizeUrl(input: string, allowedProtocols?: string[]): string;
    /**
     * Sanitize file paths to prevent path traversal attacks
     * @param input Path to sanitize
     * @param options Options for path sanitization
     * @returns Sanitized and normalized path
     * @throws {McpError} If path is invalid or unsafe
     */
    sanitizePath(input: string, options?: PathSanitizeOptions): string;
    /**
     * Sanitize a JSON string
     * @param input JSON string to sanitize
     * @param maxSize Maximum allowed size in bytes
     * @returns Parsed and sanitized object
     * @throws {McpError} If JSON is invalid or too large
     */
    sanitizeJson<T = unknown>(input: string, maxSize?: number): T;
    /**
     * Ensure input is within a numeric range
     * @param input Number or string to validate
     * @param min Minimum allowed value (inclusive)
     * @param max Maximum allowed value (inclusive)
     * @returns Sanitized number within range
     * @throws {McpError} If input is not a valid number
     */
    sanitizeNumber(input: number | string, min?: number, max?: number): number;
    /**
     * Sanitize input for logging to protect sensitive information
     * @param input Input to sanitize
     * @returns Sanitized input safe for logging
     */
    sanitizeForLogging(input: unknown): unknown;
    /**
     * Private helper to convert attribute format from record to sanitize-html format
     */
    private convertAttributesFormat;
    /**
     * Recursively redact sensitive fields in an object or array
     */
    private redactSensitiveFields;
}
export declare const sanitization: Sanitization;
/**
 * Sanitize input for logging to protect sensitive information.
 * Kept as a separate export for convenience.
 * @param input Input to sanitize
 * @returns Sanitized input safe for logging
 */
export declare const sanitizeInputForLogging: (input: unknown) => unknown;
