validate_file_path

Function validate_file_path 

Source
pub fn validate_file_path(
    path: &str,
    allowed_base: Option<&str>,
) -> Result<PathBuf>
Expand description

Security utilities for validating inputs and preventing common vulnerabilities. Validates that a file path is safe and doesn’t allow directory traversal.

§Arguments

  • path - The path to validate
  • allowed_base - Optional base directory that the path must be within

§Returns

Canonicalized path if valid, error otherwise