Skip to content

[Fix] Linear session resumes with the wrong authorized account - #889

Merged
mrubens merged 2 commits into
developfrom
fix/linear-oauth-replay-identity-17arnltx0cil0
Jul 29, 2026
Merged

[Fix] Linear session resumes with the wrong authorized account#889
mrubens merged 2 commits into
developfrom
fix/linear-oauth-replay-identity-17arnltx0cil0

Conversation

@roomote-roomote

@roomote-roomote roomote-roomote Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Opened on behalf of Matt Rubens. Follow up by mentioning @roomote-roomote, in the web UI, or in Slack.

What changed

Linear OAuth replays now require the authorized viewer's user ID and organization ID to match the identity saved with the original session. Successful authorization stores identity metadata and OAuth tokens together in one connection update.

Replay setup no longer clears an existing Linear connection, and a mismatch leaves its metadata, tokens, enabled state, and authentication status unchanged while keeping the replay unconsumed.

Focused coverage verifies both user and organization mismatches, as well as callback token-storage ordering.

Why this change was made

The replay flow previously accepted any Linear viewer and organization, which could link a different Linear account and start the original session under an identity that had not initiated it. This addresses the identity-binding issue reported in PR #887.

Impact

Users must authorize the same Linear account and organization that initiated a replayed session. Incorrect account selection now fails safely without replacing or disconnecting an existing Linear link, while successful authorization cannot leave mixed token and identity state.

@roomote-roomote

roomote-roomote Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

No new code issues found. See task

  • apps/web/src/app/api/mcp-oauth/callback/route.ts:320-331 Store token and identity metadata atomically or validate the identity before either write. Resolved: Linear identity metadata and OAuth tokens now persist in one connection update.
  • apps/web/src/lib/server/mcp-linear.ts:197-210 Preserve an existing Linear link when rejecting a replay identity mismatch. Resolved: replay setup no longer resets an existing connection, and this mismatch no longer marks it errored.

Reviewed 0296736

@roomote-roomote

roomote-roomote Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Fixed both review findings in 02967366: Linear identity metadata and OAuth tokens now persist in one connection update, and replay mismatches preserve any existing Linear link while leaving the replay unconsumed. See task.

@mrubens
mrubens marked this pull request as ready for review July 29, 2026 18:58
@mrubens
mrubens merged commit 39071bf into develop Jul 29, 2026
17 checks passed
@mrubens
mrubens deleted the fix/linear-oauth-replay-identity-17arnltx0cil0 branch July 29, 2026 18:58
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.

1 participant