23

I'm building an app that stores users' potentially-private notes. It's a little weird to me that I can just go into the Firebase Forge UI and look up anything which anyone has written, and it also means that anyone who somehow gains access to my Firebase account can then go in and select "Export JSON" to get all of my users' data.

Obviously I am careful with my account and am a scrupulous human being, but it generally seems like good practice for administrators to not have access to all of our users' data.

The only way I can think of to accomplish this would be to store everything in stringified JSON that has been encrypted by the user's password, but that obviously makes dealing with Firebase much more annoying, and would prevent granular access to data below the point at which things are stringified and encrypted.


Edit: This is, on second thought, not specific to Firebase, but is the case with most/all data stores unless you go out of your way to make it otherwise.

4
  • 3
    I'm not sure this makes a lot of sense as you've presented it. If you give someone administrative/root access to a SQL database/Firebase/server/etc, then they can read all the data. Can you clarify what use case you're trying to solve, and why you feel they need root/admin access to achieve it?
    – Kato
    Dec 30, 2013 at 1:35
  • 4
    @Kato yes now that I think about it you're right: this is the case with any database out of the box. I ask because my friend said "so if I use your app you'll be able to read everything I write right?" to which I said "well... yes actually I could." I just feel like I shouldn't be able to, in principle, and because the credentials to my Firebase account are a single point of failure for security. It's not that I need to give anybody else root access. I will ask a more general question on SO about administrators being able to access their users' data...
    – tobek
    Dec 30, 2013 at 2:00
  • You don't have to store everything in stringified JSON. Just encrypt the sensitive data and store it at the same location as you would if you weren't encrypting it. Like: Notes: { note: "..encrypted text..", userId: "abcd123", .... }. You could create some helper functions that would be in charge of locally encrypting/decrypting the data from firebase. This keeps it relatively simple to do and allows you to use Firebase in pretty much the same way as you would w/o encryption.
    – Mike Pugh
    Dec 30, 2013 at 15:18
  • It's currently not possible to do this unless you encrypt the user's data before storing it in Firebase. This isn't helpful at all, however, because since you encrypted the data in the first place it means you already had access to the plaintext (or atleast your code did)...
    – Anant
    Dec 30, 2013 at 20:11

1 Answer 1

6

The only way to guarantee information security is to hand roll your own encryption on the server. You could host your firebase connectivity server-side and have your user send the data to that via SSL and from there do your encryption and then use the SSL address of firebase to store.

On the clientside, things are suspect to CSS attacks. If you really want to go down this route you can use js encryption from this lib: http://code.google.com/p/crypto-js/. Note that crpto-js works well in isolation but you will also need to be sure your webpages are not tampered with (quite hard to do IMOP, cause you don't know whats infected the users machine)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.