Skip to content

fix(sandbox): deny agent edits to the vetted-ops policy - #1308

Merged
potiuk merged 1 commit into
mainfrom
fix/vetted-ops-catalogue-deny
Sep 21, 2026
Merged

potiuk merged 1 commit into
mainfrom
fix/vetted-ops-catalogue-deny

Conversation

@potiuk

@potiuk potiuk commented Sep 21, 2026

Copy link
Copy Markdown
Member

Summary

  • The vetted-ops dispatcher's policy decides which caller may run which operation, so an agent able to rewrite that policy can grant itself the whole catalogue. The framework's own dogfooded .claude/settings.json never carried the deny rules setup-isolated-setup-update checks for — found by running that skill against this checkout.
  • Adds Edit/Write denies for both surfaces the policy resolves to: the committed .apache-magpie-overrides/tools/vetted-ops/ override and the magpie-vetted-ops plugin cache.
  • Keeps tools/sandbox-lint/expected.json in step, which test_baseline_file_matches_live_settings requires.

Type of change

  • Cross-cutting (RFC, AGENTS.md, sandbox, privacy-LLM)

Test plan

  • prek run --all-files passes
  • tools/sandbox-lint green — the two failures this change initially caused (test_baseline_file_matches_live_settings, test_main_exits_zero_on_repo) pass with the baseline updated

RFC-AI-0004 compliance

  • Sandbox — narrows agent write access; adds no host access

Notes for reviewers

In-repo tools/vetted-ops/ is deliberately not denied. It is the framework's own source, gated by PR review rather than a runtime deny. A Write(...) deny there makes the whole subtree read-only to every sandboxed subprocess, including prek's fixers.

That same effect now applies to .apache-magpie-overrides/tools/vetted-ops/, and reviewers should weigh it. prek run --all-files inside a sandboxed agent session now fails with:

failed to open file `.apache-magpie-overrides/tools/vetted-ops/config.toml`: Operation not permitted

CI is unaffected (no agent sandbox there), and a normal git commit is unaffected (hooks only see staged files). What breaks is the repo-wide gate AGENTS.md mandates before every PR, for exactly the people running the framework's secure setup. The gate must be run outside the sandbox until this is resolved. Worth a follow-up: either the deny rules should be Edit-only, or prek needs an exclude for denied paths.

🤖 Generated with Claude Code

The dispatcher's policy decides which caller may run which operation, so
an agent able to rewrite it can grant itself the whole catalogue. The
deny rules `setup-isolated-setup-update` checks for were never present in
the framework's own dogfooded settings.

Covers both surfaces the policy resolves to: the committed
`.apache-magpie-overrides/tools/vetted-ops/` override and the
`magpie-vetted-ops` plugin cache. The in-repo `tools/vetted-ops/` source
is deliberately not denied — it is the framework's own code, gated by PR
review, and a write-deny there makes the tree read-only to every
sandboxed subprocess including `prek`'s fixers.

Keeps `tools/sandbox-lint/expected.json` in step with the live settings.

Generated-by: Claude Opus 5
@potiuk
potiuk merged commit 47a7646 into main Sep 21, 2026
10 checks passed
@potiuk
potiuk deleted the fix/vetted-ops-catalogue-deny branch September 21, 2026 01:38
potiuk added a commit that referenced this pull request Sep 21, 2026
…hooks (#1309)

#1308 added a `permissions.deny` rule on
`.apache-magpie-overrides/tools/vetted-ops/**` without extending the
`sandbox_write_denied` exclude that exists for exactly this case. A deny
rule becomes a sandbox filesystem write-deny, so end-of-file-fixer,
mixed-line-ending and trailing-whitespace abort `prek run --all-files`
inside an agent session with `Operation not permitted`, even though the
file needs no fix.

The policy keeps its coverage: `vetted_ops.config` parses it on every
dispatch, so a malformed file fails the call.

Also states the rule in the comment, since the coupling is easy to miss:
a new `permissions.deny` rule on an in-repo path needs that path added
here too.

Generated-by: Claude Opus 5
potiuk added a commit to potiuk/magpie that referenced this pull request Sep 21, 2026
The marker sat at 0e7012b, where apache#1306 left it, while apache#1305 and
apache#1307-apache#1310 landed on top. Reviewing that delta:

- apache#1305 (stats events cache `updatedAt`) and apache#1307 (dev version bump)
  touch no behaviour any spec describes; no spec references
  `fetch_issues` or the events cache.
- apache#1308, apache#1309 and apache#1310 are the vetted-ops sandbox work, and the
  `excludedCommands` section this branch already rewrites is where
  they belong. That rewrite covers all three.

So the delta is documented and the marker can move. This is the
by-hand route AGENTS.md allows for a small known gap, not a full
`loop.sh update` pass — it reconciles these five commits rather than
re-auditing every skill, tool and modes.md row.

Generated-by: Claude Opus 5
@potiuk potiuk added the substrate:sandbox Tool substrate: agent isolation, egress control, settings audit label Sep 25, 2026
@potiuk potiuk added the family:tools tools/* label Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

family:tools tools/* substrate:sandbox Tool substrate: agent isolation, egress control, settings audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant