auth export masks secrets by default with no warning; consumers fail later with invalid_client
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 gws auth export 背后的 Rust auth 命令模块开始,找到 --unmasked 标志决定在打印前是否对 client_secret 进行遮蔽的位置;那个分支就是应该放置 stderr 警告或 _masked 标记的地方。结合 README 的 headless/CI 部分阅读导出路径,使警告与文档化的工作流一致,然后检查 auth export 现有的 CLI 测试,添加一个断言被遮蔽输出会发出警告的用例。完成意味着被遮蔽的导出可区分(stderr 警告或标记),而 --unmasked 的输出保持静默;auth status --format json 的小问题则是同一命令树中另一个更小的独立改动。
由索引模型根据 Issue 内容生成。
描述
Summary
gws auth export without --unmasked prints credential-shaped JSON and exits 0, with nothing in the output, the exit code, or stderr indicating that the client_secret is masked. Anything that consumes that output — a script, an agent, a human setting up a headless box — accepts the shape and then fails later, inside a different library, with an error that points at credential corruption instead of at the export step.
Environment
gws0.22.5 on Linux- OAuth2 desktop client,
keyringbackend, encrypted credentials store - Consumer:
google.oauth2.credentials.Credentials.from_authorized_user_info(...)fromgoogle-auth
Reproduction
gws auth logininteractively; confirmgws auth statusreportstoken_valid: trueand that real API calls succeed (they did —gmail users getProfile,calendar calendarList list).gws auth export→ prints JSON with keystype,client_id,client_secret,refresh_token. Exit code 0.- Feed that JSON to
google-authand refresh:
RefreshError: ('invalid_client: The provided client secret is invalid.',
{'error': 'invalid_client',
'error_description': 'The provided client secret is invalid.'})
I read that as "the stored client secret is corrupt" and went looking for credential damage — while gws itself kept working fine against the same store, which made export look broken rather than under-promising.
The actual answer was in gws auth export --help:
--unmasked Show secrets without masking
and in the README's Headless / CI flow, which uses gws auth export --unmasked > credentials.json. Masking by default is the right call; failing silently about it is the problem.
Why it matters
- Masked output is structurally indistinguishable from a real credential file, so consumers cannot detect it.
- The failure surfaces later, in another process, with a message that misattributes the cause (
invalid_clientsuggests a bad secret for thatclient_id, not an intentionally masked value). - The CLI knows exactly which flag was missing but never says so.
Suggested fixes
Any one of these would have avoided the detour:
- When emitting masked output, warn on stderr:
warning: client_secret is masked and this output is not usable as credentials — re-run with --unmasked. - Add a marker field to the JSON when masking, e.g.
"_masked": true, so consumers can detect it programmatically. - Consider a non-zero exit (or a
--force) when masked output is written while stdout is redirected to a file, since that is the exact shape of the documented copy-to-another-machine workflow.
Related nit (same investigation)
gws auth status --format json fails with error: unexpected argument '--format' (exit 3), even though the default auth status output is already JSON. Every other command surface accepts --format, so scripts that pass it uniformly trip over this one subcommand.
- 主要语言
- Rust
- 星标
- 32.3k
- 派生
- 2k
- 平均合并
- 16 小时 3 分钟
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
googleworkspace/cli 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 80/100
googleworkspace/cli#984 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
googleworkspace/cli#958 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
googleworkspace/cli#921 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
googleworkspace/cli#920 ·
维护者通常 1 天内回复
-
docs(gmail): the --draft tip prints a send command that fails (users.drafts.send --body)可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
googleworkspace/cli#914 · 1 条评论 ·
维护者通常 1 天内回复
查看 googleworkspace/cli 的全部 Issue
相似的 Issue
-
area:cli area:security bug priority:medium
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
status: new topic: ga4gh-sdk type: bug
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
comp-rbac
难度 2/5 1-3 小时 新手友好度 68/100
ClickHouse/ClickHouse#131875 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
bug(python): read_transaction raises TypeError on a Rewrite with rewritten indices可能已有人在做 @Borg93 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 75/100
lance-format/lance#11117 ·
维护者通常 2 天内回复