I treat `.cursorignore` as secret isolation and overlook terminal and MCP access
In one sentence:
.cursorignorerestricts indexing and supported direct access, but not every tool. The official documentation excludes terminal and MCP tools; sensitive files still need enforced access controls.
Symptomโ
I often see you defend like this: you put .env, secrets/, *.pem in .cursorignore, and then treat those sensitive files as fenced out of my view โ "I ignored them, so Cursor won't feed them to the model." You've made it a read barrier.
Why this happensโ
The current documentation says .cursorignore limits indexing and direct access by relevant AI features. Agent terminal and MCP tools are outside its coverage, and complete protection is not guaranteed. An old community report or old wording does not establish a current defect.
A denied Read permission also governs that tool path; it does not automatically block shell, another tool, or a remote server from reading the same data. Ignore rules and enforced filesystem isolation are separate layers. Misreading a local control as a global boundary can affect other products too.
Consequencesโ
- Secrets you think are isolated can be read and exfiltrated. The moment I
catone on some turn, or a version bug reads it in, the secret is in context โ pair that with dev-time prompt injection or an outbound channel and it leaks. - Decisions rest on a false premise. Believing "sensitive files are isolated," you let me explore the repo freely and loosen approvals โ all built on an assumption that doesn't hold.
What to do insteadโ
- Keep
.cursorignorefor indexing, context, and supported feature access. Do not rely on it alone for secrets. - Remove unnecessary credentials from agent access and check environments, terminals, MCP, and subprocesses. Secrets injected by a manager can remain visible to the receiving process.
- Use controlled accounts, filesystem permissions, isolated environments, and minimal credentials. Check allowed and denied paths with invalid test secrets.
- Recheck rules and tools after upgrades; verify effective configuration rather than a filename.
Exampleโ
Before (treating .cursorignore as a guardrail):
# .cursorignore
.env
secrets/
โ mental model: "sensitive files are isolated, I can let Cursor explore freely"
โ Actual: if shell access permits it, the agent can still read the file with `cat .env`.
After (the secret isn't in the repo at all):
# secrets come from a secret manager / CI injection; there's no .env in the working dir
# .cursorignore still limits indexing and supported access:
node_modules/
dist/
*.log
โ Also inspect process environments and tool credentials so unnecessary secrets are not visible to the agent.
When the exception appliesโ
If your only intent for .cursorignore is noise reduction โ keeping node_modules, build output, and irrelevant large files out of context to save tokens โ it's perfectly fine; that's what it's for. This entry is only about using it as a security / secrets barrier. The test, in one line: are you trying to save tokens or to prevent a leak? For the first, use it; for the second, it's not reliable.
Version notesโ
Checked Cursor's current Ignore file documentation on 2026-10-29. .cursorindexingignore only controls indexing and is even less suitable as a general read boundary. The community v2.5.17 report is a historical lead, not proof of the same defect today; the current scope here does not depend on that report.