[BUG] Claudecode able to to bypass .claudeignore

Resolved 💬 4 comments Opened Mar 16, 2026 by BaconatorMode Closed Apr 13, 2026

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?

When I was asking Claude to assist with creating an API integration with my LogSeq and Asana, it mentioned using a token. I asked it to clarify that I just my token inside my .env file as usual, but then it went ahead and read my .env file. This is not that strange except for the part where my .env file is listed inside .claudeignore.

These files are both inside the root directory that Claude has access to.

Attached are screenshots of the interaction and my .claudeignore.

<img width="1398" height="1190" alt="Image" src="https://github.com/user-attachments/assets/3eb56aff-95aa-477a-b54c-ade7e0c5d2e0" />

<img width="1516" height="1060" alt="Image" src="https://github.com/user-attachments/assets/71239516-a2f1-4409-99db-1fd81697557d" />

It ran the following commands:

  • $ ls -la /Users/{workingdirectory}/ | grep -E "\.env|\.gitignore"
  • $ cat /Users/{workingdirectory}/.gitignore
  • $ cat /Users/{workingdirectory}/.env

And then it spat out my tokens and environment variables.

What Should Happen?

It should absolutely not be able to read these files. That restriction should be hardcoded.

Error Messages/Logs

Steps to Reproduce

See the above description of the issue for reproduction steps.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

Claude Code 2.1.74

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗