-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encrypting sensitive (payment) data #180
Comments
Another comment: Saving it encrypted and just letting the flask/django app also know the private key to decrypt it on-the-fly is somewhat pointless. Although this would prevent data-leakage in case only the database is compromised. If the whole app is compromised, where fucked then. |
I think your proposal is completely resonable. Do asymmetric encryption, store the encrypted data in the DB and do backups. Then if you need to handle it once a year, get the info from the DB, and do the rest offline. No need the App needs to take care of the SEPA logic, right? In the old days™️ we used to keep everything on file in an office shelf, and then you were told to hand over a floppy disk to the Volksbank.... so why not keep the private key for decryption on a piece of paper in a drawer. I would argue someone going into a university office to physically get hold of a private key is not one of the 99% of most possible attack vectors we are talking about. On contrary
is far easier to miss.
As a donor, I expect you to handle the information. My only concern is, that no third party can access it.. Loosing the information is a worst case, thats true. Still printing it out, might not be the worst idea. So, my baseline is: make it a scenario where a physical attack is the only successful one, and I think we are fine. just my 2c |
@ccauet Thanks for your opinion! And after being nerdsniped for the day and reading into cryptography, I agree with your 2c. Great resource can be found here. Database-level encryption seems to be not that easy to install and deploq for PostgreSQL (which we use in production). I think now that we want to store sensitive data on the server, we should enable disk-encryption on the server (which may be already activated, I am unsure), which protects the data on the "thief steals disk" level. For the really sensitive data columns, I would encrypt them. I'd use nacl.public.SealedBox for the actual data encryption and generate the DEK there and save the private key encrypted by nacl.secret.SecretBox with an KEK generated by a password by nacl.utils.randombytes_deterministic. This is the ultra-secure path, where even the application itself can't decrypt the data, without the user provided password (rememberd by the pep-board). The less-save-but-common-practice would be to just use a symmetric key to save sensitive data and only provide the symmetric key at the start of the application and save it in RAM while the application is running (using .env files exposes the key to the filesystem, if it is compromised). This means if the application itself or it's memory is compromised, we still have IBAN leaks, but not if the server is compromised. |
Sorry for the slow reply, here are my (mostly non-technical) thoughts on the SEPA stuff: Now comes my actual point: Do we really need to store the bank account data of our members in the DB? After the online registration, we could send an email with the data to the Finanzrefernt who then has to fill in the data into our online banking account manually. This is not a very high-tech approach, but this would avoid any security issues we might have if we proceed with the double bookkeeping in the DB. The transfer to the online banking account UI has to be done anyway. It might be possible to upload lots of IBANs to the account by uploading a csv or something, but as far as I know our members, we will not have hundreds of IBANs to be added :) So the workload for adding IBANs and scheduling the Lastschriften will be limited. |
In princicple I would second your approach @lena-lin
This would be the only transfer that may be unsecured. When I hand over sensible data to some entity via a TLS secured website, I would assume this as the minimal level of security that gets applied. So breaking out of this, and send data unencrypted over the Internetz seems inapproriate. So while trying to keep it very basic, we could:
What do you think? Simple enough? |
For the SEPA lastschriftmandat milestone we somehow need to save the payment information of some of our members.
Since this is the first time we ever really have to store highly sensitive data (compared to membership status this is orders of magnitude more important), we should really sit down for a moment and think about security.
We definitely need to access the payment information, so we are of course not able to hash the information. But we could additionally asymmetrically encrypt the payment information in the database.
The decryption key could then be stored outside the server, e.g. handed privately to the managing board of PeP (3 times in total)
Pros:
Cons:
Considering these points I think encryption is not really needed here after all. It's better to double and triple check our system to make it hard to compromise it...
Although now I am kind of eager to implement the encryption into the database!
Let me know what you think! (related PR: #179)
The text was updated successfully, but these errors were encountered: