You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@magpie.apache.org by po...@apache.org on 2026/09/21 01:54:43 UTC

(magpie) 01/01: fix(vetted-ops): exclude the read dispatcher from the sandbox

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch fix/vetted-ops-sandbox-exclusion
in repository https://gitbox.apache.org/repos/asf/magpie.git

commit d6d91dcd3be0a03d1cd60d397929003e5ea76f62
Author: Jarek Potiuk <po...@apache.org>
AuthorDate: Mon Sep 21 03:52:39 2026 +0200

    fix(vetted-ops): exclude the read dispatcher from the sandbox
    
    `gh` cannot verify TLS inside the sandbox — on macOS every call fails
    with `x509: OSStatus -26276` — which is why the framework already
    excludes bare `gh *`. A `gh` spawned inside `uv run … vetted-op-read` is
    not a bare `gh` invocation, so it stayed sandboxed and every read
    operation failed: the `permissions.allow` entry the README documents
    bought nothing on macOS.
    
    Adds the exclusion to the dogfooded settings and documents it in the
    tool's "Wiring it into settings" section, beside the allow / ask / deny
    rules it completes. Only `vetted-op-read` is excluded, never
    `vetted-op` — the read dispatcher refuses writes before it consults the
    policy, so running it outside the sandbox exposes only the fixed read
    operations.
    
    Verified: `vetted-op-read viewer` now returns the login instead of the
    TLS error, with no session restart.
    
    Generated-by: Claude Opus 5
---
 .claude/settings.json            |  4 +++-
 tools/sandbox-lint/expected.json |  4 +++-
 tools/vetted-ops/README.md       | 21 +++++++++++++++++++++
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/.claude/settings.json b/.claude/settings.json
index 61b09465..89a772da 100644
--- a/.claude/settings.json
+++ b/.claude/settings.json
@@ -3,7 +3,9 @@
   "sandbox": {
     "enabled": true,
     "excludedCommands": [
-      "gh *"
+      "gh *",
+      "uv run --project tools/vetted-ops vetted-op-read *",
+      "uv run --project ~/.claude/plugins/cache/apache-magpie/magpie-vetted-ops/*/tools/vetted-ops vetted-op-read *"
     ],
     "filesystem": {
       "denyRead": [
diff --git a/tools/sandbox-lint/expected.json b/tools/sandbox-lint/expected.json
index 61b09465..89a772da 100644
--- a/tools/sandbox-lint/expected.json
+++ b/tools/sandbox-lint/expected.json
@@ -3,7 +3,9 @@
   "sandbox": {
     "enabled": true,
     "excludedCommands": [
-      "gh *"
+      "gh *",
+      "uv run --project tools/vetted-ops vetted-op-read *",
+      "uv run --project ~/.claude/plugins/cache/apache-magpie/magpie-vetted-ops/*/tools/vetted-ops vetted-op-read *"
     ],
     "filesystem": {
       "denyRead": [
diff --git a/tools/vetted-ops/README.md b/tools/vetted-ops/README.md
index 02382a73..72f5b7e2 100644
--- a/tools/vetted-ops/README.md
+++ b/tools/vetted-ops/README.md
@@ -286,6 +286,27 @@ anything still invoked directly:
 }
 ```
 
+The read dispatcher also needs a `sandbox.excludedCommands` entry, or the
+`allow` rule above buys nothing. The framework already excludes bare `gh *`
+because a sandboxed `gh` cannot verify TLS — on macOS it fails with
+`x509: OSStatus -26276`. A `gh` spawned *inside* `uv run … vetted-op-read` is
+not a bare `gh` invocation, so it stays sandboxed and every read operation
+fails the same way:
+
+```jsonc
+"sandbox": {
+  "excludedCommands": [
+    "gh *",
+    "uv run --project ~/.claude/plugins/cache/apache-magpie/magpie-vetted-ops/*/tools/vetted-ops vetted-op-read *"
+  ]
+}
+```
+
+Only `vetted-op-read` is excluded, never `vetted-op` — the same reasoning as the
+`allow` rule. The read dispatcher refuses writes before it consults the policy
+at all, so running it outside the sandbox exposes only the fixed read
+operations; excluding the write dispatcher would run the whole catalogue there.
+
 The dispatcher must live where the agent cannot rewrite it — otherwise an agent
 that edits `ops.py` has defeated the whole design. That is why it ships as the
 `magpie-vetted-ops` **substrate plugin**: the installed plugin tree is not a path