fix(auth): validate service names in auth login --services flag#829
fix(auth): validate service names in auth login --services flag#829nuthalapativarun wants to merge 1 commit into
Conversation
Typos like `-s driev` previously produced a silent empty scope list and proceeded with a useless OAuth login. Now validate_service_names() runs before the OAuth flow starts and returns a clear Validation error listing both the unknown names and all valid aliases. Fixes googleworkspace#741
🦋 Changeset detectedLatest commit: 3423a47 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 improves the robustness of 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 validation for service names passed to the auth login --services command. It updates the CLI help text to list valid service names, adds a validate_service_names function to check for unknown aliases, and integrates this validation early in the login flow to return clear errors. Additionally, unit tests have been added to verify this validation behavior. There are no review comments, so I have no feedback to provide.
Summary
auth login --services driev(typo) silently dropped the unknown name and proceeded with an empty scope list, resulting in a useless login without any error message.This change adds
validate_service_names()which runs before the OAuth flow starts and returns a clearValidationerror listing both the unknown service names and all valid aliases. The--serviceshelp text is also updated to document that unknown names are rejected.Fixes #741
Changes
validate_service_names()helper that checks each name in the filter against all known aliases fromcrate::services::SERVICEShandle_login_inner()before any OAuth or credential work begins--serviceshelp text to document the valid names and that typos are rejectedresolve_scopes_services_filter_unknown_service_ignoredtest (which documented the broken behavior) with four new tests covering: typo rejection, known names, multi-alias names, and empty setChecklist
cargo fmt --all(CI will verify — no local Rust toolchain on this machine)cargo clippy -- -D warnings(CI will verify)cargo test(CI will verify)