-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
In some secure contexts, at-rest encryption is required at the database layer. My specific context being Protected Health Information covered under HIPAA. Some PCI data (Cardholder name, etc) is also required to be encrypted at rest.
I made a crude module a while back in order to meet this need - https://github.com/laslabs/odoo-base/blob/9.0/fields_encrypted/fields.py
It has worked great in some long term tests so we are about to begin the build out of the real module. Assuming this is something that OCA wants, I will bring it here instead.
I'm probably forgetting some details, but from a high level this is what I am thinking. Please let me know if you have any suggestions or if there is some overlap with pre-existing resources.
Currently the module:
- Provides
EncryptedTextfield w/ encrypt and decrypt in what seem to be the appropriate convert methods - Has a hard coded key - obviously bad
- Will basically thrash your data if you ever change the hard coded key - definitely worse
The plan:
- Move the key into a secure storage
- I'm thinking this will just be a file that gets loaded into memory on Odoo boot
- Switch to PgCrypto instead of encrypting in Python
- It would be nice if I could add an
encryptarg in all fields, instead of a specific field for encryption. This would allow for usage on existing columns.- Assuming this is possible, some sort of migration up and down would be required in order to circumvent data destruction
- Possibility of specifying encryption key to use on column. By name? Or maybe the signature..
Pitfalls:
- Searching an encrypted col is a challenge. Doesn't hurt for anything I can think of this being used for, but worth mentioning.