validate_path_with_env

Function validate_path_with_env 

Source
pub fn validate_path_with_env(path: &Path, env: &dyn EnvProvider) -> bool
Expand description

Validate a path for security issues

§Security Checks

  • No null bytes in path
  • No control characters in path components
  • No suspicious patterns (Windows reserved names)
  • Reasonable component and total length limits
  • Valid UTF-8

§Arguments

  • path - Path to validate
  • env - Environment provider for configurable limits

§Returns

true if path is safe to use, false otherwise

§Platform-Specific Behavior

This function applies cross-platform validation rules, including Windows-reserved names, even on Unix systems. This ensures consistent behavior and prevents issues when configs are shared across platforms.