Skip to content
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
10 changes: 9 additions & 1 deletion app/controllers/idv/in_person/verify_info_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class VerifyInfoController < ApplicationController
include VerifyInfoConcern

before_action :confirm_not_rate_limited_after_doc_auth, except: [:show]
before_action :confirm_pii_data_present
before_action :confirm_ssn_step_complete

def show
Expand Down Expand Up @@ -73,7 +74,8 @@ def prev_url
end

def pii
user_session.dig('idv/in_person', :pii_from_user).merge(ssn: idv_session.ssn)
pii_from_user = user_session.dig('idv/in_person', :pii_from_user) || {}
Copy link
Copy Markdown
Contributor

@mitchellhenke mitchellhenke Aug 9, 2024

Choose a reason for hiding this comment

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

How does IPP end up in a state where pii is nil at this point? It should already exist?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was wondering the same! We observed errors in NewRelic that traced back to pii being nil here. I couldn't reproduce it manually. Not sure if this indicates something bigger worth investigating? Perhaps handling the error here isn't sufficient? Open to discussion!

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.

For posterity, discussion was continued internally here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Revisited this, and after investigating the logs I found that a user could cancel their in person proofing flow at the verify info page, exit login.gov, then hit the back button to re-enter login.gov, and hit "keep going" to return to the verify info page, where they would no longer have PII in their session since it was cleared on exit.

So, I've added a before_action to redirect if there is no IPP session data present. This follows the behavior on the remote flow side, where the verify info controller also checks that that the step is valid and otherwise redirects.

pii_from_user.merge(ssn: idv_session.ssn)
end

# override IdvSessionConcern
Expand All @@ -94,6 +96,12 @@ def confirm_ssn_step_complete
return if pii.present? && idv_session.ssn.present?
redirect_to prev_url
end

def confirm_pii_data_present
unless user_session.dig('idv/in_person').present?
redirect_to idv_path
end
end
end
end
end
30 changes: 30 additions & 0 deletions spec/controllers/idv/in_person/verify_info_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@
:confirm_ssn_step_complete,
)
end

it 'confirms idv/in_person data is present' do
expect(subject).to have_actions(
:before,
:confirm_pii_data_present,
)
end
end

before do
Expand Down Expand Up @@ -171,6 +178,29 @@
expect(@analytics).to have_logged_event('IdV: proofing resolution result missing')
end
end

context 'when idv/in_person data is present' do
before do
subject.user_session['idv/in_person'] = flow_session
end

it 'renders the show template without errors' do
get :show

expect(response).to render_template :show
end
end

context 'when idv/in_person data is missing' do
before do
subject.user_session['idv/in_person'] = {}
end

it 'redirects to idv_path' do
get :show
expect(response).to redirect_to(idv_path)
end
end
end

describe '#update' do
Expand Down