-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat: encrypt PII fields before saving it in the database #1043
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
Conversation
Co-authored-by: Nishant Joshi <[email protected]>
Co-authored-by: Nishant Joshi <[email protected]>
| .into_inner() | ||
| .expose(); | ||
|
|
||
| assert!(dummy_data_returned == dummy_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use assert_eq!() instead.
| use error_stack::{report, FutureExt, ResultExt}; | ||
| use masking::Secret; | ||
| use storage_models::{enums, merchant_account}; | ||
| use masking::Secret; //PeekInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| use masking::Secret; //PeekInterface | |
| use masking::Secret; |
| merchant_id: merchant_id.to_string(), | ||
| ..Default::default() | ||
| }) | ||
| .change_context(errors::ApiErrorResponse::AddressNotFound)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change raises an incorrect error message that the address was not found, when in reality, the deseriliazation of the address failed. Could you please fix this, and ensure that "resource not found" errors are not being raised incorrectly elsewhere?
Type of Change
Description
This PR adds support for encrypting PII fields in following tables
Here's how the basic flow goes, the main encryption key
master_keywill be encrypted with KMS and configured indevelopment.toml. For every merchant we will create seperate encryption key and encrypt that key withmaster_keyand push it to the database and we will use that key to encrypt the PII fields.This PR also has migration script that will migrate currently decrypted database to encrypted database.
Additional Changes
Motivation and Context
This is for GDPR compliance for saving PII data in an encrypted format.
How did you test it?
Manual
Checklist
cargo +nightly fmt --allcargo clippy