Skip to content

LG-525 Fix IDV for users without phones#2398

Merged
stevegsa merged 1 commit intomasterfrom
fix-idv-without-phone
Aug 2, 2018
Merged

LG-525 Fix IDV for users without phones#2398
stevegsa merged 1 commit intomasterfrom
fix-idv-without-phone

Conversation

@stevegsa
Copy link
Contributor

@stevegsa stevegsa commented Aug 2, 2018

Why: Users are unable to complete IDV if they setup their account with an authenticator app.

How: Allow sms verification if it is in the middle of IDV verification by checking a session variable. Fix the spec / test.

Hi! Before submitting your PR for review, and/or before merging it, please
go through the checklists below. These represent the more critical elements
of our code quality guidelines. The rest of the list can be found in
CONTRIBUTING.md

Controllers

  • When adding a new controller that requires the user to be fully
    authenticated, make sure to add before_action :confirm_two_factor_authenticated
    as the first callback.

Database

  • Unsafe migrations are implemented over several PRs and over several
    deploys to avoid production errors. The strong_migrations gem
    will warn you about unsafe migrations and has great step-by-step instructions
    for various scenarios.

  • Indexes were added if necessary. This article provides a good overview
    of indexes in Rails.

  • Verified that the changes don't affect other apps (such as the dashboard)

  • When relevant, a rake task is created to populate the necessary DB columns
    in the various environments right before deploying, taking into account the users
    who might not have interacted with this column yet (such as users who have not
    set a password yet)

  • Migrations against existing tables have been tested against a copy of the
    production database. See LG-228 Make migrations safer and more resilient #2127 for an example when a migration caused deployment
    issues. In that case, all the migration did was add a new column and an index to
    the Users table, which might seem innocuous.

Encryption

  • The changes are compatible with data that was encrypted with the old code.

Routes

  • GET requests are not vulnerable to CSRF attacks (i.e. they don't change
    state or result in destructive behavior).

Session

  • When adding user data to the session, use the user_session helper
    instead of the session helper so the data does not persist beyond the user's
    session.

Testing

  • Tests added for this feature/bug
  • Prefer feature/integration specs over controller specs
  • When adding code that reads data, write tests for nil values, empty strings,
    and invalid inputs.

Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't you be able to check user_session[:context] here? I think that should be set to idv.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think that is set here: https://github.com/18F/identity-idp/blob/master/app/controllers/concerns/phone_confirmation.rb#L4

That will likely be more reliable than user_session[:jurisdiction].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's up to you. I wanted something as close as possible to the step before the phone verification.

Copy link
Contributor

@jmhooper jmhooper Aug 2, 2018

Choose a reason for hiding this comment

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

I think user_session[:jurisdiction] is what we want.

The jurisdiction step is a little bit removed from otp verification and totally subject to change. I wouldn't think we want otp verification coupled to the code that we use to filter unsupported jurisdictions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The is no user_session[:jurisdiction]. It's user_session[:idv_jurisdiction]. I can change it to :idv if you prefer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I mistyped there. I meant to say, "I think user_session[:context] is what we want".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. I'll just add an idv_context? Sound good?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reality is confirmation_context should have been set in that idv code but idv context overwrote it which is why this was broken and never worked.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The whole singular context thing is a little flawed because this screen actually exists in multiple contexts.

**Why**: Users are unable to complete IDV if they setup their account with an authenticator app.

**How**: Allow sms verification if it is in the middle of IDV verification by checking a session variable.  Fix the spec / test.
@stevegsa stevegsa force-pushed the fix-idv-without-phone branch from ae71e05 to e5e29bb Compare August 2, 2018 03:34
@stevegsa stevegsa merged commit 2a479a2 into master Aug 2, 2018
@amathews-fs amathews-fs deleted the fix-idv-without-phone branch January 7, 2021 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants