safename 0.1.0

Filename and path validation for security hardening
Documentation
//! Path validation and sanitization.
//!
//! This module validates paths by splitting on `/` and validating each component
//! independently. It does **not** perform path canonicalization or normalization.
//!
//! # What This Module Does NOT Do
//!
//! - **No canonicalization**: Paths are not resolved to absolute paths
//! - **No symlink resolution**: Symbolic links are not followed
//! - **No `..` handling**: Parent directory references are validated as literal names
//! - **No normalization**: Consecutive slashes and `.` components are preserved
//!
//! This is intentional. Path canonicalization has security implications (TOCTOU races,
//! symlink attacks) and should be handled separately by the caller if needed.
//!
//! # Example
//!
//! ```
//! use safename::is_path_safe;
//!
//! // Validates each component, doesn't resolve the path
//! assert!(is_path_safe("/home/../etc/passwd")); // ".." is a valid component name
//! assert!(!is_path_safe("/home/-rf"));          // "-rf" starts with dash
//! ```

mod sanitization;
mod validation;

pub use sanitization::{PathSanitizationOptions, sanitize_path, sanitize_path_with_options};
pub use validation::{
    PathValidationOptions, is_path_safe, validate_path, validate_path_with_options,
};