When Answering Is Administering: Permission Replies That Rewrite Coding-Agent Policy
Fei et al. in Agents
A permission reply can rewrite a coding agent's rules
When Answering Is Administering: Permission Replies That Rewrite Coding-Agent Policy
A reply changes the rules future calls see
Claude Code rechecks allowed calls against current deny rules; matching denies are meant to block them.
A reply can also persist a rule update, changing the policy later calls are checked against.
One unrelated approval removes a secret-file deny

With no file access, a remote approver allows an unrelated command and deletes `Read(./.env)` from settings. The runtime persists it, so reads succeed now and later. Red marks lost restrictions; blue marks retained ones.
An update reaches beyond the shell sandbox
Three tested shell rewrites could not read `.env`, edit settings, or escape the strict sandbox.
The runtime writes settings outside the shell. A deny removal lifts file limits; added Edit, WebFetch, or host rules can widen sandbox access even under deny-overrides.
Without owner labels, preserve every current denial
Claude Code stores bare rule strings. Without authorship, a filter reading current rules must preserve every reader's current denials; original restrictions persist.
- M(u(R))
- Actions refused after the update
- ⊇
- Contains every earlier refusal
- M(R)
- Actions refused before the update
Per-step checks can miss a sequence
- 1
Copy the deny
A plugin adds its own copy of the operator's deny; access stays blocked.
- 2
Delete original
The per-step check accepts removal because the plugin's copy still blocks access.
- 3
Delete copy
Its next deletion allows the initially denied action; an owner-aware check blocks the earlier removal.
The safe bound depends on what the runtime remembers

Panel (a) ties updates to recorded information. Panel (b) shows a per-step failure; one protected class per party can preserve others' denials and lift own-only restrictions, where readers preserve those denials.
Saved 'always allow' answers can shadow denies
- 1
The permission-check bound
A saved allow is safe only if it matches the asked call alone or ranks no higher than every deny.
- 2
opencode example
Its `rm ./build.log` answer saves `rm *`; last-match-wins lets the broad rule override `rm -rf *`.
Put one validator where answers share a path

Four answer routes feed a shared update step; none writes the managed tier. Five of 70 inspected relays forwarded updates, including the vendor's Remote Control. Put the validator at that common point.
The bounds predict across systems and guide a repair
The model uses what a party may change, how rules combine, and whether authorship is recorded. It matched all 13 studied designs across 10 systems; five predictions preceded testing.
The validator preserved the operator's restrictions in every repaired attack run; safe filters had zero losses in 20,000 randomized settings-monitor runs. Only 2 of 2,227 fetched plugins sent updates; repair keeps their proposed changes.
Scope and limits
Trusted mediator
The runtime must mediate every update; authorship records must stay outside answerers' reach.
Reader semantics
Owner labels work only where each reader preserves each author's denials; allow-list readers may require additions blocked.
Test boundary
Sandbox tests used Linux/bubblewrap. Runtime, OS, or managed-tier compromise and prompt-injection steering are out of scope; hook/MCP state remains future work.
Why it matters
- A per-call deny check is insufficient when its answer can rewrite policy for later calls.
- Validate effects across every reader at the shared write step; record rule authors so parties can remove their own changes.
- How far should the same audit extend to hooks, MCP settings, and other state future checks trust?
12 slides, 3 min
6 days ago