Skip to content

Commit

Permalink
Merge pull request #2036 from 18F/mb-voice-otp
Browse files Browse the repository at this point in the history
Rescue errors parsing voice OTP encrypted code
  • Loading branch information
jmhooper authored Mar 5, 2018
2 parents 2b59beb + 01c50e6 commit e2d1361
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/controllers/voice/otp_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def code
return if encrypted_code.blank?

cipher.decrypt(encrypted_code)
rescue StandardError
nil
end

def message
Expand Down
11 changes: 11 additions & 0 deletions spec/controllers/voice/otp_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@
end
end

context 'with an invalid encrypted_code in the URL' do
let(:encrypted_code) { '%25' }

it 'renders a blank 400' do
action

expect(response).to be_bad_request
expect(response.body).to be_empty
end
end

context 'with an encrypted_code in the URL' do
render_views

Expand Down

0 comments on commit e2d1361

Please sign in to comment.