Replies: 4 comments 4 replies
-
Hi @ChuckMoe 👋 Thank you for the suggestion! Actually, we already encrypt some fields in the database, in particular:
All of them use the Fernet encryption method: fief/backend/fief/crypto/encryption.py Lines 19 to 26 in 4505030 As for encrypting e-mails, well, I'm not really sure of the added benefits it would have in terms of security/privacy. The e-mail address is shown in lot of places, in the Admin Dashboard and the API. Besides, it would make login much more difficult (if not impossible) since we would not be able to query the email in the database. With the Fernet method for example, if you encrypt the same value twice, you don't get the same output. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the clarifications! I think indeed encrypting e-mails is not really worth the hassle. Encrypting user fields values, however might be interesting indeed. We could imagine two different approaches:
What do you think? |
Beta Was this translation helpful? Give feedback.
-
By the way, thank you for making me aware of SQLAlchemy Utils |
Beta Was this translation helpful? Give feedback.
-
If I get this right, you create one table for all different kinds of field values, right? fief/backend/fief/models/user_field_value.py Lines 20 to 41 in 2ca7772 Would it not be better to create a base class field_values, then create different classes that inherit from it so that all of the types like string, int, etc. have their own table? This would keep the tables much cleaner and you can add new types relatively easily. One could try it like this |
Beta Was this translation helpful? Give feedback.
-
Hello together :)
the European General Data Protection Regulation (GDPR) describe multiple ways on how to enforce privacy. One is the encryption of person relatable data in the database, in case that someone gets access to it.
As @frankie567 pointed out below, encrypting the email address, that is used for login, would add complexity to the whole system. I tried to find an answer if it is still necessary but most of the post I found either cover the protection of the password or email exchange.
Nevertheless, I would welcome the option to encrypt User Fields values in the database.
== Old ==
As fas as I can see the email address is not encrypted by default.
It would be possible to encrypt the data with sqlalchemy. I did not read through all of the fief code but as far as I can see, it only uses sqlalchemy code for working with the database (no custom sql). As far as I can tell, this should not change any other logic of fief, right?
Another option could be sqlalchemy_utils, which implements some colum types, including the EncryptType. With this you only need to set it as column type and specify parameters like the secret and it automatically encrypts/decrypts your data.
An example taken straight from the sqlalchemy_utils docs:
Beta Was this translation helpful? Give feedback.
All reactions