Skip to content

LG-11873: doc auth w/ selfie in non-prod hosted envs#9729

Merged
amirbey merged 44 commits intomainfrom
amirbey/selfie-in-staging
Dec 21, 2023
Merged

LG-11873: doc auth w/ selfie in non-prod hosted envs#9729
amirbey merged 44 commits intomainfrom
amirbey/selfie-in-staging

Conversation

@amirbey
Copy link
Contributor

@amirbey amirbey commented Dec 7, 2023

🎫 Ticket

LG-11873

🛠 Summary of changes

  • determine if doc auth with selfie is required based on the SP Session
  • only allow selfie to be sent to doc auth vendor if selfie FF is enabled
  • do not allow selfie to be sent to doc auth vendor if host env is production
  • indicate to the FE to display selfie field if hosted env is not production, selfie FF is enabled and requested by SP

📜 Testing Plan

Provide a checklist of steps to confirm the changes.

  • Enable selfie feature flag

    • Using the OIDC Sample App, attempt to login with Level of Service Biometric Comparison
    • Verify selfie field is displayed on standard document capture form and complete document capture
    • Redo document capture and verify selfie field is displayed on standard document capture form and complete document capture
    • Complete IdV
  • Disable selfie feature flag

    • Using the OIDC Sample App, attempt to login with Level of Service Biometric Comparison
    • Verify selfie field is NOT displayed on standard document capture form and complete document capture
    • Redo document capture and verify selfie field is NOT displayed on standard document capture form and complete document capture
    • Complete IdV
  • Enable selfie feature flag

    • Using the OIDC Sample App, attempt to login with Level of Service Identity-verified
    • Verify selfie field is NOT displayed on standard document capture form and complete document capture
    • Redo document capture and verify selfie field is NOT displayed on standard document capture form and complete document capture
    • Complete IdV

@amirbey amirbey changed the title selfie in staging or lower envs only SPIKE: selfie in staging or lower envs only Dec 7, 2023
@amirbey amirbey force-pushed the amirbey/selfie-in-staging branch from a1a3d0c to 42070a7 Compare December 12, 2023 20:29
@amirbey amirbey changed the title SPIKE: selfie in staging or lower envs only LG-11873: selfie in staging or lower envs only [DO NOT MERGE] Dec 13, 2023
@amirbey amirbey self-assigned this Dec 15, 2023
@amirbey amirbey force-pushed the amirbey/selfie-in-staging branch 2 times, most recently from 679a4f6 to 90f4ae9 Compare December 20, 2023 17:14
@amirbey amirbey changed the title LG-11873: selfie in staging or lower envs only [DO NOT MERGE] LG-11873: doc auth w/ selfie in non-prod hosting envs Dec 20, 2023
@amirbey amirbey requested review from aduth, charleyf, dawei-nava, eileen-nava, jmhooper and night-jellyfish and removed request for aduth December 20, 2023 20:18
@amirbey amirbey marked this pull request as ready for review December 20, 2023 20:23
@amirbey amirbey changed the title LG-11873: doc auth w/ selfie in non-prod hosting envs LG-11873: doc auth w/ selfie in non-prod hosted envs Dec 20, 2023
Copy link
Contributor

Choose a reason for hiding this comment

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

This does not consider config following?

return false if Identity::Hostdata.env == 'prod'
return false unless IdentityConfig.store.doc_auth_selfie_capture_enabled

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, i see, it's in the form. But should we make decision in one place?

Copy link
Contributor Author

@amirbey amirbey Dec 20, 2023

Choose a reason for hiding this comment

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

fair point @dawei-nava 🤔 ...

consolidated ✅ 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

If we put all the checks in decorated_sp_session.selfie_required?, then we don't have to duplicate this method here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the controller already checks the hostdata env stuff in the concern? Or we wanna double check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it does ... but added check on the way out to FE be extra careful

@amirbey amirbey requested a review from dawei-nava December 20, 2023 21:33
Comment on lines 58 to 61
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like the double-checking of both hostdata and config implies a distrust in our configuration, where we should be confident in using it? Assuming the default is false in production.

Suggested change
return false if Identity::Hostdata.env == 'prod'
return false unless IdentityConfig.store.doc_auth_selfie_capture_enabled
decorated_sp_session.selfie_required?
IdentityConfig.store.doc_auth_selfie_capture_enabled && decorated_sp_session.selfie_required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aduth - I understand that the FF is there and reliable. However, given the sensitivity of selfie not yet ready for our higher envs, we want it to be impossible for this to go live in production as this is an explicit requirement. No matter what config changes are made, this hardcoding guards any mistakes from a config standpoint.

Copy link
Contributor

Choose a reason for hiding this comment

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

decorated_sp_session.selfie_required? will also return false if IdentityConfig.store.doc_auth_selfie_capture_enabled is not set to true. I understand about wanting to make triple-sure this doesn't go live accidentally, and at the same time code encapsulation is also useful. Maybe we could put any extra checks in selfie_required and just use that everywhere instead of having an extra method liveness_checking_enabled?. Happy to rename the method if that would help.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Amir. Since this is such a sensitive feature, I think it's good to have an extra safeguard in place.

Copy link
Contributor

@soniaconnolly soniaconnolly left a comment

Choose a reason for hiding this comment

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

Great spec coverage! Overall looks good, some comments on repeated code. Commenting now, will approve later after running through the test plan.

Comment on lines 58 to 61
Copy link
Contributor

Choose a reason for hiding this comment

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

decorated_sp_session.selfie_required? will also return false if IdentityConfig.store.doc_auth_selfie_capture_enabled is not set to true. I understand about wanting to make triple-sure this doesn't go live accidentally, and at the same time code encapsulation is also useful. Maybe we could put any extra checks in selfie_required and just use that everywhere instead of having an extra method liveness_checking_enabled?. Happy to rename the method if that would help.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we put all the checks in decorated_sp_session.selfie_required?, then we don't have to duplicate this method here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does this method add value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@soniaconnolly - 👍🏿 ... it allows us to access liveness_checking_required for selfie validator

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it also works if you use the attr_reader method of :liveness_checking_required in the validator.

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 tried again to remove it and it worked 👍🏿

Copy link
Contributor

Choose a reason for hiding this comment

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

Same question as above: does this method add value? And if they both add value, let's call them the same thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@soniaconnolly - i see what you mean ... upon your suggestion, i attempted changing it but soon realized that it will be too similar naming (liveness_checking_required vs liveness_checking_required?) to the existing attribute name and open the opportunity to a bad typo mistake where we evaluate whether or not to put a selfie in the payload

Comment on lines 82 to 94
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 repeat this method definition in the spec?

Copy link
Contributor Author

@amirbey amirbey Dec 21, 2023

Choose a reason for hiding this comment

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

@soniaconnolly - reusing the approach that was present but introducing the guards which we also want to test ... it allows us to reduce a lot of lines of coding in this test .... do you have any simple suggestions on how to improve this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Paired on this and we ended up renaming the method to include_liveness_expected to make it clear that it's not overriding the method definition in code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we check the costs function actually adds the cost?

Copy link
Contributor Author

@amirbey amirbey Dec 21, 2023

Choose a reason for hiding this comment

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

you're right @dawei-nava ... we shouldn't forget about this ... i think that's out of scope for this ticket ... created LG-11965 so we won't lose track of this ... 👍🏿

Copy link
Contributor

@soniaconnolly soniaconnolly left a comment

Choose a reason for hiding this comment

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

Ran through the test plan, LGTM!

Additionally tested logging in at Identity Verified level with a Biometric Comparison verified account, and that worked too.

Couple additional notes from testing, not in scope for this PR:

  • In development, I'm still seeing the "don't have a license" questionnaire at the end of Document Capture. As far as I know I don't have any relevant config flags set in my local application.yml. Maybe application.yml.default has it on in development? (Yep, that was it, putting in a PR to turn that off.)
  • Should we add something to VerifyInfo that indicates a selfie was captured?

@amirbey amirbey force-pushed the amirbey/selfie-in-staging branch from 9d50c1e to a8c1a33 Compare December 21, 2023 20:02
Copy link
Contributor

Choose a reason for hiding this comment

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

This method looks very similar to liveness_checking_enabled? in DocumentCaptureConcern. Why not include the DocumentCaptureConcern at the top of the file and then call liveness_checking_enabled? here?

Putting all the checks in decorated_sp_session.selfie_required? would work, too. That also wouldn't require including DocumentCaptureConcern in this file. 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it also works if you use the attr_reader method of :liveness_checking_required in the validator.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏻

Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏻

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should say 'does not request FE to display selfie'

Copy link
Contributor

Choose a reason for hiding this comment

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

I know this predates this PR, but since you are working in this spec, do you mind combining the before statements on lines 32-40 into one before statement?

Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏻

Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Should the context block also say required? Do we want to be consistent in which term we use?

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 including this spec! 🙏🏻

Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 I wonder if it's worth updating this shared example in order to pass liveness_checking_required to it as an argument? Thinking out loud here.

@amirbey amirbey force-pushed the amirbey/selfie-in-staging branch from 002a432 to 63c35f8 Compare December 21, 2023 22:09
@amirbey amirbey merged commit 099ef6b into main Dec 21, 2023
@amirbey amirbey deleted the amirbey/selfie-in-staging branch December 21, 2023 22:36
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