feat(oauth): drop Cloud Console setup; ship embedded verified client#332
feat(oauth): drop Cloud Console setup; ship embedded verified client#332cpcloud wants to merge 10 commits into
Conversation
roborev: Combined Review (
|
roborev: Combined Review (
|
5a7e134 to
1093c73
Compare
roborev: Combined Review (
|
roborev: Combined Review (
|
roborev: Combined Review (
|
roborev: Combined Review (
|
|
refine-pr note: the latest roborev PR comment appears stale/incorrect. Current go.mod declares |
roborev: FailReview findingsReview found release-blocking and medium-risk issues that should be fixed before merge. High
Medium
Review type: | Agent: codex | Job: 19267 |
|
This would be huge! |
The rebase kept the embedded OAuth path but exposed CI lint failures in the merged test coverage and callback handler. Keep the OAuth resolver behavior unchanged while converting the affected tests to the testify helpers expected by this repo. The callback error response now escapes provider-supplied error text before writing it to the browser, and the embedded credential constants carry the gosec rationale that these are public desktop client identifiers overridden in release builds.
The callback handler now escapes provider-supplied error text before writing it to the browser, but the previous test only verified the error channel. Add a regression test that drives the generic callback error path with HTML metacharacters and checks the response body preserves only the escaped form.
41ef2ee to
6bf6848
Compare
roborev: Combined Review (
|
roborev-ci found that NAS bundles could rely on a published Docker image built with the source/default OAuth client while desktop releases used the production client. Docker publish now requires the same OAuth secrets as release builds and passes them through the existing ldflag path; local and PR image builds leave those values empty instead of baking the development client into containers. The default no-config add-account path now treats the embedded manager like an app switch for token reuse, so a stored token minted by a different client forces reauthorization instead of being reported as already authorized.
roborev: Combined Review (
|
|
Let me know if you need testers! |
Closes #89.
Closes #259.
What changed
[oauth] client_secrets) and named-app routing (--oauth-app NAME) remain as advanced fallbacks for Workspace orgs that block third-party apps, custom-quota needs, or fallback during the verification window.Why
Forcing every user to create a Google Cloud project, enable the Gmail API, and configure an OAuth consent screen before they could sync any mail was the biggest onboarding wall — #89 documented users walking away at this step. Eliminating it makes msgvault usable by people who want to archive Gmail without learning Google's developer console.
Note on embedding OAuth credentials
The "client secret" for a desktop OAuth app isn't actually secret once the binary ships — anyone with the binary can extract it. Google says so directly in their OAuth 2.0 docs under "Installed applications": "The process results in a client ID and, in some cases, a client secret, which you embed in the source code of your application. (In this context, the client secret is obviously not treated as a secret.)"
This PR uses the same hybrid pattern the GitHub CLI uses, where
ghbakes its productionoauthClientSecretdirectly into source under the comment// This value is safe to be embedded in version control. Source defaults live ininternal/oauth/embedded.go; release builds override them via-Xldflags sourced from GitHub Actions Secrets.How to use
msgvault init-db msgvault add-account you@gmail.com # opens browser; no other setup msgvault sync-full you@gmail.com msgvault tuiSee README's "Advanced: bring your own OAuth client" for the BYO path. Full design in
docs/superpowers/specs/2026-05-20-centralized-oauth-design.md.Pre-merge checklist
Merge-blocking:
internal/oauth/embedded.goTBD-*placeholder defaults: either bake in production credentials at source, or change to empty strings so source builds without ldflags fall back to BYOMSGVAULT_OAUTH_CLIENT_IDandMSGVAULT_OAUTH_CLIENT_SECRETtowesm/msgvaultGitHub Actions Secrets (release builds now fail-fast if either is empty)MSGVAULT_HOME:add-account→ consent →sync-full --limit 5Operational follow-ups (out of band, not merge-blocking but track separately):
gmail.readonly,gmail.modify,mail.google.com/)