pub fn validate_file_path(path: &str) -> Result<PathBuf>Expand description
Validates a file path to prevent directory traversal attacks
§Security Checks
- Rejects absolute paths
- Rejects paths with
..components - Ensures path stays within current working directory
- Normalizes and canonicalizes the path
§Arguments
path- User-provided file path
§Returns
Ok(PathBuf)if path is valid and safeErr(io::Error)if path violates security constraints