From 513c57296ec3737294298cb197337374c3fc59e1 Mon Sep 17 00:00:00 2001 From: Mercedes Bernard Date: Mon, 26 Jun 2023 17:50:39 -0500 Subject: [PATCH 1/3] encrypt sensitive columns on event model --- app/models/event.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/event.rb b/app/models/event.rb index 9a6109f92..fc4d7cf7f 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -5,6 +5,9 @@ class Event < ApplicationRecord # Relations belongs_to :line + encrypts :cm_name + encrypts :patient_name + # Enums enum event_type: { reached_patient: 0, From a42c67e618546335a474edde2a5fdf76f1e08537 Mon Sep 17 00:00:00 2001 From: Mercedes Bernard Date: Mon, 26 Jun 2023 17:50:59 -0500 Subject: [PATCH 2/3] add rake task to encrypt existing events data --- lib/tasks/encrypt_event_columns.rake | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 lib/tasks/encrypt_event_columns.rake diff --git a/lib/tasks/encrypt_event_columns.rake b/lib/tasks/encrypt_event_columns.rake new file mode 100644 index 000000000..dbb65a87d --- /dev/null +++ b/lib/tasks/encrypt_event_columns.rake @@ -0,0 +1,8 @@ +namespace :event do + desc "update events to be encrypted with ActiveRecord encryption" + task encrypt_sensitive_columns: :environment do + Event.all.find_each do |event| + event.encrypt + end + end +end From e635af9ec2f6c6ea30d7517ad8ff5ff3aa2d02b1 Mon Sep 17 00:00:00 2001 From: Mercedes Bernard Date: Mon, 26 Jun 2023 17:51:22 -0500 Subject: [PATCH 3/3] remove note encryption task that's already been run --- lib/tasks/encrypt_notes.rake | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 lib/tasks/encrypt_notes.rake diff --git a/lib/tasks/encrypt_notes.rake b/lib/tasks/encrypt_notes.rake deleted file mode 100644 index c2ef0983c..000000000 --- a/lib/tasks/encrypt_notes.rake +++ /dev/null @@ -1,8 +0,0 @@ -namespace :note do - desc "update notes to be encrypted with ActiveRecord encryption" - task encrypt_full_text: :environment do - Note.all.find_each do |note| - note.encrypt - end - end -end