Skip to main content

is_addressable_nar_path

Function is_addressable_nar_path 

Source
pub fn is_addressable_nar_path(url: &str) -> bool
Expand description

Whether a narinfo’s URL: is a NAR path this store can safely address.

A narinfo is input — it arrives over PUT /<hash>.narinfo — and its URL: is used both as a key and, on LocalStorage, as a path joined onto the cache root. URL: ../../etc/passwd therefore has to be refused at the boundary rather than sanitized at each use; this predicate is that boundary.

Accepts a non-empty relative path of non-empty segments, none of which is . or .., with no control characters and no backslash.