Re: [FEATURE REQUEST] Encrypted indexes over encrypted data

From: Nico Williams <nico(at)cryptonector(dot)com>
To: Bear Giles <bgiles(at)coyotesong(dot)com>
Cc: Danylo Hlynskyi <abcz2(dot)uprola(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [FEATURE REQUEST] Encrypted indexes over encrypted data
Date: 2018-08-09 21:35:01
Message-ID: 20180809213458.GD5695@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 09, 2018 at 02:34:07PM -0600, Bear Giles wrote:
> Some regulatory standards require all UII, even all PII, information be
> encrypted within the database, not just on encrypted media. That's to
> reduce exposure even if someone gets access to a live server, e.g., via SQL
> Injection. (The perennial #1 risk for software vulnerabilities.)

My preference for dealing with SQL Injection is to not provide direct
SQL access, but to use PostgREST exporting a schema that has only PG SQL
functions encapsulating all supported queries. You just can't have
injection with such an access layer because you don't get to send SQL to
the server (because you don't get to send SQL to PostgREST). It really
helps that PostgREST is written in Haskell.

That said, sure, if you have SQL Injection issues, then encrypting in
the database will do provided that there's no transparent way to access
the data (otherwise you've gained nothing). That basically means you're
doing all the crypto on the client.

If you're doing all the crypto on the client, then your options for
indexing are very limited indeed. To avoid offline dictionary attacks
you have to index MAC'ed values, effectively. You can still do free
text indexing, provided you MAC each word. MAC == message
authentication code, really, it's a keyed hash function, typically HMAC,
UMAC, or some such. You could also index ciphertext, provided it has an
authentication tag, but you don't gain anything versus just indexing the
authentication tag.

> I know the government required UII encryption in its databases when I last
> [...]

Usually regulations are not quite as prescriptive as that, though
there's always a discussion to be had with the regulators/auditors when
you deviate from the norm. You're generally not precluded from having
better solutions than is the norm.

Nico
--

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2018-08-09 21:35:56 Re: Typo in doc or wrong EXCLUDE implementation
Previous Message Jeremy Finzel 2018-08-09 21:34:55 Repeatable Read Isolation in SQL running via background worker