test(tools): add FileExecutor allowed_paths integration tests (#2117)#2127
Merged
test(tools): add FileExecutor allowed_paths integration tests (#2117)#2127
Conversation
15 integration tests covering sandbox access controls: read/write inside allowed paths, blocked access outside cwd, symlink escape (unix), path traversal, tilde regression (#2115), multiple allowed paths, cross-boundary move/copy, and glob/grep default-path confinement.
…executor-access-tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds 15 integration tests for
FileExecutoraccess control (sandbox enforcement viaallowed_paths). Closes #2117.read,write,edit,list_directory,create_directory,delete_path,move_path,copy_path) blocked for outside-sandbox paths#[cfg(unix)]../..) blockedallowed_pathsenforced independentlyallowed_paths = []falls back to cwd#2115) — documents current buggy behaviordelete_sandbox_root_blocked— cannot delete the sandbox root itselfmove/copyblocked in all 4 directionsfind_pathglob results are post-filtered to exclude outside-sandbox pathsgrepwith default path (".") stays within sandboxDocker omission rationale
The issue proposed Docker+testcontainers for a controlled FS hierarchy. After analysing the implementation, Docker is unnecessary:
FileExecutorenforces access via a purestarts_with(allowed_path)check on the local filesystem — there are no Unix permission boundaries, chroot, or container namespaces involved.tempfile::TempDirprovides identical, deterministic isolation with no external dependencies and sub-millisecond teardown. This avoids Docker daemon requirements in CI and local development.Test execution
Post-merge action
Security issue #2125 filed:
resolve_via_ancestorsdoes not normalize..in suffix for non-existent intermediate directories — real sandbox bypass. Tracked separately.Test plan
cargo +nightly fmt --checkpassescargo clippy --workspace --features full -- -D warningspassescargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins— 6366 passedcargo nextest run -p zeph-tools --test file_access— 15 passed