Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/services/encryption/kms_logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class KmsLogger
def self.log(action, key_id:, context: nil, log_context: nil)
output = {
kms: {
timestamp: Time.zone.now,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
def self.log(action, key_id:, context: nil, log_context: nil)
output = {
kms: {
timestamp: Time.zone.now,
def self.log(action:, timestamp:, key_id:, context: nil, log_context: nil)
output = {
kms: {
timestamp: timestamp,

I wonder if it might be preferable to pass the time as an argument? Would have some implications around the tests, but I suspect they will require freezing time.

action: action,
encryption_context: context,
log_context: log_context,
Expand Down
2 changes: 2 additions & 0 deletions spec/services/encryption/kms_logger_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
it 'logs the context' do
log = {
kms: {
timestamp: Time.zone.now,
action: 'encrypt',
encryption_context: { context: 'pii-encryption', user_uuid: '1234-abc' },
log_context: 'log_context',
Expand All @@ -29,6 +30,7 @@
it 'logs that an encryption happened without a context' do
log = {
kms: {
timestamp: Time.zone.now,
action: 'decrypt',
encryption_context: nil,
log_context: nil,
Expand Down