Reject empty HOME envvar

This commit is contained in:
2026-03-20 21:43:08 +01:00
parent 4112288a30
commit ada9da7ae7
5 changed files with 30 additions and 3 deletions

View File

@@ -284,6 +284,25 @@ fn relative_ro_path_works() {
);
}
#[test]
fn empty_home_rejected() {
let output = sandbox(&[])
.env("HOME", "")
.args(["--", "true"])
.output()
.expect("agent-sandbox binary failed to execute");
assert!(
!output.status.success(),
"expected failure with empty HOME, but got success"
);
let stderr = String::from_utf8_lossy(&output.stderr);
assert!(
stderr.to_lowercase().contains("home"),
"expected error mentioning HOME, got: {stderr}"
);
}
#[test]
fn rw_missing_path_errors() {
let output = sandbox(&["--rw", "/nonexistent/xyz"])