github / github/copilot-cli

CIMD declares callback port 33418 but Copilot CLI uses an ephemeral port

未关闭
#4,793 1 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

triage
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

Describe the bug

Copilot CLI’s Client ID Metadata Document declares a fixed loopback callback port, but the CLI sends a different ephemeral port in the OAuth authorization request.

Client metadata: https://github.com/copilot/cli/client-metadata.json

{
  "client_id": "https://github.com/copilot/cli/client-metadata.json",
  "application_type": "native",
  "redirect_uris": [
    "http://127.0.0.1:33418/"
  ]
}

The authorization request generated by Copilot CLI instead contains a callback such as:

  redirect_uri=http://127.0.0.1:60005/

My authorization server rejects the request with:

  unauthorized_client: Callback URL mismatch.
  http://127.0.0.1:60005/ is not in the list of allowed callback URLs
Affected version

GitHub Copilot CLI 1.0.83

Steps to reproduce the behavior
  1. Configure a remote MCP server protected by an Auth0 authorization server.
  2. Register Copilot CLI in Auth0 using: https://github.com/copilot/cli/client-metadata.json
  3. Add the remote MCP server to Copilot CLI.
  4. Start authentication.
  5. Inspect the generated /authorize request.

The request uses an ephemeral loopback port rather than the 33418 port declared in the metadata document.

Expected behavior

The redirect URI used by Copilot CLI should be compatible with its published metadata.

Either:

  1. Copilot CLI should bind to the declared callback:

      http://127.0.0.1:33418/
    
  2. The metadata should declare a portless loopback callback compatible with ephemeral ports:

      "redirect_uris": [
        "http://127.0.0.1/"
      ]
    

There should not be a requirement for every MCP server operator or Copilot user to configure a callback-port override.

Additional context
  • Operating system: macOS 26.5.1
  • MCP transport: Streamable HTTP
  • Authorization server: Auth0
  • Client registration: Client ID Metadata Document

For reference, Claude Code also uses an ephemeral loopback but its metadata document declares port-less loopback callbacks:

  "redirect_uris": [
    "http://localhost/callback",
    "http://127.0.0.1/callback"
  ]

The same Auth0 authorization server accepts Claude Code’s runtime callback while rejecting Copilot CLI’s callback because Copilot’s metadata explicitly pins port 33418.

Claude's metadata: https://claude.ai/oauth/claude-code-client-metadata

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从已发布的 client-metadata.json 和生成 /authorize 请求的 Copilot CLI OAuth 授权流程开始。比较声明的重定向 URI 与运行时的回环回调,并确定应统一哪种行为;完成的标准是授权服务器无需按用户覆盖端口即可接受该回调。

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

评估

领域
authentication, cli
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
58/100

把新 issue 发到你的邮箱

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