Skip to content

fix(oauth): keep OAuth endpoints and requests on the deployment origin - #1177

Merged
EhabY merged 2 commits into
mainfrom
fix/oauth-origin
Nov 11, 2026
Merged

EhabY merged 2 commits into
mainfrom
fix/oauth-origin

Conversation

@EhabY

@EhabY EhabY commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Keeps OAuth endpoints, requests, and error text on the deployment's own origin.

  • Metadata: endpoints off the deployment origin or under a workspace app path (/@user/...) are rejected, with an error naming the endpoint.
  • Error text: OAuth failures show in a modal's plain detail instead of a notification, which renders [text](command:...) links in server text.
  • Pending flow: a superseded or disposed flow cleans up its timer and listeners, and the browser opens without blocking, so a rejection while it opens reaches the caller. The expected state is no longer logged.

OAuth POSTs rely on the client's existing cross-origin redirect guard.

Not in this PR: OAuth requests still carry the session token (revocation relies on it), and the dialog can start a second flow after another window's login wins.

Stacked on #1176; review that first.

@EhabY
EhabY requested a review from code-asher October 30, 2026 21:52
@EhabY
EhabY added this pull request to stack #1178 October 30, 2026 21:53
Comment thread src/common/url.ts Resolved
Comment thread src/login/loginCoordinator.ts Resolved
Comment thread src/oauth/authorizer.ts Resolved
Comment thread src/oauth/metadataClient.ts Resolved
@EhabY
EhabY requested a review from code-asher November 9, 2026 10:02
@linear-code

linear-code Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Base automatically changed from fix/origin-keyed-stores to main November 11, 2026 11:45
- Reject OAuth metadata endpoints off the deployment origin or under a
  workspace app path, without echoing them.
- Send OAuth POSTs with maxRedirects: 0.
- Show OAuth failures in a modal's plain detail, not a notification that
  renders command links.
- Clean up superseded or disposed flows, and open the browser without
  awaiting it so early rejections reach the caller.
- Ignore a coder.alternativeWebUrl that is not http(s).
- Rely on the client's cross-origin redirect guard instead of
  maxRedirects: 0 on OAuth POSTs.
- Use coder.alternativeWebUrl as configured again; it is
  application-scoped, so only the user can set it.
- Split the endpoint error into origin and workspace app path cases and
  name the endpoint, which only reaches logs and the plain-text dialog.
@EhabY
EhabY merged commit c07e80a into main Nov 11, 2026
11 of 12 checks passed
@EhabY
EhabY deleted the fix/oauth-origin branch November 11, 2026 11:47
@EhabY EhabY mentioned this pull request Nov 13, 2026
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.

2 participants