Skip to content

Commit

Permalink
LG-14334 | Don't log redacted values (#11158)
Browse files Browse the repository at this point in the history
* LG-14334 | Don't log redacted values

changelog: Internal, Logging, Don't log "[REDACTED]" fields in TMX response since they are useless
  • Loading branch information
n1zyy authored Sep 3, 2024
1 parent b131447 commit c1d5d0b
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 15 deletions.
7 changes: 1 addition & 6 deletions app/services/proofing/lexis_nexis/ddp/response_redacter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions spec/features/idv/analytics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
2 changes: 1 addition & 1 deletion spec/services/proofing/ddp_result_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -48,7 +45,7 @@
end
end

context 'empty hash agrument' do
context 'empty hash argument' do
let(:sample_hash) do
{}
end
Expand Down

0 comments on commit c1d5d0b

Please sign in to comment.