Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Firebase Database URL to Android secrets #2717

Merged
merged 6 commits into from
Oct 11, 2023

Conversation

avazirna
Copy link
Contributor

@avazirna avazirna commented Oct 2, 2023

Summary

This addresses an issue raised by the auditors in which sensitive information was hard-coded in the app, in this case, the Firebase Database URL. More on ticket: INDIV-97.

Safety Assurance

  • [ X ] I have confidence that this PR will not introduce a regression for the reasons below

Safety story

The Firebase services CommCare relies on, Crashlytics and Firebase Cloud Messaging, were tested after this move, and they worked as expected.

It seems that CommCare is not using Firebase Realtime Database so parking
this for now
@avazirna avazirna added this to the 2.54 milestone Oct 2, 2023
@avazirna avazirna self-assigned this Oct 2, 2023
@avazirna
Copy link
Contributor Author

avazirna commented Oct 2, 2023

@shubham1g5 I don't think we use Firebase Cloud Database, right? I wonder if we should just remove this entry from the google-services file

@shubham1g5
Copy link
Contributor

We don't use Firebase Cloud Database but are you sure the url is only required for cloud database and not for other Firebase services ?

@@ -290,7 +291,7 @@ android {

buildConfigField "String", "HQ_API_USERNAME", "\"${project.ext.HQ_API_USERNAME}\""
buildConfigField "String", "HQ_API_PASSWORD", "\"${project.ext.HQ_API_PASSWORD}\""

buildConfigField "String", "FIREBASE_DATABASE_URL", "\"${project.ext.FIREBASE_DATABASE_URL}\""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does this feeds into google-services.json ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't, it will come from ~/.gradle/gradle.properties now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't firebase need it to be in google-services.json ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the tests I ran, it doesn't seems that there aren't services relying on it. I can re-run them just to make sure.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add what tests you run to the safety story for this PR ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are adding FIREBASE_DATABASE_URL as a build config field but never utilising this field. As such I am struggling to understand the approach behind this change in how Firebase will utilise it from the build config ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment it seems that there is no use for it, so we could actually remove it. But because the initial reasoning was just to 'move' it, I decided to put it there. Should we just remove it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't understand the need to move or delete it and a bit hesitant to go ahead with it without testing all Firebase services we use. The url is a public url and is behind authentication, since we already have the project_id visible in google services json anyone can anyway construct this url easily with format https://{project_id}.firebaseio.com

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, that was also my thinking, with the project ID it's easy to put the url together. Is there any particular Firebase we should be concerned about? I can run additional tests.

@avazirna
Copy link
Contributor Author

avazirna commented Oct 4, 2023

@damagatchi retest this please

@shubham1g5
Copy link
Contributor

The Firebase services CommCare relies on, Crashlytics and Firebase Cloud Messaging, were tested after this move, and they worked as expected.

They were tested with the release apk from this build ? How did you test Crashlytics (as in how did you made sure to trigger a crash with the release apk on this branch ?)

@avazirna
Copy link
Contributor Author

avazirna commented Oct 4, 2023

The Firebase services CommCare relies on, Crashlytics and Firebase Cloud Messaging, were tested after this move, and they worked as expected.

They were tested with the release apk from this build ? How did you test Crashlytics (as in how did you made sure to trigger a crash with the release apk on this branch ?)

By throwing a RuntimeException in FormEntryActivity onCreate, and yes, using a release apk. I don't think we initialize Firebase services in debug mode. Here's a recent Crashlytics report.

@avazirna avazirna merged commit 1776bb8 into master Oct 11, 2023
4 of 6 checks passed
@avazirna avazirna deleted the move_firebase_url_to_android_secrets branch October 11, 2023 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants