Safeguard
Developer Tools•

Can content exclusion keep secret files away from an AI assistant?

GitHub Copilot content exclusion blocks suggestions and context from chosen files, but it has gaps: agent modes in some editors, symlinks and IDE metadata.

Safeguard Security Team
3 min read

Content exclusion helps, but it is not a vault. GitHub documents that excluded files get no inline suggestions and do not inform other suggestions, chat answers or code review. It also lists limits: edit and agent modes in VS Code are not covered, symbolic links and remote filesystems are not supported, and the IDE may still pass semantic information.

Definitions

Content exclusion. A setting that tells an AI assistant to ignore specified files or paths.

Semantic information. Details an editor can supply about code, such as type information, hover definitions or build configuration.

What is covered, from the documentation

SurfaceSupport
Inline suggestionsVisual Studio, VS Code, JetBrains IDEs, Vim and Neovim, Xcode, Eclipse
Chat and agentVisual Studio, JetBrains IDEs, the GitHub website, GitHub Mobile, the Copilot app and Copilot CLI
VS Code chatSupported, but edit and agent modes are not
Xcode and Eclipse chatNot supported
Code reviewExcluded files skipped on the GitHub website

On the GitHub website and GitHub Mobile, the feature was documented as a public preview that may change. Check the current page.

Limits you should plan around

  • Agent and edit modes in some editors are not covered, so an agent working in the terminal or editor may still read the file.
  • Metadata can leak structure. Type and build information may reach the assistant even for an excluded file.
  • Symlinks and remote filesystems fall outside the feature.
  • It is policy at the tool level, not an access control on the file.

A layered approach

  1. Keep secrets out of the repository. Use a secrets manager and environment injection. A file that does not exist cannot be read.
  2. Turn on push protection so credentials cannot be committed. GitHub documents that it blocks pushes containing detected secrets.
  3. Use content exclusion for sensitive code such as proprietary algorithms or configuration, accepting the gaps.
  4. Add agent-level deny rules in tools that support them, for key files and environment files.
  5. Run agents in a sandbox or container with only the files they need mounted.
  6. Audit access. Review logs for what the assistant read where logging exists.

Quick check

Does excluding a file stop it being sent anywhere?

It stops the file's content informing suggestions and chat responses for the covered surfaces. It does not cover every mode or every editor, and the documentation notes metadata may still be used.

Should I rely on it for credentials?

No. Keep credentials out of the working tree entirely.

How do I know which setting applies to my editor?

Read the support table on the vendor page for your editor and mode. It changes over time.

Where Safeguard fits

Safeguard offers compliance and evidence automation and scans repositories for risky dependencies. You can start with a free scan at gold.safeguard.sh/scan.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.