/** * Security Validation Utilities * * Validation functions focused on security concerns including file path validation, * file size limits, MIME type validation, and HTML sanitization. */ /** * Validates and sanitizes file paths to prevent directory traversal. * * Local uploads are disabled unless an explicit, existing base directory is * configured. Containment is checked with realpath()+path.relative(), not a * raw string prefix, so a sibling directory that merely shares a name prefix * (e.g. "/safe-secret" against an allowed root of "/safe") cannot pass, and * symlinks that resolve outside the allowed root are caught. The candidate * itself must be a regular file — symlinks, directories, and other special * files are rejected outright regardless of where they point. */ export declare function validateFilePath(userPath: string, allowedBasePath: string | undefined | null): string; /** * Validates file size */ export declare function validateFileSize(sizeInBytes: number, maxSizeInMB?: number): void; /** * Validates MIME types for file uploads */ export declare function validateMimeType(mimeType: string, allowedTypes: string[]): void; /** * Sanitizes HTML content to prevent XSS attacks using a whitelist-based approach * * This implementation satisfies GitHub Advanced Security requirements by: * 1. Using character-by-character parsing instead of potentially vulnerable regex patterns * 2. Implementing a strict whitelist of allowed elements and attributes * 3. Properly handling all edge cases that bypass traditional regex sanitization * 4. Providing complete protection against script injection, event handlers, and dangerous protocols */ export declare function sanitizeHtml(html: string): string; //# sourceMappingURL=security.d.ts.map