Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is google-services.json confidential?

Following the guide on setting up Google Analytics in an Android app (https://developers.google.com/analytics/devguides/collection/android/v4/) I am left wondering if this google-services.json file can safely be committed into source code versioning and pushed to a public GitHub repository or if this file may contain credentials or secrets.

I cannot find a definite answer elsewhere, but I can see that sample apps both commit the file (https://github.com/google/climb-tracker/blob/master/mobile/google-services.json) and others have added the file to their .gitignore.

like image 667
kraenhansen Avatar asked May 01 '16 07:05

kraenhansen


People also ask

Is it safe to commit Google-services json?

Willie Chalmers III points to "Is google-services. json safe from hackers?", and adds: Yes, that API key isn't a server API key which should never be public, so it's fine if your google-services. json is visible by others.

Should I hide Google-services json?

The way that the Google plugin is set up, it will be really hard for you to hide the content of the google-services. json file. The only viable way would be to re-implement yourself what the plugin already does for you, which I wouldn't recommend.

What is Google-services json used for?

The google-services. json file created in this doc is used within your app to connect to firebase and facilitate Android Push Notifications and is normally labelled google-services.

Where does Google-services store json files?

The google-services. json file is generally placed in the app/ directory (at the root of the Android Studio app module).


2 Answers

From this post it seems there's no real reason to keep this file safe. It's data will be in the APK anyway.

like image 179
Yaron Avatar answered Sep 24 '22 11:09

Yaron


Yes. At least the api_keystuff should be kept confidential.

One way to put google-services.json into your public repository and still keep it confidential is to use BlackBox.

In your app level build.gradle put a copy task in for example defaultConfig like this:

defaultConfig {     ...     ...     copy {         from "../secret/"         into "."         include "*.json"     } } 

which will copy the file from your secret/ folder to the right spot.

Now, to build your app you'll have to run blackbox_edit_start google-services.json.gpg the first time you check out your repo, and after that you're good.

like image 41
Espen Riskedal Avatar answered Sep 23 '22 11:09

Espen Riskedal