Content exclusion incorrectly blocks commands when a child process loads .env
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 11.2k
- Forks
- 1.9k
- Avg merge
- 14h 16m
- Merged PRs (30d)
- 6
Description
Describe the bug
Our organization has the following content-exclusion policy:
"*":
- "**/.env"
The policy should prevent Copilot from reading .env files or using their contents as model context.
However, Copilot CLI also blocks starting an application when the application itself loads .env during normal startup.
For example, our Python application uses load_dotenv() during startup. The application starts successfully when run directly in the terminal, but Copilot CLI refuses to continue when asked to run the same approved command.
The error shown is:
Access denied: "[REDACTED]/.env" is excluded by organization content policy. Do not attempt to access this file.
Copilot does not need to read .env, receive its contents, or include them in model context for the application to start.
Affected version
GitHub Copilot CLI 1.0.83
Steps to reproduce the behavior
- Configure an organization content-exclusion rule for
**/.env. - Create an application that loads
.envinternally during startup, for example usingpython-dotenvandload_dotenv(). - Verify that the application starts successfully when run directly in a terminal.
- Ask Copilot CLI to run the same startup command.
- Approve the command.
- Observe that Copilot CLI refuses to continue because
.envis excluded.
Expected behavior
Copilot CLI should execute the approved command.
Content exclusion should prevent Copilot from reading or using .env contents as model context, but should not prevent an application from loading the file internally as runtime configuration.
Additional context
- OS: macOS 26.6.2
- Architecture: arm64
- Shell: zsh
This began after content exclusions became generally available in Copilot App and CLI on September 2, 2026:
https://github.blog/changelog/2026-09-02-content-exclusions-generally-available-in-copilot-app-and-cli/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the approved command with the organization rule excluding **/.env, using the Python application and load_dotenv() described in the issue. Trace the content-exclusion handling for child processes; done means the approved application starts while .env contents remain unavailable to Copilot as model context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- cli, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100