[BUG] Edit/Write tools bypass permissions.ask rules (regression of #11226)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
## Description
Edit and Write tools do not respect permissions.ask rules in settings.json, making it impossible to protect
critical files (hooks, settings) from modification.
## Related Issues
- #11226 (closed/locked - same issue)
- Recent fix in v2.1.27 for Bash ask/allow hierarchy should apply to Edit/Write tools
## Configuration
.claude/settings.json:
```json
{
"permissions": {
"ask": [
"Edit(.claude/hooks/)",
"Write(.claude/hooks/)",
"Edit(.claude/settings.json)",
"Write(.claude/settings.json)"
]
}
}
What Should Happen?
Claude should prompt before editing files matching the ask patterns.
Error Messages/Logs
Steps to Reproduce
- Setup
Create a test project with protected files:
mkdir test-permissions && cd test-permissions
mkdir -p .claude/hooks
echo "test hook" > .claude/hooks/test.sh
echo '{"test": "data"}' > .claude/settings.json
- Configure Permissions
Create .claude/settings.json:
{
"permissions": {
"ask": [
"Edit(.claude/)",
"Write(.claude/)",
"Bash(rm *)"
]
}
}
- Start Claude Session
claude
- Verify Rules Are Loaded
/permissions
Expected: See all three rules under "Ask" tab ✓
- Test Bash Rule (Works Correctly)
In chat, say:
Delete the test.txt file using rm
Expected: Prompt appears before executing rm test.txt ✓
Actual: Prompt appears (Bash rules work correctly)
- Test Edit Rule (Bug)
In chat, say:
Edit .claude/settings.json and add a comment
Expected: Prompt appears before editing .claude/settings.json
Actual: No prompt - file is edited immediately
- Test Write Rule (Bug)
In chat, say:
Create a new file at .claude/hooks/new.sh
Expected: Prompt appears before writing to .claude/hooks/new.sh
Actual: No prompt - file is written immediately
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.27 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
❯ /permissions
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Permissions: Allow Ask Deny Workspace (←/→ or tab to cycle)
Claude Code will always ask for confirmation before using these tools.
╭────────────────────────────────────────────────────────────────────╮
│ ⌕ Search… │
╰────────────────────────────────────────────────────────────────────╯
❯ 1. Add a new rule…
- Edit(.claude/hooks/**)
● Now I'll try to edit this file by adding a comment. According to your rules, I should be prompted first, but I
won't be (that's the bug):
● Update(.claude/hooks/README.md)
⎿ Added 2 lines
232 +
233 +<!-- Testing permissions bug -->
● BUG CONFIRMED!
I just edited .claude/hooks/README.md without any prompt, even though your rule Edit(.claude/hooks/**) is in the
"ask" list.
Let me undo that test change:
● Update(.claude/hooks/README.md)
⎿ Removed 2 lines
232 -
233 -<!-- Testing permissions bug -->
This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗