feat(sandbox): replace hard denies with permission-gated RequiresApproval#83
Merged
yishuiliunian merged 1 commit intomainfrom Apr 5, 2026
Merged
Conversation
…oval for path operations (#80) Sandbox path violations (writes outside cwd, deny_write_globs, deny_read_globs) previously returned hard errors that blocked operations even when the user had already approved the tool. This prevented Loopal from performing legitimate ops tasks like editing /etc/nginx/nginx.conf. Now these "soft denies" flow through the existing permission system: - Bypass mode: auto-allows without prompting - Supervised mode: asks the user with sandbox context - Auto mode: routes to the LLM classifier Hard denies remain for ReadOnly mode and path resolution failures (.. traversal, symlink escape). Key changes: - PathDecision simplified to three-state: Allow / Deny / RequiresApproval - Backend gains approve_path() + check_sandbox_path() for session-scoped approval caching - Runtime pre-checks extract paths from tool input before execution, elevating effective permission to Dangerous when sandbox approval is needed - Execution-time fallback in resolve_checked() handles opaque tools (Bash/Glob/MCP) - 35 new tests across backend, sandbox, and runtime layers
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
Changes
loopal-config/sandbox.rs,loopal-error/io_error.rsPathDecision::Deny+RequiresApproval,ToolIoError::RequiresApprovalloopal-sandbox/path_checker.rsRequiresApproval; ReadOnly staysDenyloopal-tool-api/backend.rsapprove_path()+check_sandbox_path()loopal-backend/approved.rs(new),platform.rs(new),local.rs,path.rsApprovedPathswithRwLock<HashSet>,resolve_checkedfallbacksandbox_precheck.rs(new),tools_check.rsTest plan
bazel test //...— 50 tests passbazel build //... --config=clippy— zero warningsbazel build //... --config=rustfmt— clean