Hey Jeff: you're right that when you write some data into Firebase/Firestore, the data:
- Is protected over the wire using HTTPS.
- Then, when it lands on the Firebase REST frontend server, HTTPS terminates and the server has access to the full payload
- Then the REST server routes the data to the backend/database, which also has access to the data.
- When the data is written into disk, it's encrypted at-rest, but the at-rest encryption keys are also available to Google and your administrators will also see the Firestore contents
Encrypting data client side (End-to-End Encryption) prohibits all these participants/roles seeing your data.
Encrypting data on client side is fairly simple (compatibility across mobile platforms and browsers is tricky). The other tricky part is the key management to enable one user access to the decryption key without the other user sending the key over in an unsecure channel.
The way you can implement this is:
- Create private & public keys for your users when you sign them up
- Encrypt data on user1's device with user2's public key
- Write the encrypted data into Firestore
- When user2 reads up the encrypted data, her private key will be able to decrypt it.
Check out this Firebase E2EE chat sample on GitHub for iOS: https://github.com/VirgilSecurity/demo-firebase-ios and Android: https://github.com/VirgilSecurity/demo-firebase-android
HTH,
David