Skip to content
This repository was archived by the owner on Apr 22, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion lib/identity-idp-functions/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module IdentityIdpFunctions
VERSION = '0.7.5'
VERSION = '0.7.6'
end
3 changes: 2 additions & 1 deletion source/proof_document/lib/proof_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def proof
end
end

result = proofer_result.to_h
# pii_from_doc is excluded from to_h to prevent accidental logging
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.

nice!

result = proofer_result.to_h.merge(pii_from_doc: proofer_result.pii_from_doc)

result[:exception] = proofer_result.exception.inspect if proofer_result.exception

Expand Down
2 changes: 2 additions & 0 deletions source/proof_document/spec/proof_document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
result: 'Passed',
success: true,
exception: nil,
pii_from_doc: applicant_pii,
},
)
end
Expand Down Expand Up @@ -138,6 +139,7 @@
success: true,
liveness_assessment: 'Live',
exception: nil,
pii_from_doc: applicant_pii,
},
)

Expand Down
3 changes: 2 additions & 1 deletion source/proof_document_mock/lib/proof_document_mock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def proof
end
end

result = proofer_result.to_h
# pii_from_doc is excluded from to_h to prevent accidental logging
result = proofer_result.to_h.merge(pii_from_doc: proofer_result.pii_from_doc)

result[:exception] = proofer_result.exception.inspect if proofer_result.exception

Expand Down
41 changes: 25 additions & 16 deletions source/proof_document_mock/spec/proof_document_mock_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
let(:selfie_image_url) { 'http://bucket.s3.amazonaws.com/bar3' }

before do
body = applicant_pii.to_json
body = { document: applicant_pii }.to_json
encrypt_and_stub_s3(body: body, url: front_image_url, iv: front_image_iv, key: encryption_key)
encrypt_and_stub_s3(body: body, url: back_image_url, iv: back_image_iv, key: encryption_key)
encrypt_and_stub_s3(body: body, url: selfie_image_url, iv: selfie_image_iv, key: encryption_key)
Expand All @@ -62,10 +62,14 @@
},
) do |request|
expect(JSON.parse(request.body, symbolize_names: true)).to eq(
document_result: IdentityDocAuth::Response.new(
document_result: {
billed: true,
errors: {},
exception: nil,
pii_from_doc: applicant_pii,
result: 'Passed',
success: true,
extra: { billed: true, result: 'Passed' },
).to_h,
},
)
end
end
Expand All @@ -85,10 +89,14 @@
end

expect(yielded_result).to eq(
document_result: IdentityDocAuth::Response.new(
document_result: {
billed: true,
errors: {},
exception: nil,
pii_from_doc: applicant_pii,
result: 'Passed',
success: true,
extra: { billed: true, result: 'Passed' },
).to_h,
},
)

expect(a_request(:post, callback_url)).to_not have_been_made
Expand Down Expand Up @@ -195,17 +203,18 @@
let(:selfie_image_url) { 'http://example.com/bar3' }

before do
data = { document: applicant_pii }.to_json
encryption_helper = IdentityIdpFunctions::EncryptionHelper.new

stub_request(:get, front_image_url).to_return(body: encryption_helper.encrypt(
data: applicant_pii.to_json, key: encryption_key, iv: front_image_iv,
))
stub_request(:get, back_image_url).to_return(body: encryption_helper.encrypt(
data: applicant_pii.to_json, key: encryption_key, iv: back_image_iv,
))
stub_request(:get, selfie_image_url).to_return(body: encryption_helper.encrypt(
data: applicant_pii.to_json, key: encryption_key, iv: selfie_image_iv,
))
stub_request(:get, front_image_url).to_return(
body: encryption_helper.encrypt(data: data, key: encryption_key, iv: front_image_iv),
)
stub_request(:get, back_image_url).to_return(
body: encryption_helper.encrypt(data: data, key: encryption_key, iv: back_image_iv),
)
stub_request(:get, selfie_image_url).to_return(
body: encryption_helper.encrypt(data: data, key: encryption_key, iv: selfie_image_iv),
)
end

it 'still downloads and decrypts the content' do
Expand Down