auth export masks secrets by default with no warning; consumers fail later with invalid_client
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 64/100
Research direction
Start in the Rust auth command module behind gws auth export and find where the --unmasked flag decides whether client_secret is masked before printing; that branch is where a stderr warning or a _masked marker belongs. Read the export path together with the README's headless/CI section so the warning matches the documented workflow, then check the existing CLI tests for auth export to add a case asserting the masked output warns. Done means masked exports are distinguishable (stderr warning or marker) while --unmasked output stays silent; the auth status --format json nit is a separate, smaller change in the same command tree.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Rust
- Stars
- 32.3k
- Forks
- 2k
- Avg merge
- 16h 3m
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from googleworkspace/cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
googleworkspace/cli#984 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
googleworkspace/cli#958 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
googleworkspace/cli#921 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
googleworkspace/cli#920 ·
Maintainers usually reply within 1 day
-
docs(gmail): the --draft tip prints a send command that fails (users.drafts.send --body)May be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
googleworkspace/cli#914 · 1 comment ·
Maintainers usually reply within 1 day
All issues in googleworkspace/cli
Similar issues
-
area:cli area:security bug priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
status: new topic: ga4gh-sdk type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
comp-rbac
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ClickHouse/ClickHouse#131875 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
bug(python): read_transaction raises TypeError on a Rewrite with rewritten indicesPossibly taken @Borg93 claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
lance-format/lance#11117 ·
Maintainers usually reply within 2 days