# Security Issue: Contrary to docs, Cursor does NOT check .gitignore

**URL:** <https://forum.cursor.com/t/security-issue-contrary-to-docs-cursor-does-not-check-gitignore/161200>\
**Category:** Bug Reports\
**Tags:** docs, context, security\
**Created:** [May 21, 2026, 7:38am UTC](https://forum.cursor.com/t/security-issue-contrary-to-docs-cursor-does-not-check-gitignore/161200 "2026-05-21T07:38:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![FrankieSimon](https://avatars.discourse-cdn.com/v4/letter/f/5e9695/32.png) [@FrankieSimon](https://forum.cursor.com/u/FrankieSimon)\
**Post date:** [May 21, 2026, 7:38am UTC](https://forum.cursor.com/t/security-issue-contrary-to-docs-cursor-does-not-check-gitignore/161200/1 "2026-05-21T07:38:43Z")

</div>

### Where does the bug appear (feature/product)?

Cursor IDE

### Describe the Bug

The documentation explicitly states

> _Cursor automatically ignores files in .gitignore_

([Ignore File | Cursor Docs](https://cursor.com/docs/reference/ignore-file#files-ignored-by-default:~:text=Cursor%20automatically%20ignores%20files%20in%20.gitignore))

### Steps to Reproduce

_Do this first, without Cursor_:

1. Setup a git repository with a `.gitignore` file containing just:

`secrets.json`

1. Stage and commit the .gitignore file.
2. Create a `secrets.json` file containing some fake secret. Make sure it’s not tracked by git.

Now, open the folder in Cursor.

1. Ask to build something using an api key without explicitly mentioning the file. My prompt was:

> Write a tiny python app that would connect to a backend service: [http://www.weather.com/api/isitraining](http://www.weather.com/api/isitraining) and it passes an api key in the request and prints out the result from the call (don’t worry about it working the service isn’t up yet)

### Expected Behavior

According to the documentation, files in `.gitignore` are supposed to be ignored by Cursor by default. In reality nothing blocks it from reading and printing out the files.

### Screenshots / Screen Recordings

 ![Screenshot 2026-05-21 at 10.37.20.png](https://us1.discourse-cdn.com/cursor1/original/3X/0/3/03a6631419f725b95abff6adba454d1f9c47da49.png)

### Operating System

MacOS

### Version Information

Version: 3.5.17  
VSCode Version: 1.105.1  
Commit: d5b2fc092e16007956c9e5047f76097b9e626ca0  
Date: 2026-05-20T02:43:31.559Z (1 day ago)  
Layout: glass  
Build Type: Stable  
Release Track: Default  
Electron: 39.8.1  
Chromium: 142.0.7444.265  
Node.js: 22.22.1  
V8: 14.2.231.22-electron.0  
OS: Darwin arm64 25.5.0

### For AI issues: which model did you use?

Opus 4.7 (Extra High)

### Does this stop you from using Cursor

No - Cursor works, but with this issue

---

<div class="post-metadata">

**Author:** ![Colin](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/colin/32/90452_2.png) [@Colin](https://forum.cursor.com/u/Colin)\
**Post date:** [May 21, 2026, 8:52am UTC](https://forum.cursor.com/t/security-issue-contrary-to-docs-cursor-does-not-check-gitignore/161200/5 "2026-05-21T08:52:15Z")

</div>

Hey @FrankieSimon!

Have a look at this thread.

> [@Cursor does not ignore files in .gitignore](https://forum.cursor.com/t/cursor-does-not-ignore-files-in-gitignore/154430/9):
>
> Hey @nickredmark, per the docs the current behavior is expected. .gitignore and the default ignore list which includes .env\* only apply to indexing. To block access for Agent, Tab, and Inline Edit, you need .cursorignore. It’s a separate, stricter mechanism. From the docs: [Ignore File | Cursor Docs](https://cursor.com/docs/reference/ignore-file) .cursorignore blocks access from: Semantic search, Tab, Agent, Inline Edit, and @ mentions. Default ignore list and .gitignore apply to indexing only. So .cursorignore isn’t a workaround, it’s t…

---

<div class="post-metadata">

**Author:** ![FrankieSimon](https://avatars.discourse-cdn.com/v4/letter/f/5e9695/32.png) [@FrankieSimon](https://forum.cursor.com/u/FrankieSimon)\
**Post date:** [May 26, 2026, 2:41pm UTC](https://forum.cursor.com/t/security-issue-contrary-to-docs-cursor-does-not-check-gitignore/161200/7 "2026-05-26T14:41:49Z")

</div>

I’m sorry Colin but that is not the way most humans (and the AI agents I shared the documentation with) interpret it. If that’s the intention - saying that .gitignore is only considered by Cursor for **indexing** - the instructions really should be reworded to make this explicit and clear.

When the docs say **“Cursor automatically ignores files in .gitignore”** and that section does not talk about indexing at all - it’s very difficult to reach another conclusion and I’m not at all surprised the person in the other ticket called it out.

I do suggest to anyone interested to try this prompt on your favorite set of AI agents:

> [https://cursor.com/docs/reference/ignore-file](https://cursor.com/docs/reference/ignore-file) ( [Ignore File | Cursor Docs](https://cursor.com/docs/reference/ignore-file) ) Read this document. Now answer - if my repository has a .gitignore file with “secrets.json” and no .cursorignore file, would Cursor have access to the file named “secrets.json” to read and output it?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/colin/32/90452_2.png) [@Colin](https://forum.cursor.com/u/Colin)\
**Post date:** [May 27, 2026, 8:49am UTC](https://forum.cursor.com/t/security-issue-contrary-to-docs-cursor-does-not-check-gitignore/161200/9 "2026-05-27T08:49:10Z")

</div>

I’m sure we can make the docs clearer here. I’ll work on a PR. Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/system/32/99069_2.png) [@system](https://forum.cursor.com/u/system)\
**Post date:** [June 26, 2026, 8:49am UTC](https://forum.cursor.com/t/security-issue-contrary-to-docs-cursor-does-not-check-gitignore/161200/11 "2026-06-26T08:49:47Z")

</div>

Closed on June 26, 2026, 8:49am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
