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 02:04:32 UTC

(magpie) branch main updated: fix(vetted-ops): exclude the read dispatcher from the sandbox (#1310)

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

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/magpie.git


The following commit(s) were added to refs/heads/main by this push:
     new 87be68b8 fix(vetted-ops): exclude the read dispatcher from the sandbox (#1310)
87be68b8 is described below

commit 87be68b8d08da8d5d1ace9b8cc4bcf4001eb3c87
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Mon Sep 21 04:04:27 2026 +0200

    fix(vetted-ops): exclude the read dispatcher from the sandbox (#1310)
    
    `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