Skip to main content

Module validation

Module validation 

Source
Expand description

Centralized validation and helper functions.

Enums§

ValidationError
Security validation error types

Constants§

MAX_CONTIGS
Maximum number of contigs allowed in a single file (DOS protection)
MAX_FILENAME_LENGTH
Security-related constants for input validation
MIN_FILE_CONTENT_SIZE

Functions§

check_contig_limit
Check if adding another contig would exceed the maximum allowed.
compute_signature
Compute a signature hash from a set of MD5 checksums.
is_valid_md5
Validate that a string is a valid MD5 checksum (32 hex characters).
normalize_md5
Normalize an MD5 string to lowercase. Returns None if the input is not a valid MD5.
validate_file_content
Validate that file content is not malicious or malformed
validate_file_format
Validate file content using magic numbers for known binary formats
validate_filename
Secure filename validation to prevent directory traversal and other attacks
validate_upload
Comprehensive input validation combining filename and content checks