From c1d5d0bcfad1b0b88cdbdf417a70351455bab3e2 Mon Sep 17 00:00:00 2001 From: Matt Wagner Date: Tue, 3 Sep 2024 15:16:34 -0400 Subject: [PATCH] LG-14334 | Don't log redacted values (#11158) * LG-14334 | Don't log redacted values changelog: Internal, Logging, Don't log "[REDACTED]" fields in TMX response since they are useless --- app/services/proofing/lexis_nexis/ddp/response_redacter.rb | 7 +------ spec/features/idv/analytics_spec.rb | 3 +-- .../lexis_nexis/ddp/successful_redacted_response.json | 1 - spec/services/proofing/ddp_result_spec.rb | 2 +- .../proofing/lexis_nexis/ddp/response_redacter_spec.rb | 7 ++----- 5 files changed, 5 insertions(+), 15 deletions(-) diff --git a/app/services/proofing/lexis_nexis/ddp/response_redacter.rb b/app/services/proofing/lexis_nexis/ddp/response_redacter.rb index fb9cda806d9..75dda7dc8cd 100644 --- a/app/services/proofing/lexis_nexis/ddp/response_redacter.rb +++ b/app/services/proofing/lexis_nexis/ddp/response_redacter.rb @@ -197,12 +197,7 @@ class ResponseRedacter def self.redact(hash) return { error: 'TMx response body was empty' } if hash.nil? return { error: 'TMx response body was malformed' } unless hash.is_a? Hash - filtered_response_h = hash.slice(*ALLOWED_RESPONSE_FIELDS) - unfiltered_keys = hash.keys - filtered_response_h.keys - unfiltered_keys.each do |key| - filtered_response_h[key] = '[redacted]' - end - filtered_response_h + hash.slice(*ALLOWED_RESPONSE_FIELDS) end end end diff --git a/spec/features/idv/analytics_spec.rb b/spec/features/idv/analytics_spec.rb index ac095c00bd5..2f82fd48333 100644 --- a/spec/features/idv/analytics_spec.rb +++ b/spec/features/idv/analytics_spec.rb @@ -14,8 +14,7 @@ { client: nil, errors: {}, exception: nil, - response_body: { first_name: '[redacted]', - "fraudpoint.score": '500', + response_body: { "fraudpoint.score": '500', request_id: '1234', request_result: 'success', review_status: 'pass', diff --git a/spec/fixtures/proofing/lexis_nexis/ddp/successful_redacted_response.json b/spec/fixtures/proofing/lexis_nexis/ddp/successful_redacted_response.json index add352a3a54..a58c4d1569b 100644 --- a/spec/fixtures/proofing/lexis_nexis/ddp/successful_redacted_response.json +++ b/spec/fixtures/proofing/lexis_nexis/ddp/successful_redacted_response.json @@ -6,6 +6,5 @@ "summary_risk_score": "-6", "tmx_risk_rating": "neutral", "fraudpoint.score": "500", - "first_name": "[redacted]", "tmx_summary_reason_code": ["Identity_Negative_History"] } diff --git a/spec/services/proofing/ddp_result_spec.rb b/spec/services/proofing/ddp_result_spec.rb index d5f10950330..f8fdf6a230a 100644 --- a/spec/services/proofing/ddp_result_spec.rb +++ b/spec/services/proofing/ddp_result_spec.rb @@ -124,7 +124,7 @@ response_body = { first_name: 'Jonny Proofs' } result = Proofing::DdpResult.new(response_body:) - expect(result.to_h[:response_body]).to eq({ first_name: '[redacted]' }) + expect(result.to_h[:response_body]).to eq({}) end end diff --git a/spec/services/proofing/lexis_nexis/ddp/response_redacter_spec.rb b/spec/services/proofing/lexis_nexis/ddp/response_redacter_spec.rb index 2b2c8c13db4..a641ff46018 100644 --- a/spec/services/proofing/lexis_nexis/ddp/response_redacter_spec.rb +++ b/spec/services/proofing/lexis_nexis/ddp/response_redacter_spec.rb @@ -18,11 +18,8 @@ } end context 'hash with mixed known and unknown keys' do - it 'redacts values of unknown keys and allows known keys' do + it 'removes unknown keys and allows known keys' do expect(json).to eq( - 'unknown_key' => '[redacted]', - 'first_name' => '[redacted]', - 'ssn_hash' => '[redacted]', 'review_status' => 'safe value', 'summary_risk_score' => 'safe value', 'fraudpoint.score' => 'safe value', @@ -48,7 +45,7 @@ end end - context 'empty hash agrument' do + context 'empty hash argument' do let(:sample_hash) do {} end