Expand description
Validation for names that become a single filesystem path component.
Collection names, partition directory names, and segment file names all
arrive from outside the process — SQL DDL, a Raft InstallSnapshot blob, a
RESTORE payload — and are then joined onto a data directory. A name that is
not a single plain component escapes that directory: .. walks out of it,
an embedded separator writes into a subtree the caller never named, and a
leading / discards the base entirely (Path::join replaces the whole path
on an absolute argument). Since the same names are also passed to
remove_dir_all, an unchecked one deletes outside the data directory too.
Every path builder that joins an externally supplied name calls
is_plain_path_component first and raises its own domain error, so the
rejection names the payload that carried the bad name.
Functions§
- is_
plain_ path_ component - Whether
nameis safe to join onto a directory as exactly one component.