Skip to content

Only proactively rotate PII fingerprints when PII is decrypted#7800

Merged
mitchellhenke merged 1 commit intomainfrom
mitchellhenke/rotation-encryption
Feb 13, 2023
Merged

Only proactively rotate PII fingerprints when PII is decrypted#7800
mitchellhenke merged 1 commit intomainfrom
mitchellhenke/rotation-encryption

Conversation

@mitchellhenke
Copy link
Contributor

🛠 Summary of changes

We currently check some fingerprints and encrypted attributes in the Pii::Cacher class to see if they need to be rotated. We should be able to rely on

task attribute_encryption_key: :environment do
num_users = User.count
progress = new_progress_bar('Users', num_users)
User.find_in_batches.with_index do |users, _batch|
User.transaction do
users.each do |user|
user.phone_configurations.each do |phone_configuration|
rotator = KeyRotator::AttributeEncryption.new(phone_configuration)
rotator.rotate
end
user.email_addresses.each do |email_address|
rotator = KeyRotator::AttributeEncryption.new(email_address)
rotator.rotate
end
progress&.increment
rescue StandardError => err # Don't use user.email in output...
Kernel.puts "Error with user id:#{user.id} #{err.message} #{err.backtrace}"
end
end
end
end
for rotating encrypted attributes in a complete manner.

changelog: Internal, Key Rotation, Only proactively rotate PII fingerprints when PII is decrypted
@mitchellhenke mitchellhenke marked this pull request as ready for review February 13, 2023 21:26

include EncryptableAttribute

encrypted_attribute_without_setter(name: :code)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an unused field after #5584

@mitchellhenke mitchellhenke merged commit d146f5f into main Feb 13, 2023
@mitchellhenke mitchellhenke deleted the mitchellhenke/rotation-encryption branch February 13, 2023 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants