github / github/copilot-cli

Content exclusion incorrectly blocks commands when a child process loads .env

Aperta
#4,871 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

triage
Lingua principale
Shell
Stelle
11.2k
Fork
1.9k
Merge medio
14h 16m
PR unite (30g)
6

Descrizione

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
  1. Configure an organization content-exclusion rule for **/.env.
  2. Create an application that loads .env internally during startup, for example using python-dotenv and load_dotenv().
  3. Verify that the application starts successfully when run directly in a terminal.
  4. Ask Copilot CLI to run the same startup command.
  5. Approve the command.
  6. Observe that Copilot CLI refuses to continue because .env is 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/

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il comando approvato con la regola dell’organizzazione che esclude **/.env, usando l’applicazione Python e load_dotenv() descritti nell’issue. Traccia la gestione dell’esclusione dei contenuti per i processi figli; il lavoro è completato quando l’applicazione approvata si avvia, mentre i contenuti di .env rimangono non disponibili per Copilot come contesto del modello.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
shell
Ambito
cli, security
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.