bug: Interactive TUI unconditionally injects cloud-platform scope, breaking org-restricted accounts
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 88/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- authentication, cli
Direzione di ricerca
Leggi la logica di selezione degli scope intorno alla riga 860 in src/auth_commands.rs, quindi esegui le riproduzioni fornite di gws auth login con e senza la TUI. Il lavoro è completato quando la TUI rispetta gli scope selezionati dall'utente e cloud-platform compare solo quando viene richiesto esplicitamente tramite la TUI, --full o --scopes.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
The interactive TUI scope picker in gws auth login unconditionally injects the cloud-platform scope after selection, regardless of what the user chose. This causes admin_policy_enforced errors for users in Google Workspace organizations that block the cloud-platform scope.
Root Cause
In src/auth_commands.rs, line ~860:
// Always include cloud-platform scope
if !selected.contains(&PLATFORM_SCOPE.to_string()) {
selected.push(PLATFORM_SCOPE.to_string());
}
This runs after every TUI selection, forcing cloud-platform into the scope list even when the user explicitly chose only basic services.
Contradiction with DEFAULT_SCOPES
The code comments on lines 56-62 explicitly acknowledge that cloud-platform is restricted and was intentionally removed from DEFAULT_SCOPES:
/// Previously this included `pubsub` and `cloud-platform`, which Google marks
/// as *restricted* and blocks for unverified apps, causing `Error 403:
/// restricted_client`. Use `--scopes` to add those scopes explicitly when you
/// have a verified app or a GCP project with the APIs enabled and approved.
pub const DEFAULT_SCOPES: &[&str] = MINIMAL_SCOPES;
Yet the TUI path contradicts this design by force-injecting the scope that was deliberately excluded.
Reproduction
# This works (no TUI, no cloud-platform injected):
echo "" | gws auth login
# This fails (TUI injects cloud-platform):
gws auth login
# This also fails (TUI still opens even with -s):
gws auth login -s drive,gmail,calendar,sheets,docs,slides
Error
Error 400: admin_policy_enforced
The generated OAuth URL contains cloud-platform even when only basic services (drive, gmail, calendar) are selected in the TUI.
Expected Behavior
- The TUI should NOT force-inject
cloud-platform— it should respect the user's selection cloud-platformshould only be included when the user explicitly selects it in the TUI, uses--full, or adds it via--scopes- The TUI behavior should be consistent with
DEFAULT_SCOPES(which excludescloud-platform)
Suggested Fix
Remove or conditionalize the forced injection at line ~860:
- // Always include cloud-platform scope
- if !selected.contains(&PLATFORM_SCOPE.to_string()) {
- selected.push(PLATFORM_SCOPE.to_string());
- }
If cloud-platform needs to remain available, it should be a selectable option in the TUI rather than being silently injected.
Workaround
Bypass the TUI by piping empty input:
echo "" | gws auth login
Environment
- gws v0.18.0 (homebrew)
- Managed Google Workspace account
- macOS
- Lingua principale
- Rust
- Stelle
- 31.1k
- Fork
- 1.8k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di googleworkspace/cli
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
googleworkspace/cli#921 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
googleworkspace/cli#920 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
googleworkspace/cli#914 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
googleworkspace/cli#882 · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
googleworkspace/cli#858 ·
Tutte le issue di googleworkspace/cli
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
gitbutlerapp/gitbutler#15998 · 1 commento ·
-
bug triage:deciding
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100