[BUG] Read tool incorrectly denies access to files located in directories containing "Key" in their name
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: <!-- unable to determine from within Claude Code
-->
- Operating System: macOS (Darwin 24.5.0)
- Terminal: <!-- unable to determine from within Claude Code -->
## Bug Description
The Read tool incorrectly denies access to files located in directories
containing "Key" in their name (e.g., "Keyboard", "KeyInput"), despite
the files having proper read permissions.
## Steps to Reproduce
- Create a directory with "Key" in its name: `mkdir -p
/path/to/project/Features/Keyboard/`
- Create a file in that directory: `echo "content" >
/path/to/project/Features/Keyboard/example.swift`
- Use Read tool to read the file:
Read("/path/to/project/Features/Keyboard/example.swift")
- Observe permission denied error
## Expected Behavior
The Read tool should successfully read the file content since:
- The file has proper read permissions (644)
- The file can be read using bash commands
## Actual Behavior
Read tool returns: Permission to read
/path/to/project/Features/Keyboard/example.swift has been denied.
However:
- The same file can be read using
catvia Bash tool - Renaming the directory from "Keyboard" to "TypeControl" allows Read
tool to access the file
- Files in other directories (e.g., "Mouse", "Screenshot") work
normally
## Additional Context
This appears to be an overly restrictive security filter in the Read
tool that blocks access based on directory naming patterns. The
restriction seems to trigger on directories containing "Key" (tested
with "Keyboard" and "KeyInput"). This is problematic for legitimate use
cases where developers have keyboard-related features in their
applications.
Workaround: Use Bash tool with cat command to read affected files.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗