claude-code - 💡(How to fix) Fix [BUG] IDE extension bypasses .claudeignore and settings.json deny rules (Auto-attach context leak) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52419Fetched 2026-04-24 06:07:46
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×5

Error Message

Error Messages/Logs

Root Cause

The VS Code extension automatically injects the currently open file and any text selection into the conversation context for every single prompt. Crucially, this happens even if the file is explicitly listed in .claudeignore AND denied in .claude/settings.json permissions. While Claude Code correctly blocks its own tools from reading ignored files, the IDE extension completely bypasses these rules by injecting the file contents into the context just because the tab happens to be open in the editor unless I remember to explicitly remove it from the session prompt. This creates a significant security risk by exposing files the user explicitly wanted hidden, alongside unnecessary token drain and context poisoning (by including an unrelated file).

Code Example

N/A: This is a logic bypass and data leak bug rather than an application crash.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

The VS Code extension automatically injects the currently open file and any text selection into the conversation context for every single prompt. Crucially, this happens even if the file is explicitly listed in .claudeignore AND denied in .claude/settings.json permissions. While Claude Code correctly blocks its own tools from reading ignored files, the IDE extension completely bypasses these rules by injecting the file contents into the context just because the tab happens to be open in the editor unless I remember to explicitly remove it from the session prompt. This creates a significant security risk by exposing files the user explicitly wanted hidden, alongside unnecessary token drain and context poisoning (by including an unrelated file).

This is extremely irritating because files are constantly being included accidentally and also raises significant security concerns.

What Should Happen?

  1. The extension must respect .claudeignore and settings.json deny rules across all context injection paths, not just direct tool calls.
  2. To prevent context poisoning, there must be a persistent setting to disable auto-attachment entirely (e.g., claude-code.autoAttachContext: false), making IDE file inclusion an opt-in feature rather than forced opt-out.

Error Messages/Logs

N/A: This is a logic bypass and data leak bug rather than an application crash.

Steps to Reproduce

  1. Add a sensitive file to .claudeignore (e.g., secrets.txt).
  2. Add a deny rule for the same file in .claude/settings.json.
  3. Open secrets.txt so it is the active tab in VS Code.
  4. Submit any prompt to the Claude Code VS Code sidebar chat.
  5. Observe that the contents of secrets.txt are injected into the prompt context, completely bypassing both the ignore and deny rules.

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.118

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Other

Additional Information

I am opening this as a bug report because the original thread tracking this behaviour (#24726) was submitted with a [FEATURE] prefix and subsequently labelled as an enhancement. Because of that classification, it appears to have fallen off the triage radar. However, actively bypassing explicitly defined .claudeignore rules is not a missing feature; it is an active bug with severe security and privacy implications that needs urgent review.

extent analysis

TL;DR

The VS Code extension for Claude Code should be updated to respect .claudeignore and settings.json deny rules when injecting file contents into the conversation context.

Guidance

  • Verify that the .claudeignore file and settings.json deny rules are correctly formatted and applied to the sensitive file.
  • Test the behavior with different file types and permissions to ensure the issue is consistent.
  • Consider adding a feature request for a persistent setting to disable auto-attachment of context entirely, as suggested in the issue report.
  • Review the extension's code to identify where the logic bypass is occurring and ensure that all context injection paths respect the ignore and deny rules.

Example

No code snippet is provided as the issue is related to the extension's behavior rather than a specific code block.

Notes

The issue report highlights a significant security risk, and it is essential to address this bug urgently. The reporter has already suggested a potential solution, which is to add a persistent setting to disable auto-attachment of context.

Recommendation

Apply a workaround by manually removing sensitive files from the session prompt until the bug is fixed, as the issue reporter has mentioned that this is the current workaround.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING