Feature request: --subject flag (or env var) for service-account impersonation on user-context APIs (Keep, Admin Directory, etc.)
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 52/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Pouca atividade
- Stack de tecnologia
- rust
- Domínio
- api, authentication, cli
Direção de pesquisa
No source file or test is named. Start by locating the Rust service-account credential construction and CLI global-argument or environment-variable parsing, then reproduce the Keep notes request with domain-wide delegation. Done means a supported subject setting reaches the credentials and enables the documented user-context API flow without breaking existing service-account authentication.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Problem
Some Google Workspace APIs only work with a service account that impersonates a user via domain-wide delegation. Notable examples:
- Keep API (
keep.googleapis.com) — explicitly states user OAuth is unsupported; only service accounts work, and they need to act on behalf of a real user (since notes belong to users). - Admin Directory write operations on certain entities.
- Cloud Identity device APIs.
gws today supports two auth modes:
- User OAuth via
gws auth login - Service account via
GOOGLE_APPLICATION_CREDENTIALS=/path/to/sa.json
In the SA path, there's no way to set the JWT subject (the user to impersonate). Without it, gws keep notes list returns:
{
"error": {
"code": 403,
"message": "Request had insufficient authentication scopes.",
"reason": "unknown"
}
}
even when the SA has DWD authorized for https://www.googleapis.com/auth/keep on the target domain.
Reproduction
- Create an SA in GCP, enable DWD via Workspace Admin (
admin.google.com → Security → API controls → Domain-wide Delegation) with scopehttps://www.googleapis.com/auth/keep. - Export
GOOGLE_APPLICATION_CREDENTIALS=/path/to/sa.json. - Run
gws keep notes list. - 403 — there is no user context attached to the request.
Proposed solution
Add one of:
- CLI flag
--subject <[email protected]>on commands (or globally ongws auth login). - Env var
GOOGLE_WORKSPACE_CLI_SUBJECTorGOOGLE_WORKSPACE_CLI_IMPERSONATE.
Internally this maps to subject=... when constructing google.oauth2.service_account.Credentials (or the equivalent Go/Rust binding depending on the implementation language).
Workaround used today
Standalone Python script using google-auth directly:
creds = service_account.Credentials.from_service_account_file(
"sa.json",
scopes=["https://www.googleapis.com/auth/keep"],
subject="[email protected]",
)
Works, but means losing all the schema-discovery / formatting / pagination ergonomics that gws ships with.
Why it matters
Without subject impersonation, gws-keep, parts of gws-admin-directory, and other DWD-only flows are effectively dead code in the skill set — the auth path can't be completed.
Happy to PR this if there's interest in the direction.
- Linguagem predominante
- Rust
- Estrelas
- 32.3k
- Forks
- 2k
- Merge médio
- 16h 3min
- PRs com merge (30d)
- 1
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de googleworkspace/cli
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 80/100
googleworkspace/cli#984 ·
Mantenedores costumam responder em até 1 dia
-
auth export masks secrets by default with no warning; consumers fail later with invalid_clientAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 64/100
googleworkspace/cli#983 ·
Mantenedores costumam responder em até 1 dia
-
Replace gemini with agyAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 82/100
googleworkspace/cli#958 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
googleworkspace/cli#921 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
googleworkspace/cli#920 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de googleworkspace/cli
Issues semelhantes
-
crate: spate-kafka priority: low tech-debt
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Mantenedores costumam responder em até 1 dia
-
[Bug]: Executable check only looks at the "others" execute bit, so 0750 binaries are rejectedAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
macOS 菜单栏托盘图标保留橙色,与系统单色图标风格不一致Talvez já em andamento @xhugoliu assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
YizhengWw/HachimoDock#56 · 1 comentário ·
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
area:ui bug effort:low P2 source:agent
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 86/100
Mantenedores costumam responder em até 1 dia