priv: reject colons in bind paths to avoid nspawn delimiter confusion

This commit is contained in:
damocles 2026-06-01 17:23:33 +02:00 committed by mara
commit 0b5376249d

View file

@ -359,9 +359,11 @@ fn agent_flake_ref(name: &str) -> String {
fn validate_bind_path(path: &str) -> Result<()> {
if path.is_empty()
|| !path.starts_with('/')
|| path.bytes().any(|b| b == 0 || b == b'\n' || b == b'"')
|| path.bytes().any(|b| b == 0 || b == b'\n' || b == b'"' || b == b':')
{
bail!("invalid bind path {path:?}: must be an absolute path with no newlines, null bytes, or double-quotes");
bail!(
"invalid bind path {path:?}: must be an absolute path with no colons, newlines, null bytes, or double-quotes"
);
}
Ok(())
}