Bug Description
A deny rule Read(*/.env*) in ~/.claude/settings.json was not enforced at session start. The Read tool successfully read a .env file despite the deny rule being present.
After editing settings.json mid-session (adding unrelated deny rules for Edit and Bash(grep)), the same Read(*/.env*) rule started working and correctly blocked subsequent Read attempts on .env files.
Steps to Reproduce
-
Add Read(*/.env*) to deny in ~/.claude/settings.json
-
Start a new Claude Code session
-
Use Read tool on a .env file (e.g. Read("/path/to/project/backend/.env"))
-
Expected: Blocked by deny rule
-
Actual: File contents are returned successfully
-
Edit settings.json mid-session (add any new deny rule)
-
Retry the same Read on the .env file
-
Result: Now correctly blocked — File is in a directory that is denied by your permission settings.
Environment
- Claude Code CLI on WSL2 (Ubuntu)
- Linux 6.6.87.2-microsoft-standard-WSL2
- settings.json had
allow: ["Read"] and deny: ["Read(*/.env*)"] coexisting
Impact
Security-sensitive files (.env containing API keys, database credentials, JWT secrets) can be read by Claude despite explicit deny rules, until settings.json is modified and reloaded.
Hypothesis
The deny rules from settings.json may be cached at session start and not properly evaluated against the allow list. Editing the file mid-session triggers a reload that correctly applies deny overrides.
Bug Description
A
denyruleRead(*/.env*)in~/.claude/settings.jsonwas not enforced at session start. TheReadtool successfully read a.envfile despite the deny rule being present.After editing
settings.jsonmid-session (adding unrelated deny rules forEditandBash(grep)), the sameRead(*/.env*)rule started working and correctly blocked subsequentReadattempts on.envfiles.Steps to Reproduce
Add
Read(*/.env*)todenyin~/.claude/settings.jsonStart a new Claude Code session
Use
Readtool on a.envfile (e.g.Read("/path/to/project/backend/.env"))Expected: Blocked by deny rule
Actual: File contents are returned successfully
Edit
settings.jsonmid-session (add any new deny rule)Retry the same
Readon the.envfileResult: Now correctly blocked —
File is in a directory that is denied by your permission settings.Environment
allow: ["Read"]anddeny: ["Read(*/.env*)"]coexistingImpact
Security-sensitive files (
.envcontaining API keys, database credentials, JWT secrets) can be read by Claude despite explicit deny rules, until settings.json is modified and reloaded.Hypothesis
The deny rules from
settings.jsonmay be cached at session start and not properly evaluated against the allow list. Editing the file mid-session triggers a reload that correctly applies deny overrides.