Repository navigation
test: cover denied executable relocation through the broker - #201
kevin-orellana wants to merge 3 commits into
Conversation
## Problem The complete workload route lacks regression tests for execution after a denied directory moves. Existing identity checks already refuse that route. ## Solution Add six production tests for directory replacement, missing names, symbolic links, and scripts with listed or unlisted interpreters. Check execution markers, file identities, permitted execution, and unrelated renames. Use the existing prerequisite probe to report unsupported Linux execution platforms explicitly. Production code and public interfaces remain unchanged. ## Tests All six denied_executable tests executed and passed on Amazon Linux 2023 ARM64 before the prerequisite probe addition. Workspace lint passed with the repository's vendored allowances, and cargo fmt --all passed. Independent review found and verified the prerequisite probe correction. The full workspace suite and deterministic suite are running for the final source. macOS execution remains pending hosted validation. Earlier mutation evidence on e0af331 showed three actual executions when the denial identity check was disabled. The other three variants retained overlapping refusals.
|
Assessment: Comment (non-blocking) Solid, well-constructed regression coverage for the denied-executable relocation route. The suite exercises production Box through its aliases, asserts exit status, marker contents, and file identities together, and attaches a JSON evidence blob to every assertion — matching the "assert both status and effect" guidance in Review Categories
Nicely scoped regression work. |
|
Assessment: Comment (non-blocking) I re-reviewed head Checks that held
I could not run the suite: this host is x86_64, where these tests skip. |
|
Assessment: Approve I re-reviewed head Checks that held
I could not run the suite here, because it skips on x86_64. I'm relying on the author's report that all six cases pass on Linux ARM64. |
|
Consolidated into #264 at a25b98d. The merge preserves all three commits and imports the six tests unchanged, including the readability fixes and post-relocation control assertions. All eight regression cases passed together on Linux ARM64. The combined workspace suite passed with 4,619 reported passes, zero failures, and 17 ignored tests, plus the custom harness target. Hosted validation continues on #264. Closing this PR as superseded so review continues in one place: #264. |
Human readable section
Problem. Box already refuses execution after a denied directory changes identity, but the complete workload route lacks regression coverage.
A test must show that the denied program never writes its marker after relocation.
Solution. Add six tests that invoke production Box through its shell and Python aliases.
They cover an empty replacement directory, a missing original name, symbolic-link replacement, invocation through a symbolic link, and scripts with listed or unlisted interpreters.
Controls verify permitted execution, interpreter selection, and unrelated directory renames.
Named executable and invocation variants describe each case.
Each test contains its replacement and interpreter assertions.
Shared assertions check exit statuses, marker contents, and file identities outside the workload.
Trade-off. This change adds tests only.
It preserves the existing refusal of further program launches when a denied path changes identity.
Hosts that cannot run the Linux namespace launcher print an explicit prerequisite skip.
Such skips do not establish execution coverage.
Description
The tests exercise the broker route after a permitted rename moves a denied directory within an executable directory grant.
They verify that the relocated program stays refused, even when an empty directory replaces the original name.
filesystem::require_judged_identitiesalready checks the identities that the run recorded at startup before launching a program.No production code, grants, policy rules, or public interfaces change.
The new platform prerequisite check follows the existing fixture convention.
Earlier mutation validation used the original test body on
e0af331d457222d7fb189f9548653b92492eaa15.Disabling only the denial identity check caused three variants to execute and write markers: replacement directory, linked binary, and listed-interpreter script.
The other three variants retained overlapping refusals.
The investigation restored production source byte-for-byte after that experiment.
Related Issues
Regression coverage for existing denied-executable behavior. This pull request does not close an issue or establish deployment qualification.
Type of Change
Other: regression tests for existing execution refusals.
Testing
Readability revision
Revision:
032773d78e558d370aa3f4ab261f2b97f0e37497.The refactor changes only
crates/box/tests/denied_executable.rs.The six test names, generated workload, evidence fields, and prior assertions remain unchanged.
Two added assertions check the existing post-mutation control: status 126 and no execution marker.
The result retains the fixture until each test finishes its filesystem assertions.
Local validation used Linux ARM64 and Rust 1.98.1, with
EXPERIMENTAL_LINUX_SUPPORT=TRUE, four build jobs, and four workspace test threads.31ec426: 4,517 reported passes and 17 ignored tests, plus the custombox_librarytarget. Zero failures.31ec426. The focused run rebuilt the changed test for this revision.cargo fmt --all --checkpassed.just clippy.032773d. Maintainer approval remains required.The focused command was
cargo test -p strands-box --all-features --test denied_executable -- --show-output --test-threads=1.The workspace command was
cargo test --workspace --all-features --no-fail-fast -- --show-output.Counts use the final result from each Cargo target and exclude nested child results.
The custom
box_librarytarget does not emit a test count.The final revision adds only the two control assertions after the full workspace run. All six focused tests, formatting, and workspace lint passed again.
Workspace logs also report prerequisite skips for the absent credential daemon, a missing adjacent alias binary, and unsupported execute-without-read enforcement.
Those skipped assertions do not establish coverage.
Hosted checks used merge commit
5060ce2887f0ded15a9298fa524de6596e9378da, which combines032773dwith main ate4ca8b8.The macOS workspace log suppresses successful test output, so it does not support a complete audit of prerequisite skips across that suite.
Original test revision
The results below cover
3323c483d77e343c6ce13ca037e9229c6fc943b0.They remain as historical evidence and do not validate the readability revision.
Local validation uses Amazon Linux 2023 ARM64 with
EXPERIMENTAL_LINUX_SUPPORT=TRUE. Hosted validation also covers macOS.The original candidate starts from
6418aadand contains only the added regression test file.Commit:
3323c483d77e343c6ce13ca037e9229c6fc943b0.The required CI gate passed.
The final Linux execution command was:
EXPERIMENTAL_LINUX_SUPPORT=TRUE CARGO_BUILD_JOBS=1 cargo test -p strands-box --all-features --test denied_executable -- --nocapture --test-threads=1just clippy, with zero warnings.cargo fmt --allpassed.The hosted runs linked above cover the original revision. Both local deterministic failures occur in unchanged test code.
The local failures remain recorded above; successful hosted runs do not erase them.
The original automated review completed with nonblocking readability feedback. This revision addresses that feedback and the maintainer's follow-up comments.
just check, orcargo test --workspace --all-features)cargo fmt --allandcargo clippy --workspace --all-targets --all-features -- -D warningsThe repository's
just clippyrecipe permits specific vendored lints after-D warnings.The checked lint item uses that documented recipe, including its exact allowances. It does not claim an unrestricted strict lint run.
Checklist
No documentation update is necessary because the change preserves all documented production behavior and test commands.
AI disclosure: Codex prepared these tests and this description at the contributor’s request.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.