Expand description
Path security utilities to prevent directory traversal attacks
Enums§
Functions§
- normalize_
path - Normalize a path by resolving . and .. components in memory This function does not access the filesystem and works on non-existent paths
- safe_
join - Safely join a user-provided path to a root directory Validates that the result stays within the root
- sanitize_
path_ component - Sanitize a path component by removing or replacing dangerous characters Allows only alphanumeric characters, hyphens, underscores, and dots
- validate_
path_ component - Validate and sanitize a user-provided path component Returns an error if the component contains path traversal attempts
- validate_
path_ within_ root - Validate that a path stays within the allowed root directory This prevents directory traversal attacks