Coding agents let plugins and remote services answer permission prompts, and Claude Code documents that such an answer cannot override the operator's deny rules. However, we show that this guarantee, checked one decision at a time, fails over a whole run, because an answer to one permission prompt can rewrite the policy that every later answer is checked against. For example, a remote service with no access to the operator's files approves an unrelated command and attaches an update that deletes the deny rule protecting the project's secrets. The agent then reads the secrets in that session and the next, even inside the vendor's strict sandbox. The root cause is that Claude Code checks only updates that add or replace allow rules. Relays that forward such deletions already exist, including the vendor's own Remote Control. In effect, the right to answer a prompt has become the right to administer the policy. Worse, the deletion leaves the same records as a local edit by the operator, so Claude Code cannot tell who wrote a rule. More generally, what a runtime records decides what it can safely delegate. A runtime that cannot tell who wrote a rule can accept only updates that keep every currently denied call denied, whereas, to protect every party's restrictions, a runtime that records who wrote each rule can let each party remove only the restrictions proven to be its own. We prove that these two bounds are tight. They correctly predict whether the operator's restrictions survive in all thirteen permission designs across ten agent systems, including predictions we wrote down before running Codex, Gemini CLI, opencode, and Goose. Enforcing the bounds at the shared update step blocks the attack. A survey of 2,227 fetched marketplace plugins finds only two that send policy updates.
Figures & tables
Fig. 1: An attack case: one answer to an unrelated prompt rewrites the operator’s policy. Red marks lost restrictions, and blue marks retained ones.
Fig. 2: Answer routes and the policy-update path in Claude Code. Red marks the path of a deny removal, and blue marks the managed tier, which no route writes.
What the remote side can send
Tools
Rule updates it writes, deny removals included
5
A choice among updates the runtime or relay proposes
25
A decision only
37
Not determinable from the code
3
Table I: Updates that deployed relays accept from their remote side. The survey covers 70 relays, and the first row includes the vendor’s Remote Control.
Fig. 3: Bounds on safe delegation. (a) The updates a runtime can safely accept, given what it records. (b) A single plugin that defeats a per-step check, and the step at which the per-class check of Theorem 2 (i) stops it.
Fig. 4: Attack runs on Claude Code. Cells count the runs, of six (three per release) or 24 for live models, in which the operator’s restriction was lost, with losses shaded, untested conditions dashed, and ∗ marking a control shared with the first column.
Update
Denied set shrinks
Vendor behavior
Predicted
Recorded
Label
Session-only
addRules , allow
no
no
widening
session only
addRules , deny
no
no
restrictive
session only
addRules , ask
no
no
restrictive
session only
replaceRules , allow
no
no
widening
dropped
replaceRules , deny
yes
yes
restrictive
as an addition
Table II: Predicted and recorded effects of rule updates on the denied set. Predictions follow Theorem 1 , and vendor labels and session-only behavior are from build 2.1.312.
Design and authority
Prediction and observed behavior
Validation
Design
A party may change
Records authors
Prediction
Observed
Two releases
Predicted first
Live model
Repair tested
Answers that delete or replace restrictions (Theorem 1 )
Claude Code , default answers
any rule update
no
unsafe
deny deleted, sandbox open
⚫
⚫
⚫
Claude Code, managed tier
nothing
—
safe
rule kept, call refused
⚫
Claude Code, session-only
additions for the session
no
safe
removals dropped
source
Gemini CLI, extensions
labeled deny and ask rules
yes
safe (Cor. 3)
own rules removed on stop
⚫
⚫
Table III: Cross-system validation of the bounds on thirteen permission designs. The marks on the right give the evidence behind each row.
Fig. 5: Predicted and observed outcomes of saved answers. Cells count executions of the denied command out of six runs (three per release), with lost restrictions shaded, untested cells blank, and the cutoff of Theorem 3 dashed.
Violated runs / 5,000
Combining rule
First word
Asked call
First word, ranked low
Deny-overrides
0
0
0
Last match wins
2,567 †
0
0
Priority ordering
2,591 †
0
0
Table IV: Simulated safety of saved answers under three combining rules. Each cell counts violated runs out of 5,000, and † marks the cells that Theorem 3 calls unsafe.
Fig. 6: Comparison of seven filters on 20,000 random runs. The trace column replays Figure 3 (b), with ✗ where the operator’s rule is lost, own lifts apply to safe filters only, and decision time uses 40 policy entries.
Fig. 7: Hook use in the vendor’s plugin marketplace. Shares are of the 2,227 plugins we fetched.
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
Region
What it shows
Answer filter
the loop shown below, unchanged apart from identifiers
Hook and SDK paths
in the default mode, updates are applied and persisted without that filter unless a suppression condition holds
Prompt-handler path
applies the loop shown below, and a filter that keeps deny rules applies only for one named server under a feature flag
Default mode
each of the 12 answer entry points of build 2.1.319 selects the default answer kind ( launcher ), not session-only answer mode
Update validator
labels removals of allow rules, and additions or replacements of deny or ask rules, as restrictive, labels every other rule update as widening, and applies a well-formed widening update
Session-only cap
in session-only answer mode, drops every removeRules , addDirectories , removeDirectories , and replacement of allow rules, and rewrites every other addition or replacement as a session-only addition
Appendix
Table V: Binary regions that handle an answer’s updates in Claude Code. We read each region from build 2.1.312, and each occurs once.
Saved answers
Filters
for Table IV
for Figure 6
Runs
5,000 per combining rule
20,000
Operator’s rules
2–5 deny and 1–3 allow, at random priorities below a saved answer’s
2–5 deny, 1–3 allow, and 0–1 ask, each in a random settings file, plus a managed deny rule in 30% of runs
Answers
6 “always” answers, each to a random call outside the current denied set
6, each from one of three parties, carrying one rule update of random type, behavior, and destination that names 1–2 rules, after which the session ends with probability 0.25
Patterns
10 deny, 4 allow
11 deny, 7 allow, 1 ask
Appendix
Table VI: Generator settings for the two sets of random runs.
Artificial intelligence agent security studies attacks and safeguards for tool-using, persistent, and collaborative systems across digital and physical settings.