Skip to content

fix(auth): inject Google OAuth credentials at build time - #247

Merged
mfauzaan merged 3 commits into
mainfrom
fix/inject-google-oauth-credentials
Jul 13, 2026
Merged

fix(auth): inject Google OAuth credentials at build time#247
mfauzaan merged 3 commits into
mainfrom
fix/inject-google-oauth-credentials

Conversation

@mfauzaan

Copy link
Copy Markdown
Member

Summary

Removes the hardcoded Google OAuth client ID and client secret from cli/src/auth/google_cloud.rs and injects them at compile time from GitHub Actions secrets, following the same pattern already used for WUKONG_HONEYCOMB_API_KEY in the telemetry crate.

  • Prod builds (--features prod): credentials come from env!("WUKONG_GOOGLE_CLIENT_ID") / env!("WUKONG_GOOGLE_CLIENT_SECRET") — the build fails at compile time if the secrets are missing, so a release can never ship without credentials.
  • Dev builds: fall back to empty strings via option_env!, so local cargo build / cargo test and contributor builds work without any secrets (set the env vars locally to test the Google login flow).
  • Both ci.yml and release.yml inject the secrets at the workflow env: level (CI's build job also compiles with --features prod).

Required before merge / next release

  1. Add WUKONG_GOOGLE_CLIENT_ID and WUKONG_GOOGLE_CLIENT_SECRET as Actions secrets in repo settings — prod builds fail without them.
  2. Rotate the credentials in GCP Console — the old values are in the public git history, so removing them from HEAD is not enough. Put the new values in the Actions secrets.
  3. Note for release notes: after rotation, Google login on older installed versions will fail (invalid_client) until users brew upgrade wukong.

Notes

  • The client secret is still embedded in the released binary (inherent to any distributed CLI; Google treats installed-app client secrets as non-confidential per RFC 8252). The win here is keeping it out of source and git history so secret scanners stop flagging it.

Testing

  • cargo check (dev, no env vars) ✅
  • cargo check --features prod with env vars set ✅
  • cargo fmt + cargo clippy — clean (2 pre-existing warnings unrelated to this change)
  • cargo test — one pre-existing snapshot failure (application test, local-environment DNS issue) that also fails on unmodified main; all other tests pass

🤖 Generated with Claude Code

mfauzaan and others added 3 commits July 13, 2026 08:02
Remove the hardcoded Google OAuth client ID and client secret from
source and inject them at compile time from GitHub Actions secrets
(WUKONG_GOOGLE_CLIENT_ID / WUKONG_GOOGLE_CLIENT_SECRET), following the
same pattern as WUKONG_HONEYCOMB_API_KEY in the telemetry crate.

- prod builds (--features prod) fail at compile time if the secrets
  are missing, so a release can never ship without credentials
- dev builds fall back to empty strings so local builds and tests
  work without any secrets

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…alues

- Add GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET to Cross.toml passthrough
  so the Dockerized Linux builds can see them (root cause of the Linux
  CI failures)
- Rename env vars to match the existing GOOGLE_CLIENT_SECRET repo
  secret naming
- Add compile-time asserts: a missing Actions secret expands to an
  empty string which env!() accepts, so prod builds now fail loudly
  instead of shipping blank credentials

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The client ID is a public identifier, so it lives in Actions variables
(vars.GOOGLE_CLIENT_ID) rather than secrets; only the client secret
stays in secrets.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mfauzaan
mfauzaan merged commit a10ccef into main Jul 13, 2026
6 checks passed
@mfauzaan
mfauzaan deleted the fix/inject-google-oauth-credentials branch July 13, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants