Expand description
Path sanitization utilities.
Provides secure path handling to prevent path traversal attacks. All user-provided paths must be validated through this module.
Functionsยง
- safe_
copy - Validate both paths and copy file in one atomic step.
- safe_
open_ file_ async - Async variant: validate path and open a file in one atomic step.
- safe_
read_ dir - Async variant: validate path and read directory in one atomic step.
- safe_
read_ to_ string - Validate path and read file contents in one atomic step. Prevents path traversal by combining validation with the read operation.
- safe_
read_ to_ string_ async - Async variant: validate path and read file contents in one atomic step.
- sanitize_
existing_ path - Sanitize and validate a user-provided path.
- sanitize_
new_ path - Sanitize a path that may not exist yet (for creation).
- validate_
read_ path - Validate a path is safe for reading (must exist, be under allowed base).
- validate_
write_ path - Validate a path is safe for writing.