Repository navigation
fix(auth): use a fresh mux and server per interactive auth attempt - #730
fabienfleureau wants to merge 15 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
A stale browser launch still runs before binding and causes two tabs to open.
1 open finding
What changed in this PR
Introduces isolated callback servers for repeatable interactive authentication.
Changes:
- Uses a per-attempt HTTP mux and server.
- Binds the callback listener before the intended browser launch.
- Adds tests for repeated attempts, PKCE isolation, and port release.
| File | Description |
|---|---|
pkg/auth_service.go |
Refactors interactive authentication server lifecycle. |
pkg/auth_service_test.go |
Tests callback-server isolation and reuse. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
View guided diff | Turn on auto-fix | Re-trigger cubic
…t assertion in test
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="pkg/testdata/auth_page_harness.js">
<violation number="1" location="pkg/testdata/auth_page_harness.js:112">
P3: The `success` and `http-error` branches are now byte-identical: both take status and body from the same env vars and call `onload()`. Merge them into one branch so a future scenario difference can't silently apply to or be missed in one of the two.</violation>
</file>

📝 What
qovery authnow builds its ownhttp.ServeMuxandhttp.Serverper attempt instead of registering onhttp.DefaultServeMux.🎯 Why: a second attempt in one process (re-auth after a 401) panicked on the duplicate
/authorizationpattern.✅ Verified: Unit tests (incl. race detector), vet and build green; rejected exchanges store nothing and show a failure in the browser. golangci-lint not run locally (toolchain mismatch), left to CI.
🧪 How to test
Summary by cubic
Fixes interactive
qovery authso re-authenticating after a 401 no longer panics on duplicate/authorizationhandlers, and a rejected or stale authorization code can't be stored or reported as a successful login.http.ServeMux,http.Server, and PKCE verifier per attempt, so repeat attempts in one process don't collide.window.statusclash in the callback page script and exercises it in node tests.Written for commit c0fb5cb. Summary will update on new commits.