github / github/copilot-cli

Secure credential storage for HTTP MCP OAuth tokens

未关闭
#2,783 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
area:authentication area:mcp
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

### Describe the feature or problem you'd like to solve

The Copilot CLI currently persists OAuth access and refresh tokens as plaintext JSON files on disk (~/.copilot/mcp-oauth-config/*.tokens.json) when authenticating to HTTP-based MCP servers. This introduces several security concerns:
1. **Plaintext exposure** - Tokens stored as unencrypted JSON can be read by any process or user with filesystem access. This violates the principle of least privilege for credential storage.
2. **Cloud sync risk** - Many enterprise users sync their home directory or profile folders via OneDrive, Dropbox, or similar tools. Plaintext tokens in synced directories get uploaded to cloud storage, expanding the attack surface and triggering DLP/security policy violations.
3. **Credential persistence** - File-based tokens survive beyond their intended session lifetime. If a machine is compromised, an attacker gains access to cached tokens without needing to re-authenticate.
4. **Inconsistency with VS Code** - VS Code already handles MCP OAuth tokens securely through the OS Secret Storage API (Windows Credential Manager, macOS Keychain, libsecret on Linux). The CLI should follow the same pattern for consistency and security.

### Proposed solution

Leverage the OS-native credential/secret manager on each platform rather than writing tokens to disk. This aligns with security best practices, avoids DLP policy conflicts, and provides a consistent security posture across the Copilot toolchain.

### Example prompts or workflows

_No response_

### Additional context

_No response_

贡献指南

打开贡献指南

调研方向

首先定位将 OAuth 令牌写入 ~/.copilot/mcp-oauth-config/*.tokens.json 的代码。检查 CLI 如何向基于 HTTP 的 MCP 服务器进行身份验证,以及 VS Code 如何使用 OS Secret Storage,包括 Windows Credential Manager、macOS Keychain 和 Linux 上的 libsecret。完成标准是令牌不再以明文文件形式持久化,而是通过各个平台的原生 Credential Manager 存储。

由索引模型根据 Issue 内容生成。

评估

技术栈
shell
领域
authentication, cli, security
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
冷清
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。