Desktop: remove prod Firebase credentials from git, inject at CI#5540
Desktop: remove prod Firebase credentials from git, inject at CI#5540
Conversation
Prod GoogleService-Info.plist (based-hardware) was committed to the public repo. Replace with dev values (based-hardware-dev) to match Flutter's pattern. Prod values will be injected at CI via secret. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Decode MACOS_GOOGLE_SERVICE_INFO_PLIST base64 secret at build time instead of copying prod plist from git. Falls back to dev plist in git with a warning if the secret is not set. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Both scripts now check MACOS_GOOGLE_SERVICE_INFO_PLIST env var and decode the base64 prod plist. Falls back to dev plist from git with a warning if the env var is not set. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR removes production Firebase credentials from the git-tracked Key changes:
Confidence Score: 3/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Build triggered] --> B{MACOS_GOOGLE_SERVICE_INFO_PLIST set?}
B -- Yes --> C[base64 --decode env var]
C --> D[Write prod GoogleService-Info.plist to app bundle]
D --> E[Log: Injected prod plist from CI secret]
B -- No --> F[cp Desktop/Sources/GoogleService-Info.plist to bundle]
F --> G[Log: WARNING - using dev plist]
G --> H[Dev project values used\nAPI_KEY, PROJECT_ID, STORAGE_BUCKET OK\nCLIENT_ID = placeholder → OAuth broken]
E --> I[Prod Firebase config in bundle\nFully functional]
H --> J[App runs against based-hardware-dev\nGoogle Sign-In non-functional]
I --> K[Release build ships]
J --> L[Local/fallback build ships]
Last reviewed commit: 8883abe |
| <string>1031333818730-placeholder.apps.googleusercontent.com</string> | ||
| <key>REVERSED_CLIENT_ID</key> | ||
| <string>com.googleusercontent.apps.208440318997-suqloh00q5r3ovgoqikvsrf9aqn1t54e</string> | ||
| <string>com.googleusercontent.apps.1031333818730-placeholder</string> | ||
| <key>ANDROID_CLIENT_ID</key> | ||
| <string>208440318997-1ek8tj5oa9ljmnh8tgehk27nqpivivbf.apps.googleusercontent.com</string> | ||
| <string>1031333818730-placeholder.apps.googleusercontent.com</string> |
There was a problem hiding this comment.
Placeholder OAuth credentials break Google Sign-In in fallback builds
CLIENT_ID, REVERSED_CLIENT_ID, and ANDROID_CLIENT_ID are set to non-functional placeholder values (1031333818730-placeholder). The REVERSED_CLIENT_ID is registered as a custom URL scheme in Info.plist so that Google's OAuth flow can redirect back to the app — a placeholder value here won't match any registered OAuth client, so the redirect will silently fail and the Google Sign-In flow will never complete.
The PR description characterises the fallback path as "functional but against dev Firebase", but with placeholder OAuth credentials it is not functional for authentication at all. If real dev OAuth client IDs exist in GoogleService-Info-Dev.plist, those values should be copied here too (they are dev credentials and carry the same risk profile as the rest of this file). If the dev project genuinely has no OAuth client configured, the comment/description should be updated to reflect that Google Sign-In will be broken in local fallback builds.
| if [ -n "$MACOS_GOOGLE_SERVICE_INFO_PLIST" ]; then | ||
| echo "$MACOS_GOOGLE_SERVICE_INFO_PLIST" | base64 --decode > "$APP_BUNDLE/Contents/Resources/GoogleService-Info.plist" |
There was a problem hiding this comment.
Validate decoded plist before writing
Both build.sh (line 88–89) and release.sh (line 428–429) decode the secret and write it directly to the app bundle in one step. If $MACOS_GOOGLE_SERVICE_INFO_PLIST is set but contains malformed base64 (e.g., truncated value, wrong encoding), base64 --decode will fail — but because the shell redirect (>) already opened and truncated the target file before the decode fails, set -e exits with an empty/corrupt plist already written to the bundle. A safer pattern is to decode into a temp file and move it only on success:
PLIST_TMP=$(mktemp)
echo "$MACOS_GOOGLE_SERVICE_INFO_PLIST" | base64 --decode > "$PLIST_TMP" \
&& mv "$PLIST_TMP" "$APP_BUNDLE/Contents/Resources/GoogleService-Info.plist" \
|| { echo "ERROR: Failed to decode MACOS_GOOGLE_SERVICE_INFO_PLIST"; rm -f "$PLIST_TMP"; exit 1; }The same applies to the codemagic.yaml inline script (line 2109) and release.sh (line 429).
Summary
GoogleService-Info.plistin git with dev (based-hardware-dev) valuesMACOS_GOOGLE_SERVICE_INFO_PLISTbase64 env varChanges
GoogleService-Info.plistcodemagic.yamlMACOS_GOOGLE_SERVICE_INFO_PLISTbase64 secret, fallback to dev plistrelease.shbuild.shRequired CI setup (mon)
Before merging, add
MACOS_GOOGLE_SERVICE_INFO_PLISTto thedesktop_secretsgroup in Codemagic:How it works
GoogleService-Info-Dev.plist→ unaffectedSecurity impact
AIzaSyD9dzBdglc7IO9pPDIOvqnCoTis_xKkkC8) can be rotatedTest plan
MACOS_GOOGLE_SERVICE_INFO_PLISTto Codemagicdesktop_secrets./run.shstill works (uses dev plist)./build.shwarns about dev plistby AI for @beastoin