feat(auth): customize the OAuth callback for remote-host logins - #885
feat(auth): customize the OAuth callback for remote-host logins#885npeshkov wants to merge 11 commits into
Conversation
🦋 Changeset detectedLatest commit: d1cf429 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enables the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces customization options for the OAuth login callback in the Google Workspace CLI, enabling support for remote-host logins where localhost is unreachable. It adds three new environment variables (GOOGLE_WORKSPACE_CLI_OAUTH_REDIRECT_URI, GOOGLE_WORKSPACE_CLI_OAUTH_STATE, and GOOGLE_WORKSPACE_CLI_OAUTH_PORT) to override the redirect URI, set and verify the OAuth state, and pin the callback port. Additionally, the changes include request-line size limits for security, refactored test helpers, updated documentation, and comprehensive unit tests. There are no review comments, so I have no feedback to provide.
|
Hey @jpoehnelt not sure if you are still active in |
Description
gws auth login's flow assumes the browser can reach the CLI's callback server onlocalhost.When the CLI runs on a remote host (e.g. a cloud development environment), the server is not reachable from the developer's laptop browser, so the OAuth callback has to be redirected to an address other than the laptop's
localhost.This Pull Request adds three optional environment variables that let the caller customize the OAuth flow:
GOOGLE_WORKSPACE_CLI_OAUTH_REDIRECT_URI- sets the redirect URI sent to Google.GOOGLE_WORKSPACE_CLI_OAUTH_STATE- astatevalue passed to the authorization URL (see use cases).GOOGLE_WORKSPACE_CLI_OAUTH_PORT- sets the port of the local callback listener.Implementation notes
invalid_grant: Malformed auth code, unless the code is decoded bygws.GOOGLE_WORKSPACE_CLI_OAUTH_STATEis set, thestatereturned on the callback is verified against it. A missing or mismatched value is rejected to guard against forged (CSRF) callbacks.auth.rstotest_support.rs.Checklist
AGENTS.mdguidelines (no generatedgoogle-*crates).cargo fmt --allto format the code perfectly.cargo clippy -- -D warningsand resolved all warnings.pnpx changeset) to document my changes.