Skip to main content

safe_path_in

Function safe_path_in 

pub async fn safe_path_in(
    root: impl AsRef<Path>,
    path: impl AsRef<Path>,
) -> Result<PathBuf, Error>
Available on crate feature std only.
Expand description

Resolve path below root after applying root-confined path validation.

path is treated as relative to root; absolute paths, .. traversal, reserved device names, smuggled prefixes, and symbolic links that resolve outside root are rejected. root itself must exist.

The returned PathBuf is not a capability: if the directory tree is modified after this function returns, callers must validate again or perform the filesystem operation through a safe helper.