defaultMode: acceptEdits silently overrides per-path permissions.ask rules for Write/Edit
Summary
When permissions.defaultMode is set to "acceptEdits", all Write and Edit tool calls are auto-approved regardless of explicit per-path entries in permissions.ask. The ask rules silently never fire. Users configuring path-specific guardrails (e.g. protecting ~/.claude/projects/**/memory/** or settings.json) get no protection and no warning that their rules are inert.
Severity rationale
Confidentiality / integrity: an agent can silently write to user-profile-scoped paths (memory, plans, hooks, even settings.json itself) that the user explicitly listed in ask expecting a prompt. The presence of the rule in ask creates a false sense of protection — worse than no rule, because the user trusts it.
Reproduction
~/.claude/settings.json:
{
"permissions": {
"ask": [
"Write(C:\\Users\\<user>\\.claude\\projects\\**\\memory\\**)",
"Edit(C:\\Users\\<user>\\.claude\\projects\\**\\memory\\**)"
],
"defaultMode": "acceptEdits"
}
}
- Start a Claude Code session.
- Have the agent invoke
WriteagainstC:\Users\<user>\.claude\projects\<proj>\memory\test.md. - Expected: prompt (the
askrule matches). - Actual: file written silently, no prompt.
Precedence currently observed (reverse-engineered from behavior)
deny— wins (correct)defaultMode: acceptEditsshort-circuits allWrite/Editcallsallow/askper-path entries — never consulted for Write/Edit
Expected precedence (principle of least surprise)
denyask(per-path) — explicit-most rules winallow(per-path)defaultMode— fallback only when no rule matches
Workarounds available to users today
- Move per-path protections from
ask→deny(verified to work —denywins overacceptEdits). - Drop
defaultMode: acceptEditsentirely — every edit prompts.
Both impose friction the design clearly tried to avoid.
Proposed fix
ask (and allow) entries that explicitly match the candidate tool+path should take precedence over defaultMode. defaultMode is a fallback, not a master switch. At minimum, document the current precedence loudly in settings docs and emit a startup warning when both acceptEdits and per-path ask rules for Write/Edit are present.
Environment
- Claude Code (VS Code extension)
- OS: Windows 11 Pro 10.0.26200
settings.jsonschema:https://json.schemastore.org/claude-code-settings.json
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗