Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> ALL data? How are you supposed to query against it then? What does "at rest" even mean in the context of an always-on database? An encrypted partition or something?

Data at rest means data on the disk. (so basically LUKS or similar partition / FDE) In virtualised environments it may not obvious, but the disk you're running on can still be accessed in various ways. Here are some examples (not a complete list):

- VM breakout allows someone to read others' volumes

- logic issue allows others to snapshot your volumes

- disk is marked as bad, then discarded without full erase / physical destruction, then found in the dump

> So two layers of encryption!? Again, how is one supposed to look up an access token or email address if it is encrypted?

You don't have to encrypt the things you index. It's more to do with PII, addresses, etc. which you don't want to accidentally expose, and don't have to access too often outside of systems like billing.

It may also prevent you from storing a copy by accident. For example if you serialise a whole record to the output due to type/variable mistake. Or by revealing it in an error message. Of course these shouldn't happen anyway, but it's a good protection in practice.

> And it strikes me that if you don't trust the first level of encryption, the solution is to fix that, not add another one.

Nobody writes ideal code. There will be bugs. You prepare for that using defence in depth. This may mean separate minimal services handing out the sensitive data with extra audit steps. It may mean encrypting the data with a password not stored in the database, so that a trivial dump doesn't give access to them. "fix that" is not simple, otherwise we'd just "fix" all software :)

> That is an extraordinarily inefficient and costly way to develop.

It's the most trivial way to avoid all SQL injections. It's used in lots of projects. As long as you don't need to use parameters where they're not allowed in your database (for example table names), it's not a bad idea at all.

But if you have an ORM and want to use it - great. Most likely your ORM, or framework you use already takes advantage of prepared statements. If it doesn't you end up like Drupal recently (please correct me if I got the framework wrong) which did their own escaping because of prefixed table names and was broken at the framework level.

> be cautious about what you allow into queries.

This is what's extraordinarily inefficient. People make mistakes. Given big enough project, if you allow text queries, or try to be clever with own escaping systems, someone will make a mistake one day. Prepared queries (and good, tested ORMs) get rid of the whole class of issues here and are much more common solution than you suggest.



You should see our ORM. It tries to highly discourage text queries:

https://qbix.com/platform/guide/database




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: