AI / GitHub Copilot CLI Fundamentals Interview Questions
What security considerations should developers be aware of when using GitHub Copilot CLI?
Copilot CLI is a powerful agentic tool that can read, modify, and execute code. This power introduces security considerations that every developer and organisation should understand before adopting it.
| Risk | Mitigation |
|---|---|
| Malicious files in untrusted directories | Use the directory trust model - never select 'Yes' in untrusted or downloaded directories without inspection |
| Prompt injection via file contents | Be cautious with repos from unknown sources - malicious files can contain instructions that try to hijack Copilot's actions |
| Token security | Use fine-grained PATs with minimum permissions; rotate tokens regularly; store in system credential store |
| Data privacy | Business/Enterprise plans exclude data from training; Free/Pro users should review GitHub's data usage settings |
| Runaway agent actions | Use Plan mode to review before Autopilot executes risky changes; Ctrl+C to stop at any time |
| CI/CD secret exposure | Never log COPILOT_GITHUB_TOKEN; use encrypted secrets in CI systems |
| Scope of file access | Copilot only accesses files in and below the trusted directory - structure your repos accordingly |
Prompt injection warning: if you run Copilot CLI in a directory containing adversarially crafted files (e.g. a malicious repository), those files could contain embedded instructions designed to make Copilot take unintended actions. The directory trust model is the primary defence - only trust directories you control and have inspected.
More Related questions...