Skip to content

fix(oauth): start provider login with an authenticated POST - #109

Merged
gabrielvfonseca merged 2 commits into
mainfrom
fix/oauth-authorize-flow
Oct 27, 2026
Merged

gabrielvfonseca merged 2 commits into
mainfrom
fix/oauth-authorize-flow

Conversation

@gabrielvfonseca

Copy link
Copy Markdown
Contributor

Summary

  • The provider login start was a GET redirect, but the control-plane key is sent as a header, and a browser navigation cannot send that header. The browser flow was broken by the key requirement. It is now POST /v1/oauth/:provider/authorize (key required), which returns { "provider", "authorize_url" }. The caller opens that URL.
  • The authorize URL is built with Url::parse_with_params, so redirect_uri and scope are percent-encoded. A test covers injection attempts through both values.

Behaviour change

Callers that used GET /v1/oauth/:provider/authorize must switch to the authenticated POST and open the returned authorize_url. No callers in this repo used the GET route.

Verification

  • cargo test -p code-server passes, including the new encoding test and the updated auth test (POST with and without the key).
  • Not run against a live provider.

🤖 Generated with Claude Code

gabrielvfonseca and others added 2 commits October 27, 2026 16:09
Windows release builds failed to compile: code-plugins imported Path only for
the non-Windows branch, and code-runtime declared an unused mut on the Windows
hook builder. Test-only Unix APIs (PermissionsExt, unix symlinks) are now
gated behind cfg(unix) so the test targets also compile on Windows.

Verified with cargo check --target x86_64-pc-windows-gnu --tests for cli,
code-runtime, code-plugins, code-tools, code-server, code-sandbox and code-core.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
The authorize route was a GET redirect. A browser navigation cannot send the
x-api-key header that the control-plane key middleware requires, so the
browser login flow broke when that key requirement landed. Start the flow with
an authenticated POST that returns the provider URL as JSON, which the caller
opens itself.

Also percent-encode the authorize URL parameters with Url::parse_with_params.
The previous string format left redirect_uri and scope unencoded.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2c2cf065-1368-41e4-851c-497d4e1060a6
Commits

Reviewing files that changed from the base of the PR and between 4177731 and d22c9db.

Files selected for processing: 6
  • cli/tests/mock_parity_harness.rs
  • crates/code-plugins/src/hooks.rs
  • crates/code-runtime/src/file_ops.rs
  • crates/code-runtime/src/hooks.rs
  • crates/code-runtime/src/permission_enforcer.rs
  • crates/code-server/src/lib.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gabrielvfonseca
gabrielvfonseca merged commit be6cfa9 into main Oct 27, 2026
22 checks passed
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