Skip to main content

safe_path

Function safe_path 

Source
pub fn safe_path(
    path: &Path,
    allowed_root: &Path,
) -> Result<PathBuf, SecurityError>
Expand description

Ensure a path stays within an allowed directory (no ../ traversal).

Both path and allowed_root are canonicalized before comparison, so symlinks and relative components are resolved.