Preflight Checklist
What's Wrong?
I added a .claudeignore file to my project hoping it would stop Claude from reading my .env files. It didn't work. Claude read the env file with all my secrets and pulled them into the conversation.
There is no warning. No error. No mention in the docs. The file just sits there doing nothing, while I think my secrets are safe.
What Should Happen?
Make .claudeignore work. Use the same syntax as .gitignore. Apply it to all file reading tools (Read, Glob, Grep, and shell commands like cat) or if you don't plan to support it, show a warning when one exists in the project. Something like: Found .claudeignore but Claude Code doesn't use this file. Use permissions.deny in .claude/settings.json instead.
Error Messages/Logs
Steps to Reproduce
- In any project, create .claudeignore at the root with:
.env
secrets/
*.pem
- Ask Claude "can you see my env file?"
- Claude reads it. The secrets are now in context.
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
2.1.132
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
After finding out .claudeignore does nothing, I had to block env files manually using permissions.deny in .claude/settings.json.
{
"permissions": {
"deny": [
"Read(**/.env)",
"Read(**/.env.local)",
"Read(**/.env.*.local)",
"Read(**/.env.development)",
"Read(**/.env.production)",
"Read(**/.env.staging)",
"Read(**/.env.test)",
"Read(**/secrets/**)",
"Read(**/*.pem)",
"Read(**/*.key)",
"Read(**/*.p12)",
"Read(**/*.pfx)",
"Read(**/credentials.json)",
"Read(**/service-account*.json)",
"Read(**/id_rsa)",
"Read(**/id_ed25519)",
"Bash(cat **/.env)",
"Bash(cat **/.env.local)",
"Bash(cat **/.env.*.local)",
"Bash(cat **/secrets/**)"
]
}
}
Preflight Checklist
What's Wrong?
I added a
.claudeignorefile to my project hoping it would stop Claude from reading my.envfiles. It didn't work. Claude read the env file with all my secrets and pulled them into the conversation.There is no warning. No error. No mention in the docs. The file just sits there doing nothing, while I think my secrets are safe.
What Should Happen?
Make .claudeignore work. Use the same syntax as .gitignore. Apply it to all file reading tools (Read, Glob, Grep, and shell commands like cat) or if you don't plan to support it, show a warning when one exists in the project. Something like: Found .claudeignore but Claude Code doesn't use this file. Use permissions.deny in .claude/settings.json instead.
Error Messages/Logs
Steps to Reproduce
.env
secrets/
*.pem
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
2.1.132
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
After finding out .claudeignore does nothing, I had to block env files manually using permissions.deny in .claude/settings.json.