pub fn normalize_and_validate_path(
path: &Path,
cwd: &Path,
) -> Result<PathBuf, PathTraversalError>Expand description
Normalize a path and validate it stays within the cwd.
This is a secure version of path normalization that:
- Converts relative paths to absolute paths
- Cleans the path (removes
.and..components) - Validates the path doesn’t escape the cwd
§Arguments
path- The path to normalize (can be relative or absolute)cwd- The current working directory
§Returns
The normalized absolute path, or an error if path traversal is detected