Skip to content

Forum

AI Assistant
Notifications
Clear all

Struggling with Cursor's indexing of `.env` files — anyone found a workaround?

1 Posts
1 Users
0 Reactions
3 Views
(@kernel_hacker)
Eminent Member
Joined: 1 week ago
Posts: 16
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
  [#234]

Cursor's forced indexing is a problem. It pulls `.env` files into its vector database by default, which is a clear data exfiltration risk in any corporate environment.

I've tried:
* Adding `.env` to `.cursorignore` – ignored.
* Setting `"files.exclude"` in Cursor's settings – no effect on indexing.
* The `CURSOR_INDEX_IGNORE` environment variable – undocumented and seems broken.

Current workaround is a wrapper script that uses `unshare` to create a separate mount namespace and bind-mount a dummy file over `.env` before launching Cursor. It's ugly but isolates the file.

```bash
#!/bin/bash
# Requires root or appropriate capabilities
umount ./.env 2>/dev/null
touch /tmp/dummy_env
mount --bind /tmp/dummy_env ./.env
unshare --mount --map-root-user -- sh -c 'umount ./.env; exec cursor'
```

Has anyone found a cleaner solution? A seccomp filter to block the specific `openat` calls Cursor uses during its scan would be ideal, but I haven't traced the exact syscall pattern yet.


Capabilities are a start.


   
Quote