fix(automation): refuse Watch Folder and Edit Original while file access is confined

This commit is contained in:
Dylan M. Taylor
2026-11-03 14:42:29 +00:00
parent 7870b5916a
commit 7be3d4b4a1
+16 -2
View File
@@ -59,7 +59,13 @@ const REFUSED: &[&str] = &[
"file.revealInFinder",
"layer.openSource",
"help.revealLogFile",
// Hands the footage file to the platform's default application.
"edit.editOriginal",
"file.autoSave",
// Watch Folder renders the projects it finds to the outputs they name and writes status
// files into the watched folder: neither is a path the agent gives, so neither is checked.
"file.watchFolder",
"file.watchFolder.poll",
];
/// Commands that read files named by these parameters.
@@ -74,7 +80,6 @@ const READS: &[(&str, &[&str])] = &[
("file.replaceFootage", &["path"]),
("file.relinkFootage", &["folder"]),
("file.setProxy", &["path"]),
("file.watchFolder", &["folder"]),
("anim.applyPreset", &["path"]),
("anim.applyRecentPreset", &["path"]),
("keys.rpfCameraImport", &["path"]),
@@ -88,7 +93,6 @@ const READS: &[(&str, &[&str])] = &[
// unchecked.
("essential.templateInfo", &["path"]),
("file.importProject", &["path"]),
("file.watchFolder.poll", &["folder"]),
("footage.relink", &["path"]),
("layer.newModel", &["path"]),
("mediaBrowser.fileInfo", &["path"]),
@@ -575,6 +579,16 @@ mod tests {
}
}
#[test]
fn watch_folder_and_edit_original_are_refused_while_confined() {
let dir = std::env::temp_dir();
let c = Confinement::new(std::slice::from_ref(&dir), std::slice::from_ref(&dir)).unwrap();
for id in ["file.watchFolder", "file.watchFolder.poll", "edit.editOriginal"] {
let e = c.check_command(id, &serde_json::json!({"folder": dir.to_string_lossy()})).unwrap_err().to_string();
assert!(e.contains("not available while file access is confined"), "{id}: {e}");
}
}
#[test]
fn relative_and_outside_paths_of_newly_listed_commands_are_refused() {
let base = std::env::temp_dir().join(format!("ec-confine-1243-{}", std::process::id()));