Agent Sandbox missing certain files

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

I was trying to work on a feature that requires a database migration and it seems like the agent sandbox environment is missing dotfiles like .env, or perhaps files that have been git-ignored?

Steps to Reproduce

Try to do something in agent mode with sandbox enabled that makes use of a .env or git-ignored file, it should fail to find the file.

Expected Behavior

It should work normally.

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.0.77
VSCode Version: 1.99.3
Commit: ba90f2f88e4911312761abab9492c42442117cf0
Date: 2025-11-13T23:10:43.113Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.1.0

For AI issues: which model did you use?

Grok Code

For AI issues: add Request ID with privacy disabled

5ab5f8de-2■■■-4fa7-9467-8f4d90a3a357

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report. This is actually expected behavior .env files and other sensitive files are excluded by default for security and privacy reasons.

Solution: you can edit the global ignore list in Settings → Cursor → General: Global Cursor Ignore List.

This will allow the Agent Sandbox to access your .env file. You can use the same approach to allow access to other git-ignored files the agent needs.

Let me know if this resolves the issue.

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Hi!

Thanks for introducing sandbox feature to the Cursor, I really like it. However, there is one problem about it. When I try to run any python script which uses .env file inside (let’s say using load_dotenv()), the script fails with error “Permission error”.

If I try to run the same command once again, but outside of sandbox this time (Cursor actually does it automatically sometimes), the command will succeed. This is a problem, because it requires user’s approval and therefore makes the whole development process less smoother.

As far as I understood, the bug attributed due to the following reason:

  1. .env file is included in .gitignore
  2. Cursor forbids access inside sandbox to all files included in .gitignore

However, the problem is that the script is only reading from .env file. Can’t you adjust sandbox permissions and allow it to read from files that are inside workspace but in .gitignore? Or maybe some other fix that wouldn’t require user approval to run script.

Expected result

  • Cursor can successfully run python scripts loading variables from .env or other files containing secrets and included in .gitignore

Steps to Reproduce

  1. Setup some python project loading variables from .env file using load_dotenv()
  2. Add .env file to .gitignore
  3. Setup cursor to run commands inside sandbox by default
  4. Ask Cursor to run the script

Expected Behavior

Cursor should have no troubles running python scripts/applications that are loading secrets from some secret files included in .gitignore.

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.0.77 (Universal)
VSCode Version: 1.99.3
Commit: ba90f2f88e4911312761abab9492c42442117cf0
Date: 2025-11-13T23:10:43.113Z (6 days ago)
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.1.0

For AI issues: which model did you use?

Sonnet 4.5

Does this stop you from using Cursor

No - Cursor works, but with this issue

I’m not seeing that option for some reason

These settings are located in VS Code settings.

You see, my point that it is actually a bad behavior.

I understand why agent itself should have no read access to those files (to prevent them being included into the prompts being sent to some external AI server). But the problem is that Cursor restricts accessing those files even from the code I’ve either written or reviewed myself. There is no exposure risk (as long as I am myself not stupid to print credentials in logs). My python application just fetches environment variable from the .env file, without ever giving agent access to its contents.

I’d like the Cursor to act way smarter then just restricting access to my .env file at all. I’d like it to restrict the access to the agent (via calling file read tool or grep tool), but do not restrict access it from the code itself. If there would be such behavior, the sandbox experience would be way smoother, yet not less secure (at least, not noticablely).