diff --git a/Cargo.lock b/Cargo.lock index ac62037b..36237b79 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4027,9 +4027,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "heel" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92b21e0932552edec5f468d427e6209474117e0add549585bdddc5f9051250e3" +checksum = "e5e3c715cefcaf79c098fc7c326a4e4877a30fc00622f96ef3fff0e0d0a7bf15" dependencies = [ "askama 0.12.1", "async-channel", diff --git a/patch/third-party-tools.json b/patch/third-party-tools.json index 56bf6930..7f8c2efe 100644 --- a/patch/third-party-tools.json +++ b/patch/third-party-tools.json @@ -452,78 +452,78 @@ }, { "tool": "heel", - "version": "0.10.0", + "version": "0.10.1", "target": { "os": "linux", "arch": "aarch64" }, - "url": "https://github.com/May-Agent/heel/releases/download/heel-v0.10.0/heel-aarch64-unknown-linux-gnu", - "sha256": "c570c123a4938ae352064811cd03ee352611cbc13713cc53f8d39819a52d03f1", + "url": "https://github.com/May-Agent/heel/releases/download/heel-v0.10.1/heel-aarch64-unknown-linux-gnu", + "sha256": "75667a4d8cb988c016494b4ca5c24ae776d58918fbd16a94ff7f42ffdae02094", "size": 4596960, "encoding": { "format": "executable" }, - "executable_sha256": "c570c123a4938ae352064811cd03ee352611cbc13713cc53f8d39819a52d03f1" + "executable_sha256": "75667a4d8cb988c016494b4ca5c24ae776d58918fbd16a94ff7f42ffdae02094" }, { "tool": "heel", - "version": "0.10.0", + "version": "0.10.1", "target": { "os": "linux", "arch": "x86_64" }, - "url": "https://github.com/May-Agent/heel/releases/download/heel-v0.10.0/heel-x86_64-unknown-linux-gnu", - "sha256": "0bc9a8bca5002c98b8ba8d08d23156ca1c04e61a65419232a93fd1f8a6f43d89", + "url": "https://github.com/May-Agent/heel/releases/download/heel-v0.10.1/heel-x86_64-unknown-linux-gnu", + "sha256": "022684b48d70d7e986ecb8f058c791271a945b9c263968f46b0907e6cd021849", "size": 5132184, "encoding": { "format": "executable" }, - "executable_sha256": "0bc9a8bca5002c98b8ba8d08d23156ca1c04e61a65419232a93fd1f8a6f43d89" + "executable_sha256": "022684b48d70d7e986ecb8f058c791271a945b9c263968f46b0907e6cd021849" }, { "tool": "heel", - "version": "0.10.0", + "version": "0.10.1", "target": { "os": "macos", "arch": "aarch64" }, - "url": "https://github.com/May-Agent/heel/releases/download/heel-v0.10.0/heel-aarch64-apple-darwin", - "sha256": "59805477c62b499c143fb8a8cd1d8ddbffaf71efc35aa296553b2d18cbfc8582", + "url": "https://github.com/May-Agent/heel/releases/download/heel-v0.10.1/heel-aarch64-apple-darwin", + "sha256": "74be3a57e6b597aef483a5223246d0dd173dcf599d5312c10d9ee2e13adce63c", "size": 4130928, "encoding": { "format": "executable" }, - "executable_sha256": "59805477c62b499c143fb8a8cd1d8ddbffaf71efc35aa296553b2d18cbfc8582" + "executable_sha256": "74be3a57e6b597aef483a5223246d0dd173dcf599d5312c10d9ee2e13adce63c" }, { "tool": "heel", - "version": "0.10.0", + "version": "0.10.1", "target": { "os": "windows", "arch": "aarch64" }, - "url": "https://github.com/May-Agent/heel/releases/download/heel-v0.10.0/heel-aarch64-pc-windows-msvc.exe", - "sha256": "cf7370f86f7d1b91556197a4b47b5a77d8ec6480b9223bc9b273c51f995ffcf5", + "url": "https://github.com/May-Agent/heel/releases/download/heel-v0.10.1/heel-aarch64-pc-windows-msvc.exe", + "sha256": "428a6b3e2140b00b24740b756ce5607dffed78dd48fc8062f5eae6d5e4ebeb07", "size": 4672000, "encoding": { "format": "executable" }, - "executable_sha256": "cf7370f86f7d1b91556197a4b47b5a77d8ec6480b9223bc9b273c51f995ffcf5" + "executable_sha256": "428a6b3e2140b00b24740b756ce5607dffed78dd48fc8062f5eae6d5e4ebeb07" }, { "tool": "heel", - "version": "0.10.0", + "version": "0.10.1", "target": { "os": "windows", "arch": "x86_64" }, - "url": "https://github.com/May-Agent/heel/releases/download/heel-v0.10.0/heel-x86_64-pc-windows-msvc.exe", - "sha256": "48f66a0ecfeab2d2415d81265e6f176cd9208e212b3f3fe4b80783189513e502", - "size": 5570048, + "url": "https://github.com/May-Agent/heel/releases/download/heel-v0.10.1/heel-x86_64-pc-windows-msvc.exe", + "sha256": "721fc67c7d5f70bf487a7a21abd4aef1f6ca8d9a933202af1b6bf64908eea510", + "size": 5537280, "encoding": { "format": "executable" }, - "executable_sha256": "48f66a0ecfeab2d2415d81265e6f176cd9208e212b3f3fe4b80783189513e502" + "executable_sha256": "721fc67c7d5f70bf487a7a21abd4aef1f6ca8d9a933202af1b6bf64908eea510" } ], "python": [ diff --git a/sandbox/Cargo.toml b/sandbox/Cargo.toml index 3f4b3704..bd690fb0 100644 --- a/sandbox/Cargo.toml +++ b/sandbox/Cargo.toml @@ -20,7 +20,7 @@ arc-swap.workspace = true aither-core.workspace = true # Sandboxing -heel = "0.10.0" +heel = "0.10.1" # Executor for tokio integration executor-core = { version = "0.7", features = ["tokio"] } diff --git a/sandbox/src/terminal.rs b/sandbox/src/terminal.rs index 34dbeb5e..ff0b0f14 100644 --- a/sandbox/src/terminal.rs +++ b/sandbox/src/terminal.rs @@ -9382,20 +9382,41 @@ mod tests { } /// A script the sandboxed command writes into its working directory and - /// chmods executes — writable space also carries EXEC. + /// chmods executes — writable space also carries EXEC, and nothing still + /// holds the file open for writing when the shell runs it. #[cfg(unix)] #[tokio::test(flavor = "multi_thread")] async fn a_script_written_into_the_working_dir_executes() { let dir = tempfile::tempdir().expect("temp dir should be created"); let tool = authority_terminal(dir.path()).await; - assert_eq!( - exit_code_of( - &tool, - "echo '#!/bin/sh\necho ok' > run.sh && chmod +x run.sh && ./run.sh", + let result = tool + .call( + terminal_args( + "write and run a script", + "echo '#!/bin/sh\necho ok' > run.sh && chmod +x run.sh && ./run.sh", + ), + ToolContext::new(), ) - .await, - 0, - "a script the command writes and chmods runs" + .await + .expect("terminal call should succeed"); + let command = result.command().expect("the script runs as a command"); + // The shell names the errno of a failed exec on stderr: `Text file + // busy` is a write descriptor still open at `execve`, `Permission + // denied` the sandbox refusing EXEC. + let stderr = command + .stderr + .as_ref() + .and_then(output_text) + .unwrap_or_default(); + assert_eq!( + command.outcome, + CommandOutcome::Exited { code: 0 }, + "a script the command writes and chmods runs; stderr: {stderr}" + ); + assert_eq!( + output_text(&command.stdout).map(str::trim), + Some("ok"), + "stderr: {stderr}" ); }