pub fn is_safe_path_component(name: &str) -> boolExpand description
Whether name is safe to use as a single path component.
Accepts [A-Za-z0-9._-]+ and nothing else. Everything a caller supplies as
“the name of a thing” - a blueprint name from a REST body, a run id from a
URL segment - must pass this before it is joined onto a directory, because
Path::join does not normalize and does not resist an absolute path:
agents_dir().join("../../../../tmp/x") // escapes
agents_dir().join("/etc/cron.d/x") // replaces the base entirelyThat was reachable from POST /api/blueprints (arbitrary directory creation
and manifest write) and DELETE /api/blueprints/{name} (arbitrary recursive
deletion, via a percent-encoded ..%2f that decodes after segment matching).
A leading . is allowed (dotted names are ordinary) but . and ..
themselves are not, since both are traversal rather than names.