Skip to content

LG-12275 | Fixes opt-in IPP page displaying incorrectly#10016

Merged
n1zyy merged 14 commits intomainfrom
mattw/LG-12275_fix
Feb 5, 2024
Merged

LG-12275 | Fixes opt-in IPP page displaying incorrectly#10016
n1zyy merged 14 commits intomainfrom
mattw/LG-12275_fix

Conversation

@n1zyy
Copy link
Contributor

@n1zyy n1zyy commented Jan 31, 2024

🎫 Ticket

Link to the relevant ticket:
LG-12275

🛠 Summary of changes

We identified a bug in how we were checking for opt-in. We checked the relevant feature flags, but were not properly checking whether the ServiceProvider had enabled IPP, causing the screen to be displayed inappropriately. Users were not able to proceed if the SP did not have IPP enabled, which prevented any serious adverse impact to partners, but also lead the user into a dead-end.

📜 Testing Plan

Directly, this is tested by unit tests that should assert and prove correct behavior.

NOTE: With this change, it will no longer be possible to just go to /verify and test the opt-in process, because there is no ServiceProvider set. You'll have to come in through Sinatra.

For manual testing, unless we have multiple sinatra-oidc instances I don't know about, it might be easiest to just have an engineer hop into the Rails console and toggle the setting. You will likely want something like:

sp = ServiceProvider.find_by_friendly_name 'Example Sinatra App'
sp.update(in_person_proofing_enabled: true)

@daviddsilvanava
Copy link

For manual testing, unless we have multiple sinatra-oidc instances I don't know about, it might be easiest to just have an engineer hop into the Rails console and toggle the setting.

Each env has an OIDC and SAML test app. I assume these could be opted into IPP separately. https://dashboard.dev.identitysandbox.gov/env

elsif sp == :oidc
@state = SecureRandom.hex
@client_id = sp_oidc_issuer
@client_id = client_id_override || sp_oidc_issuer
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I am going to split this out into another PR later.

I think this was a good idea, but IdvHelper ends up just passing strings around, not instantiating a real ServiceProvider, so the hardcoded redirect and nonce don't work. I'd like to make it operate on an actual ServiceProvider object, to more easily allow passing in an override.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Filed as LG-12303

@n1zyy n1zyy changed the title [WIP] LG-12275 | Crude fix for error in SP checking LG-12275 | Fixes opt-in IPP page displaying incorrectly Feb 1, 2024
@n1zyy n1zyy marked this pull request as ready for review February 2, 2024 15:35
@gina-yamada
Copy link
Contributor

@n1zyy I pushed up more tests and inlined preconditions. I think we have every case covered in idv/doc_auth/how_to_verify_spec -- including the most important case: ipp enabled, opt-in ipp enabled, where sp did not opt in.

@gina-yamada gina-yamada requested review from a team and svalexander February 2, 2024 17:43

complete_how_to_verify_step(remote: true)
expect(page).to have_current_path(idv_hybrid_handoff_url)
complete_how_to_verify_step(remote: true)
Copy link
Contributor

Choose a reason for hiding this comment

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

we should add another step where remote is false. Perhaps instead of an additional test we can go back after line 141 and then redo w/ remote = false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, and thanks for suggesting a much easier option than I would have thought of. 👼

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for adding this additional test!

end

describe 'navigating to How To Verify from Agreement page in 50/50 state' do
describe 'navigating to How To Verify from Agreement page in 50/50 state
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to mock opt in enabled for the service_provider for this spec?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't realize this when we were discussing this on a call, but we have this covered further below. We test it both ways: 171-172 tests the opt-in provider case, and then further down on 180 we test with the opt-in feature flag disabled.

include InPersonHelper
org = 'test_org'

let(:ipp_service_provider) { create(:service_provider, :active, :in_person_proofing_enabled) }
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps we should add a case where the In_person_proofing_enabled is false

Copy link
Contributor Author

@n1zyy n1zyy left a comment

Choose a reason for hiding this comment

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

Thanks Shannon for your review! I appreciate the thoughtful feedback on how to expand the tests. Just pushed up some expanded coverage.

end

describe 'navigating to How To Verify from Agreement page in 50/50 state' do
describe 'navigating to How To Verify from Agreement page in 50/50 state
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't realize this when we were discussing this on a call, but we have this covered further below. We test it both ways: 171-172 tests the opt-in provider case, and then further down on 180 we test with the opt-in feature flag disabled.


complete_how_to_verify_step(remote: true)
expect(page).to have_current_path(idv_hybrid_handoff_url)
complete_how_to_verify_step(remote: true)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, and thanks for suggesting a much easier option than I would have thought of. 👼

@gina-yamada
Copy link
Contributor

I re-triggered the failing spec from your last push. Pipeline just passed. Code changes look good. I will smash approve if we don't get a third party to review soon

@svalexander
Copy link
Contributor

LGTM! Thanks for adding the additional specs! Also the doc Gina created to go through how to test was super helpful!

@n1zyy n1zyy merged commit 4957a12 into main Feb 5, 2024
@n1zyy n1zyy deleted the mattw/LG-12275_fix branch February 5, 2024 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants