Skip to main content

Module pathsafe

Module pathsafe 

Source
Expand description

Filesystem-path traversal barrier.

Filesystem paths in this workbench are frequently assembled from operator-supplied values — CLI output flags, the web output directory, run identifiers, and git repo locations. Before such a path reaches a filesystem operation it is passed through reject_traversal, which refuses any path that contains a parent-directory (..) segment and returns a fresh owned path rebuilt from the validated string. Callers must use the returned value for the filesystem call so the check dominates the operation and no .. sequence can walk outside the intended location.

Functions§

reject_traversal
Reject a path that contains a parent-directory (..) segment.