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

Is watermelon safe to store sensitive data? #51

Closed
ikhsanalatsary opened this issue Sep 23, 2018 · 21 comments
Closed

Is watermelon safe to store sensitive data? #51

ikhsanalatsary opened this issue Sep 23, 2018 · 21 comments

Comments

@ikhsanalatsary
Copy link

I just curious about it.

@radex
Copy link
Collaborator

radex commented Sep 24, 2018

On iOS, the database file (like all files) are encrypted. Other apps can't read it. And the encryption keys are entangled with a unique device ID and users password, so it's not possible to read the file unless phone is unlocked. API tokens etc should be stored in the Keychain, however.

I don't know about Android — @rozPierog ?

@rozPierog
Copy link
Contributor

Android approach to this is not great, to say at least. All database files are kept in apps /data/ folder from where they are free to grab for any rooted user. (non-root apps should not be able to grab that file) That file can be read by any sql file reader. So if you want better than native security I would suggest some kind of hashing of data before inserting it in database or even better - storing sensitive data on your own server and not on a device.

@radex
Copy link
Collaborator

radex commented Sep 24, 2018

We should make some research into SQLite encryption then @rozPierog — I assume there's some Keychain-like API on Android for storing sensitive keys (like a database encryption key), right? And I know that SQLite has encryption capabilities on top of it (but we'd have to bundle our own version of sqlite into the app in that case)

@rozPierog
Copy link
Contributor

@radex there is Keystore, I've just skimmed thrugh it and it seems like good equvalent of iOS Keychain. Bundling our own SQLite can be expensive on apk size and performance, if we are going to do that that should be an option. Not everyone stores sensitive data on device.

@radex
Copy link
Collaborator

radex commented Sep 24, 2018

@rozPierog OK — can you add this to 🍉 backlog in Nozbe? We should probably research this for our purposes.

@radex
Copy link
Collaborator

radex commented Sep 24, 2018

@ikhsanalatsary Does this answer your questions? If so, please close the issue :)

@ikhsanalatsary
Copy link
Author

@radex Yes, I hope it will implement it in this lib. thank you so much for the answer

@waqas19921
Copy link

waqas19921 commented Feb 17, 2019

@rozPierog @radex can we use this library https://www.zetetic.net/sqlcipher/sqlcipher-for-android/ in android side for encryption purpose and fmdb/sqlcipher for iOS?

@radex
Copy link
Collaborator

radex commented Feb 18, 2019

@waqas19921 I don't think it's necessary on iOS:

On iOS, the database file (like all files) are encrypted. Other apps can't read it.

It would matter only for jailbroken phones with sandboxing disabled, I think.

And yes, encrypting sqlite makes sense, and would be nice if it was an option — but as discussed above, this has consequences on app bundle size and performance. Would you like to do more research on this and contribute to this effort?

@y3g0r
Copy link

y3g0r commented Mar 24, 2019

Here I integrated sqlcipher master...y3g0r:feature/sqlcipher. It's quick and dirty, but it works for me so far. Maybe it will help somebody out there to get the idea on how to get sqlcipher working with WatermelonDB.

PS. To WatermelonDB developers/maintainers: thank you so much for such a great project.
PPS. I might turn my fork into pull request with option to choose between sqlite and sqlcipher. I don't have time for this right now thou.
PPPS. I will probably need encryption in browser as well. Quick search for 'encrypted LokiJS' didn't return any useful results. Maybe somebody can share some ideas on how to get encrypted WatermelonDB in browser? If not encrypted, in-memory will be sufficient for me as well. As far as I understand there is no an easy way to configure in-memory location for both sqlite and lokijs atm. I will try to follow this #83 and maybe will create PR with option to configure in memory location.

@radex
Copy link
Collaborator

radex commented Mar 25, 2019

PPPS. I will probably need encryption in browser as well. Quick search for 'encrypted LokiJS' didn't return any useful results. Maybe somebody can share some ideas on how to get encrypted WatermelonDB in browser?

I don't think (but I might be behind on some API) there's really a good encryption/safe key storage api on the web… But it would be great if there was...

If not encrypted, in-memory will be sufficient for me as well. As far as I understand there is no an easy way to configure in-memory location for both sqlite and lokijs atm. I will try to follow this #83 and maybe will create PR with option to configure in memory location.

Right! It's not actually difficult at all to set up memory databases in either, but it's not exposed to public API. It should be very easy to contribute an extra param or something for in-memory databases

@afiller
Copy link

afiller commented Dec 16, 2019

Is there a plan to integrate the approach by @y3g0r in the near future? We are currently evaluating to integrate WatermelonDB in our app, but encryption is a required feature and so it's quite sad that it could be the only showstopper. (I'm really lucky with the other features of the framework.)

@radex
Copy link
Collaborator

radex commented Dec 16, 2019

@afiller If you require encryption, that's great — I recommend that you take @y3g0r's code, finish it up, and submit a pull request to WatermelonDB.

@afiller
Copy link

afiller commented Dec 17, 2019

@radex Ok, I just implemented it on my own today as a proof of concept based on the idea of @y3g0r and it's changing quite many files when I provide it in a clean way. Nevertheless, it works! ...and I could provided it as pull request in a way that it could be used as an option for Android to enable users to have encrypted sqlite DBs there. Shall I provide it as a pull request for master or the newest release? I want to try to avoid as much merging effort as possible.

@radex
Copy link
Collaborator

radex commented Dec 18, 2019

@afiller please send pull requests to master

@SebDev94
Copy link

SebDev94 commented Feb 4, 2020

@radex We needed to encrypt data in a project. When do you think the solution will be merged?

@radex
Copy link
Collaborator

radex commented Feb 5, 2020

@SebDev94 Likely in the month or so when I have more time to work on 🍉 -- would you like to contribute to the project as well? That would speed up the work

@alexandrethsilva
Copy link

alexandrethsilva commented Apr 16, 2020

Hi @radex, @rozPierog I'm interested in the issue and would like to contribute to getting it through if possible, but it's currently unclear what on #597 is missing except for the conflict. If you point me in the right direction and my skillset is compatible I'd be happy to give it a try to push it through the finish line. Is the current conflict the only blocker?

@falquinho
Copy link

Any news on this or should we use the fork?

@yf-hk
Copy link

yf-hk commented Jun 22, 2021

Any updates?

@waqas19921
Copy link

Here is the work done and is also not finished yet #907

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants