Skip to content

fix(auth): preserve desktop pairing return through GitHub OAuth session regeneration #2286

Closed

Description

@integry

Desktop account switching acceptance blocker; parent #2269, desktop epic #1970. Base and target 1950-epic-cross-platform-dsk, not main. User clicks Add account; Chromium opens ui.gitfix.dev without visible user context, desktop stays approval-pending. Verified deployed api.gitfix.dev code at 055cdba: /api/desktop/pairings/:id/browser redirects unauthenticated browsers via /api/auth/github?redirect_to=<validated FRONTEND_URL /desktop/pairing?pairing_id=...>. GitHub callback uses passport.authenticate('github', { failureRedirect: '/login' }) without preserving redirectTo. Installed Passport sessionmanager regenerates session and only copies previous state with keepSessionInfo; completeAuthenticatedSession reads req.session.redirectTo AFTER regeneration, so pairing return intent is lost on fresh GitHub OAuth. Connect callback already uses keepSessionInfo. Implement a narrow secure correction preserving validated pairing redirect across GitHub login, retain session regeneration/state/CSRF protections and do not blindly trust arbitrary return URLs or copy secrets into URLs. Add integration regression test exercising actual Passport session regeneration rather than mocked callback alone: anonymous browser starts pairing -> OAuth success -> exact approval page with pairing id and authenticated browser user -> explicit approval -> desktop confirms actual identity. Also investigate missing web user context: screenshot ordinary /goals has no user; do not assume redirect fix proves browser session works. Remote UI has pairing route; config.js apiBaseUrl empty but compiled fallback contains https://api.gitfix.dev; API FRONTEND_URL=https://ui.gitfix.dev, COOKIE_DOMAIN=.gitfix.dev. No weakening auth, no credential reset, no automatic OAuth approval, no worker restarts/deployment. Keep backend jobs undisturbed. Link PR Closes this issue, reference #2269. Use ProPR implementation. Report test evidence and any remaining real-user approval prerequisite.

Activity

  1. propr-dev commented on Sep 10, 2026

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using codex agent with gpt-6-astra model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: codex
    • Model: gpt-6-astra
    • Branch: 2286/gpt-6-astra-fix-auth-preserve-desktop-20260910-2159-pah
    • Base Branch: main
    • Worktree: issue-2286-20260910-2159-gpt-6-astra-pah

    🔍 Track Task Execution

  2. integry commented on Sep 10, 2026

    @integry
    OwnerAuthor

    The processing notice reports Base Branch: main, but this task must use desktop epic 1950-epic-cross-platform-dsk as specified in the issue. Before implementation, incorporate that epic and target the PR to 1950-epic-cross-platform-dsk, not main. It contains the deployed desktop pairing routes and account switching. Do not duplicate the task; correct the current task branch/PR base. Preserve unrelated work.

  3. integry commented on Sep 10, 2026

    @integry
    OwnerAuthor

    Additional read-only runtime evidence: the isolated Chromium profile does have a .gitfix.dev connect.sid cookie (HttpOnly, SameSite=Lax; inspected metadata only, no cookie value). Missing visible user cannot simply be attributed to there being no browser cookie. UI has DesktopPairingPage bundled, runtime apiBaseUrl is empty and compiled fallback includes https://api.gitfix.dev. Please ensure regression test checks authenticated /api/auth/user after callback as well as redirect preservation. Reviewed initial patch: carrying only revalidated return intent across normal Passport middleware is preferable to copying all anonymous session state.

  4. added a commit that references this issue on Sep 10, 2026
  5. integry commented on Sep 10, 2026

    @integry
    OwnerAuthor

    Fixed via #2287, merged into desktop epic and deployed API-only. Subsequent real two-GitHub-account pairing/switch/logout acceptance passed and is recorded in closed #2269.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions