Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do modern browsers encrypt or otherwise protect IndexedDB storage?

Tags:

My team is considering using IndexedDB to cache data across user sessions. This data can be large enough that it would be a real performance boost to be able to keep it around in the browser for later use instead of having to download it every time the user needs it.

I am concerned about security problems with IndexedDB. The data in question isn't super sensitive, but there is a reason we require a user/pass to get to it. I worry that this data might be accessible if a user's laptop were stolen. Are these files sitting around unencrypted on the file system?

like image 661
Jason Jackson Avatar asked Dec 22 '14 18:12

Jason Jackson


People also ask

Can IndexedDB be encrypted?

It can be configured to encrypt all the data of a table, or you may select fields to encrypt or leave unencrypted. Fields can be any data type that can be added to IndexedDB, but must be top level fields.

How safe is IndexedDB?

The short answer is IndexedDB is vulnerable to malware and physical takeover attacks. It's better than many options because cryptography is done outside the browser execution environment, but it's not totally secure.

Can browser encrypt data?

Your web browser creates a session key, encrypts it with the server's public key and sends the encrypted key to the server. The server uses its private key to decrypt the session key. The client and server use the session key to encrypt all further communications.

Is IndexedDB persistent?

As of 2022, IndexedDB is persistent type of data storage. Thus, it is evicted if the user chooses to. So, If user logs off and log back in again, then user can access data as before logs off.


1 Answers

You can encrypt before storing into indexeddb. That is how I do in my open source library, http://dev.yathit.com/ydn-db/doc/usage/encryption.html

One thing to note, encrypted database cannot be query. You can only retrieve with known primary key.

You still need to pass encryption key from the server after user login.

like image 177
Kyaw Tun Avatar answered Oct 08 '22 19:10

Kyaw Tun