01 dynamic mount commands

This commit is contained in:
Rai (Michael Pokorny)
2025-06-24 14:30:34 -07:00
parent 2f0109faeb
commit b23d44cb5c
9 changed files with 386 additions and 13 deletions

View File

@@ -253,6 +253,25 @@ impl SandboxPolicy {
}
}
impl SandboxPolicy {
/// Grant disk-write permission for the specified folder.
pub fn allow_disk_write_folder(&mut self, folder: std::path::PathBuf) {
self.permissions.push(SandboxPermission::DiskWriteFolder { folder });
}
/// Revoke any disk-write permission for the specified folder.
pub fn revoke_disk_write_folder<P: AsRef<std::path::Path>>(&mut self, folder: P) {
let target = folder.as_ref();
self.permissions.retain(|perm| {
if let SandboxPermission::DiskWriteFolder { folder: f } = perm {
f != target
} else {
true
}
});
}
}
/// Permissions that should be granted to the sandbox in which the agent
/// operates.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]