pub fn is_safe_path(path: &Path) -> Result<bool>
Expand description
Checks if a given path is safe to use.
Validates that the provided path does not contain directory traversal attempts or other potential security risks.
§Arguments
path
- The path to validate
§Returns
Ok(true)
- If the path is safe to useOk(false)
- If the path contains unsafe elementsErr
- If path validation fails
§Security
This function prevents directory traversal attacks by:
- Resolving symbolic links
- Checking for parent directory references (
..
) - Validating path components