Bug : When SSO login is started twice within the same running process, the CLI crashes with a panic
维护者通常 1 天内回复
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- go
- 领域
- authentication, cli
调研方向
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 内容生成。
描述
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.
Steps to reproduce:
- Start SSO login once.
- Start SSO login again in the same process.
- 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 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microcks/microcks-cli 的其他 Issue
-
Wrong link to test results可能重新可做 @SajanBisht 于 9 天前认领,目前没有进行中的 PR。 未关闭component/cli keep-open kind/bug
难度 2/5 1-3 小时 新手友好度 62/100
microcks/microcks-cli#589 · 3 条评论 ·
维护者通常 1 天内回复
-
Default configuration path falls back to the current directory when the home directory cannot be determined可能已有人在做 @Sarthak-Shreshtha01 于 12 天前认领。 未关闭component/cli kind/bug
难度 2/5 1-3 小时 新手友好度 76/100
microcks/microcks-cli#583 · 5 条评论 ·
维护者通常 1 天内回复
-
microcks test exits with code 1 (contract failure) instead of code 11 (connection) when polling loop times out可能已有人在做 @ish-g09 于 11 天前认领。 未关闭component/cli kind/bug
难度 1/5 1 小时以内 新手友好度 88/100
microcks/microcks-cli#573 · 5 条评论 ·
维护者通常 1 天内回复
-
bug: YAML parse error in config is silently swallowed, login overwrites all other contexts可能已有人在做 @Sarthak-Shreshtha01 于 18 天前认领。 未关闭component/cli kind/bug
难度 2/5 1-3 小时 新手友好度 76/100
microcks/microcks-cli#572 · 6 条评论 ·
维护者通常 1 天内回复
-
import-dir uploads secondary artifacts before their primary API definition可能已有人在做 @doraem-on 于 24 天前认领。 未关闭component/cli kind/bug
难度 2/5 1-3 小时 新手友好度 88/100
microcks/microcks-cli#561 · 4 条评论 ·
维护者通常 1 天内回复
查看 microcks/microcks-cli 的全部 Issue
相似的 Issue
-
[flaky test] TestValidatorCommitterDropsEmptyStatusBatch: submits to the mock VC before its stream is registered可能已有人在做 @liran-funaro 今天认领。 未关闭coordinator flaky-test race-condition testing
难度 2/5 1-3 小时 新手友好度 83/100
hyperledger/fabric-x-committer#876 ·
维护者通常 1 天内回复
-
kind/features
难度 2/5 1-3 小时 新手友好度 65/100
TencentBlueKing/bk-nodemgr#3804 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
cloudnative-pg/plugin-barman-cloud#1187 ·
维护者通常 1 天内回复
-
[deliverclient] Remove the unused common/deliverclient package可能已有人在做 @liran-funaro 今天认领。 未关闭code-hygiene
难度 2/5 1-3 小时 新手友好度 72/100
hyperledger/fabric-x-common#236 ·
维护者通常 1 天内回复
-
consensus feature I2 S4 U2
难度 1/5 1 小时以内 新手友好度 85/100
维护者通常 1 天内回复