gws auth login --help (and -h) is silently ignored — starts the OAuth flow instead of printing help

Đang mở
#782 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

  • #835 của @nuthalapativarun — đã đóng, không merge

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
rust
Lĩnh vực
authentication, cli

Hướng nghiên cứu

Start at the gws auth <method> dispatch and compare it with the working top-level and helper-command help paths. Reproduce gws auth login --help, -h, and the other auth methods without triggering their real actions. Done means each auth method prints its help and exits before OAuth, setup, status, export, or logout side effects occur.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

gws auth <method> --help (and -h) is silently ignored — the help flag does not print help, and the subcommand executes
its real action instead. This is at minimum surprising and at worst dangerous for auth login, which triggers an OAuth
flow (printing an authorization URL and waiting on stdin) when the user only intended to read the help text.

Other gws commands handle --help correctly, which makes the inconsistency the most notable part.

Reproduction

Tested on @googleworkspace/cli 0.18.1, macOS 26.4.1, Node 24.14.0.

$ gws auth login --help                                        
Open this URL in your browser to authenticate:
  https://accounts.google.com/o/oauth2/auth?scope=...&redirect_uri=http://localhost:52908&...
# → starts a real OAuth flow, binds a localhost redirect port, waits on stdin                                              

$ gws auth login -h                                                                                                        
# same — starts the OAuth flow                                                                                             

$ gws auth setup --help                                                                                                    
Step 1/6: Checking for gcloud CLI...                           
  ✓ gcloud CLI found
# → starts the real interactive setup wizard
                                                                                                                           
$ gws auth status --help
Using keyring backend: keyring                                                                                             
# → runs the status command                                    

For comparison, these work correctly:

$ gws --help
gws — Google Workspace CLI                                                                                                 
USAGE: ...                                                     
# ✓ prints help

$ gws auth                              # no subcommand
Usage: gws auth <login|setup|status|export|logout> [options]
# ✓ prints help (this is what `--help` should produce too)                                                                 

$ gws gmail +triage --help                                                                                                 
[Helper] Show unread inbox summary (sender, subject, date)     
Usage: gws +triage [OPTIONS]                                                                                               
Options: ...
# ✓ prints help                                                                                                            

So --help is honored at the top level (gws --help), at the bare-subcommand level (gws auth), and on helper commands
(gws +triage --help) — but not on any of auth login, auth setup, auth status, auth export, auth logout. The
argument parser appears to be skipped or short-circuited for the auth methods specifically.

Why this matters

  • gws auth login --help is a natural thing for a user to type while exploring the CLI. Today it has the side effect of
    starting an OAuth flow that binds a localhost port, opens a browser tab in some configurations, and may overwrite saved
    credentials when completed. That's a footgun.
  • gws auth setup --help similarly starts the real interactive setup wizard, including gcloud probing. A user trying to
    learn what flags setup accepts ends up walking through actual setup.
  • The inconsistency with the rest of the CLI (--help works everywhere else) is a usability bug regardless of the side
    effects.

Suggested fix

Have gws auth <method> route through the same argument parser the other subcommands use, so --help/-h short-circuits
before any side effect. The output of gws auth (the bare subcommand) is already a good template for what gws auth login --help should print.

Environment

  • @googleworkspace/cli 0.18.1
  • macOS 26.4.1 (Darwin 25.4.0), Node 24.14.0
Ngôn ngữ chính
Rust
Star
32.3k
Fork
2k
Merge trung bình
16 giờ 3 phút
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của googleworkspace/cli

Tất cả issue của googleworkspace/cli

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.