Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Bug : When SSO login is started twice within the same running process, the CLI crashes with a panic

未关闭
#549 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@Sarthak-Shreshtha01 已经在做这个了。

开始于 2026年10月4日。

  • #571 来自 @Sarthak-Shreshtha01 —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
go

调研方向

Start at the oauth2login entry point and inspect how it registers /auth/callback on Go’s global HTTP router. Reproduce the failure with the provided TestReproduceSSODuplicateCallbackPanic case, then verify that invoking SSO login twice returns normally without a duplicate-route panic and that the existing login flow still works.

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

描述

component/cli kind/bug
Describe the bug
When SSO login is started twice within the same running process, the CLI crashes with a panic:

This happens because oauth2login registers /auth/callback on Go’s global HTTP router every time it runs. The second registration causes Go to panic.

Image
Steps to reproduce:
  1. Start SSO login once.
  2. Start SSO login again in the same process.
  3. Observe the panic.

here is the Panic: `panic: pattern "/auth/callback" conflicts with pattern "/auth/callback"


The issue can be reproduced with:

package cmd

import (
    "context"
    "testing"
    "time"

    "golang.org/x/oauth2"
)

func TestReproduceSSODuplicateCallbackPanic(t *testing.T) {
    config := &oauth2.Config{
        Endpoint: oauth2.Endpoint{
            AuthURL:  "http://127.0.0.1",
            TokenURL: "http://127.0.0.1",
        },
    }

    go func() {
        _, _, _ = oauth2login(context.Background(), 0, config, false)
    }()

    time.Sleep(2 * time.Second)

    // The second invocation registers /auth/callback again and panics.
    _, _, _ = oauth2login(context.Background(), 0, config, false)
}
Expected behavior:
  • The second login should return a normal error or create its own temporary callback server.
Actual behavior:
  • The process crashes with a panic and stack trace.
Impact:
  • Applications, tests, or services that reuse the CLI cannot safely perform multiple SSO logins.
Suggested fix:
  • Use a private http.ServeMux for each login instead of the global http.DefaultServeMux..
Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Microcks version or git rev

No response

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

No response

Additional information

@Harsh4902
Please review and assign if valid

主要语言
Go
星标
58
派生
72
平均合并
1 天 7 小时
30 天内合并 PR
22

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

microcks/microcks-cli 的其他 Issue

查看 microcks/microcks-cli 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

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