Skip to content

fix: isolate SSO callbacks and fail safely when the local port is occupied - #587

Open
aniket866 wants to merge 2 commits into
microcks:masterfrom
aniket866:fix/sso-private-callback-mux
Open

aniket866 wants to merge 2 commits into
microcks:masterfrom
aniket866:fix/sso-private-callback-mux

Conversation

@aniket866

@aniket866 aniket866 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Fixed the SSO callback server in login.go: each login now uses a private ServeMux, and the CLI binds the port before opening the browser. A bind failure returns a wrapped environment error immediately.

verified with test:

Added both regression tests:

  • separate callback servers can serve /auth/callback with independent handlers, Occupied port: hold the configured localhost port, call oauth2login, and verify it returns a KindEnvironment error before starting the browser flow.

  • Private mux: verify callback routes are registered on a per-login mux, so creating two login servers doesn’t panic from duplicate global registrations.

  • a port conflict returns a KindEnvironment error. go

  • AI disclosure : Chatgpt is used to analyze related files and changes.

Closes #312

Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>

This branch was successfully deployed

1 active deployment
Build — c7e5300e Deployed Oct 15, 2026 by aniket866 via build-verify-package #808
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auth2 SSO Callback Server Is a Global Singleton, Race Condition & Port Hijack

1 participant