From 3d60dbde5d5c419dc18c7edd9986f2ebad76dc04 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Fri, 3 Apr 2026 21:11:18 +0200 Subject: [PATCH] exec: remove sandbox fallback on permission error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Silent fallback from the anvilmcp sandbox to the default sandbox on permission errors undermined the sandbox policy — a restriction firing is the sandbox working correctly, not a failure to recover from. Sandbox selection is now explicit: the requested policy runs, and failure surfaces as an error. Also removes the now-unused IsPermissionError helper from ollie/exec. Co-Authored-By: Claude Sonnet 4.6 --- main.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/main.go b/main.go index 83520cf..c03f261 100644 --- a/main.go +++ b/main.go @@ -213,7 +213,6 @@ func handleToolCall(req MCPRequest) { timeout = int(t) } sandbox, _ := params.Arguments["sandbox"].(string) - sandboxExplicit := sandbox != "" if sandbox == "" { sandbox = "anvilmcp" } @@ -224,12 +223,6 @@ func handleToolCall(req MCPRequest) { fmt.Fprintf(os.Stderr, "[anvilmcp] Executing %s code (timeout: %ds, sandbox: %s, trusted: %v)\n", language, timeout, sandbox, trusted) result, err := executor.Execute(code, language, timeout, sandbox, trusted) - // Fallback to default sandbox on permission errors (only if sandbox wasn't explicit) - if err != nil && !sandboxExplicit && execpkg.IsPermissionError(err) { - fmt.Fprintf(os.Stderr, "[anvilmcp] Permission error in %s sandbox, falling back to default\n", sandbox) - result, err = executor.Execute(code, language, timeout, "default", trusted) - } - // Log token comparison codeTokens := estimateTokens(code) outputTokens := estimateTokens(result)