.claudeignore not enforced by Bash or Edit tools — only blocks Read/Grep/Glob

Status Fixed / completed
Maintainer reply None cached
Activity 1 comment · opened Aug 12, 2026 · closed Aug 17, 2026

.claudeignore listed .env.local (alongside .env, .env.production) specifically to block secrets access. In a session today:

  • Bash (cat -A .env.local, grep ... .env.local) read the file's contents without any block or warning.
  • Bash (echo ... >> .env.local) appended to the file — this actually caused a real bug: no trailing newline meant the appended line merged onto the end of DATABASE_URL, corrupting a live Postgres connection string (credentials included) until manually fixed.
  • Edit tool also read and modified the file directly, no block.

Expected: .claudeignore entries block file access uniformly across all tools that read/write files, including Bash and Edit — not just the dedicated Read/Grep/Glob tools. As-is, a project relying on .claudeignore to keep an agent away from .env.local/secrets gets no actual protection, since Bash is the default general-purpose tool and will happily cat/grep/edit an "ignored" file.

Repro: add a file to .claudeignore, then ask the agent to cat or grep it via Bash, or Edit it directly.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗