///
import { Request } from '@loopback/rest';
import { FileUploadConfig } from '../types';
import { SecurityLogger } from '../utils/security-logger';
/**
* File upload handler that validates file uploads for security
*/
export declare class FileUploadHandler {
private config?;
private logger?;
private readonly allowedMimeTypes;
private readonly allowedExtensions;
private readonly dangerousExtensions;
constructor(config?: FileUploadConfig | undefined, logger?: SecurityLogger | undefined);
/**
* Validate file uploads in the request
*/
validateFileUploads(req: Request): Promise;
/**
* Extract files from request (simplified - depends on middleware used)
*/
private extractFiles;
/**
* Validate a single file
*/
private validateSingleFile;
/**
* Validate file content matches declared type
*/
private validateFileContent;
/**
* Get file signature from buffer
*/
private getFileSignature;
/**
* Detect file type from signature
*/
private detectFileType;
/**
* Get expected MIME types for a detected file signature
*/
private getMimeTypesForSignature;
/**
* Check for suspicious content in file
*/
private containsSuspiciousContent;
/**
* Scan file for malware (placeholder implementation)
*/
private scanForMalware;
/**
* Get upload statistics
*/
getStats(): {
maxFileSize: number;
maxFiles: number;
allowedMimeTypes: string[];
allowedExtensions: string[];
validateContent: boolean;
scanForMalware: boolean;
allowExecutables: boolean;
};
/**
* Add allowed MIME type
*/
addAllowedMimeType(mimeType: string): void;
/**
* Remove allowed MIME type
*/
removeAllowedMimeType(mimeType: string): void;
/**
* Add allowed file extension
*/
addAllowedExtension(extension: string): void;
/**
* Remove allowed file extension
*/
removeAllowedExtension(extension: string): void;
/**
* Update configuration
*/
updateConfig(config: Partial): void;
}