How to search through encrypted data

So my user has the ability to enter entries, these are then encrypted so in the database all I can see is a bunch of random numbers and letters. These entries can then be encrypted for each user to view, the issue is that I want to add a search function for the user, but I have no clue how I’m able to search through data that is encrypted in the database.
Someone please help!

If you encrypted it on the way in. You can’t. The only thing you could do is grab ALL THE (encrypted) THINGS, decrypt all of them (I guess in the user’s browser? possibly on the backend via an SSA? you don’t say if you have the encryption key, but if you do that sort of defeats the point, does it not?..) but at any rate you’ll have to grab ALL the items in question, decrypt them, and then search through that.

What are you encrypting, anyway? Your database is already encrypted at rest (and “you” don’t actually know how to decrypt it), so there’s little you can do to enhance security over the normal Bubble features like privacy rules.

(Anything you do there is simply duplicative: “I took the data and encrypted it and, unbeknownst to me, it was encrypted again! And then, when I asked for it, it was unencrypted, but still encrypted with the encryption that I had put on it and now I can’t search it!” ← this is what your post reads like)

Of course, you could do something boneheaded and expose something that’s supposed to be private to users other than the users who are supposed to have access (by, for example, not having correct privacy rules in place), but that’s on you.

You might want to go read this, which (if you read it) will probably illuminate you a bit: Josh: Request for a Security Q&A Guide - #18 by josh (when you get to the section titled " Is there a way to add additional levels of protection to specific data in Bubble?", read it carefully and perhaps read it again).

From what you say it seems the answer is no, but I’ll still respond about you shitting on me for wanting to encrypt the data -

My app is a dream journal, something extremely private. I do not want to be able to see my user’s dreams in the database, and I also want the users to know that I cannot see their dreams if I go into the database.

If I did something to you I apologise, I don’t recall but hopefully we can work it out, you seem pretty hostile just because I asked a question lmao.

When you’re in the context of the Bubble editor “you” are not “you” – “you” are THE SYSTEM. You can see what the system can see. You can run the app in the context of any user. If you hide things from the system, then “you” cannot see them. But then the system cannot, either. And so, the system (the app) cannot search them (in the normal sense).

As Josh explains (but this is pretty-much obvious),

:point_up:you are here

So I should let my users know that if I really want to I can see all their data, got it.

Create views in the data tab that don’t show you the sensitive data.

Then you don’t inadvertently see it.

But as Keith says, unless you really want to hide it away where even you can’t see it (and you don’t, as you have shown in the need for a search) if you really want to look you can. But just don’t.

I understand, but why should my users trust that I “just wont” look at all their data? Surely this isn’t a common thing among large apps, I’ve never used an app that handles secure data which tells me I just have to trust they won’t look at the data.

Define “secure data”.

Do you mean passwords? In which case they are one way encypted, so nobody can see them.

Or do you mean encrypted? In which case who has the key? The system or the user?

You do realise that most “large” apps will have the abilty for the back end database adminstrators to see the data. Even if they might need to ask for a one-time password to do this, and for it all to be logged etc etc

Yes, it would be possible for the user to have the encryption key “locally” and therefore it would only be them that has access. But they would need to upload it, and if they lost it the data would be lost FOREVER.

I think you are massively overthinking your architecture before you even have (many) users.

At the moment all certified Bubble employees can see the data and those who have access to your editor. Yes, it’s not very private. You can encrypt the data of a specific field with the unique key of a user which should be placed in an independent cloud encrypted by only one person in your organization to avoid leakage of sensitive information. If you need to do a keyword search, you will have to create an unencrypted field with the associated keywords per paragraph or decrypt the field and then do the search. This is far from obvious if we are talking about a million pages, but easier for a few pages.

1 Like

Not passwords, the dream entries my users upload. There are many dream journal apps who say all their data is encrypted and the app devs can’t read it, are these people lying or something else?

I don’t know what many users is, but I have thirteen thousand and I’m not overthinking, I don’t think you can ever overthink security.

Thankyou!

1 Like