Repository navigation
Commit cea0d41
committed
fix(plan-mode): enforce bash restriction and scope subagent permission inheritance
Plan mode currently relies solely on a system prompt to prevent write
operations via the bash tool. Since the permission system only denies
edit-class tools (edit, write, apply_patch), bash remains unrestricted
and the model can execute arbitrary shell commands including writes.
Changes:
1. agent/agent.ts — Add bash: { "*": "deny" } to the plan agent's
permission config. This blocks direct bash tool use in plan mode via
the permission evaluation layer and hides bash from the tool list
(disabled() correctly maps the 'bash' tool ID to the 'bash' permission
via its fallthrough case).
2. agent/subagent-permissions.ts — Restrict parent deny inheritance to
write-capable permissions (edit, write, apply_patch, bash) instead of
inheriting ALL parent denies. Prior behavior (anomalyco#26597) blindly inherited
every deny rule, which overrode subagents' explicit allows for unrelated
permissions (e.g., explore's bash: allow was silently neutralized).
Fixes anomalyco#22641
Addresses anomalyco#267001 parent 5f61d21 commit cea0d41
2 files changed
Lines changed: 14 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
176 | 179 | | |
177 | 180 | | |
178 | 181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| 16 | + | |
| 17 | + | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
| |||
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
22 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
23 | 29 | | |
24 | 30 | | |
25 | 31 | | |
| |||
0 commit comments