What I Learned by Placing GitHub Copilot Behind an MITM Proxy
GitHub
An engineer shares insights from intercepting network traffic of VS Code and GitHub Copilot using mitmproxy. The article details how to set up the proxy, what startup requests Copilot makes, and reveals that inline suggestions can leak secrets from recently edited files even when the current file is not a secret file.
The author, a developer, was curious about the inner workings of AI-powered applications and chose to investigate GitHub Copilot, as they were quickly exhausting their monthly credits. Noting that many such apps are built on Electron, they used mitmproxy, a popular open-source MITM tool, to intercept HTTP/HTTPS traffic from VS Code. After configuring VS Code to route through the proxy, they observed that Copilot makes several categories of requests even before typing: Auth & Session, Config & Policy, MCP Registry, Repo & Session, Model Discovery, and Recent repos. Before answering prompts, Copilot checks available models via endpoints like /models and /agents/swe/models. With the Auto mode, a request to /models/session/intent classifies the user prompt's intent (code-gen, debugging, reasoning, tool-use) to select the appropriate model. The author tested if secrets from a .env file could be leaked: they added a fake secret to .env and then typed in an unrelated pyproject.toml file. The intercepted inline suggestion request included the secret in the prompt because recently edited files are included as context, demonstrating that disabling Copilot for secret files does not prevent leakage when edits are recent.
- Abbreviations
- MITM = man-in-the-middle — человек посередине
- CA = certificate authority — центр сертификации
- HTTPS = Hypertext Transfer Protocol Secure — защищённый протокол передачи гипертекста
- HTTP = Hypertext Transfer Protocol — протокол передачи гипертекста
- TLS = Transport Layer Security — протокол защиты транспортного уровня
- UI = User Interface — пользовательский интерфейс
- PID = Process Identifier — идентификатор процесса
- LLM = Large Language Model — большая языковая модель
- SWE = Software Engineering — разработка программного обеспечения
- MCP = Model Context Protocol — протокол контекста модели
- SQL = Structured Query Language — структурированный язык запросов
Source: Habr — хаб ИИ —
original
