Expand $PWD in config paths to the launch directory

This commit is contained in:
2026-11-17 20:37:01 +01:00
parent 34bc50a256
commit 352ead2bf5
6 changed files with 134 additions and 13 deletions
+19
View File
@@ -43,6 +43,25 @@ fn cwd_is_writable() {
);
}
#[test]
fn config_pwd_binds_launch_directory_writable() {
let dir = TempDir::new().unwrap();
let config = ConfigFile::new(r#"rw = ["$PWD"]"#);
let output = Command::new(env!("CARGO_BIN_EXE_agent-sandbox"))
.args(["--config", &config, "--", "touch", "canary"])
.current_dir(dir.path())
.output()
.expect("agent-sandbox binary failed to execute");
assert!(
output.status.success(),
"stderr: {}",
String::from_utf8_lossy(&output.stderr)
);
assert!(dir.path().join("canary").exists());
}
#[test]
fn host_fs_is_readonly() {
let output = Sandbox::new(&[])