Skip to main content

Module path_safety

Module path_safety 

Source
Expand description

Path validation for file-system operations.

The CLI operates on files in the current project directory. These helpers canonicalize paths and ensure they cannot escape that directory before they are passed to file-system APIs.

Functionsยง

existing_file
Resolve an existing relative file only when it is inside the current project directory.
output_directory
Resolve an existing relative output directory inside the current project directory.
read_project_file
Read a project-local file after validating its path at the file-system boundary.
remove_project_file
Remove a project-local file after validating its path at the file-system boundary.
write_project_file
Write an SVG only when its parent directory is inside the current project directory.