Cursor can read my .env file

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Cursor is able to see my .env file which in theory is should not be possible in the straightforward way.

Steps to Reproduce

I use multi-root workspace. Configure multi-root workspace using .code-workspace file, write .env file inside one of the folders and ask cursor agent to read what is written in the .env

Expected Behavior

.env should not be readable to cursor agent so easy as described in this page Ignore File | Cursor Docs

Screenshots / Screen Recordings

Operating System

MacOS

Version Information

Version 3.22.7

For AI issues: which model did you use?

Auto

For AI issues: add Request ID with privacy disabled

c580c33b-472c-420d-b326-fb771bb23829

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey @DjNero11! You’re right that the docs read like .env is blocked, but .gitignore and the default ignore list only affect indexing, not what the Agent can open when you ask. The file that blocks Agent/Tab/Inline Edit access is .cursorignore.

Add a .cursorignore in each workspace folder that holds secrets:

.env
.env.*

Or set it once for all projects via the Global ignore files list (**/.env, **/.env.*). Then retry in a new chat and the Agent will be denied.

One heads-up: terminal and MCP tools the Agent runs aren’t fully covered by .cursorignore, so keep truly sensitive secrets outside the workspace. Docs: Ignore files. (Multi-root isn’t the cause - a single folder behaves the same.)

OK, Thank you for the response and clarification :slight_smile: