Skip to content

LG-10022: Avoid second MFA prompt for strict MFA requirement#9263

Merged
aduth merged 1 commit intomainfrom
aduth-lg-10022-exempt-strict-aal2
Sep 25, 2023
Merged

LG-10022: Avoid second MFA prompt for strict MFA requirement#9263
aduth merged 1 commit intomainfrom
aduth-lg-10022-exempt-strict-aal2

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Sep 25, 2023

🎫 Ticket

Follow-on revision for LG-10022 (#9124)

🛠 Summary of changes

Updates the second MFA reminder logic to avoid prompting the user if they are authenticating with a partner which requires stricter MFA requirements (i.e. phishing-resistant or PIV-only). This avoids an issue where the user may inadvertently "downgrade" their authentication method, since they may choose to add a second MFA which is less secure than what was required for the request. This could result in the user being prompted excessively to reauthenticate, since the less-secure method would not be valid for the authentication request, and they'd need to reauthenticate with the more secure method.

Per related Slack discussion, a separate ticket will be created to explore revisions to the session auth_method tracking to allow multiple, simultaneous valid authentications, so that a less-secure-but-more-recent authentication will not invalidate a more-secure-but-less-recent authentication.

📜 Testing Plan

It's easiest to test by setting an artificially low config override for sign-ins or account page, e.g. in config/application.yml:

second_mfa_reminder_sign_in_count: 1
  1. Go to http://localhost:3000
  2. Create an account using a phishing-resistant MFA method (security key, face or touch unlock, or PIV)
  3. After account creation, sign out
  4. Start the sample app in a separate terminal process
  5. Go to http://localhost:9292/?aal=2-phishing_resistant
  6. Click "Sign in"
  7. Sign in
  8. Observe that you are not prompted with the screen suggesting that you add a second authentication method

changelog: User-Facing Improvements, MFA Setup, Add second MFA reminder screen for single-MFA accounts
@aduth aduth requested a review from a team September 25, 2023 15:56
def user_needs_second_mfa_reminder?
return false unless IdentityConfig.store.second_mfa_reminder_enabled
return false if user_has_dismissed_second_mfa_reminder? || user_has_multiple_mfa_methods?
return false if user_has_dismissed_second_mfa_reminder?
Copy link
Contributor

Choose a reason for hiding this comment

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

if each conditional returns false, why not || operator instead of multiple return false statements?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

|| operator can work. It's a minor thing, but stylistically I felt the multiple returns are a little easier to scan as associated with the return value when split across multiple lines, though I preferred the || when it could be contained to a single line.

For example, in this code snippet, it's a little less obvious to me that user_has_multiple_mfa_methods? ties back to the return false, since it's so far apart.

return false if !IdentityConfig.store.second_mfa_reminder_enabled ||
  user_has_dismissed_second_mfa_reminder? ||
  second_mfa_enrollment_may_downgrade_for_service_provider_mfa_requirement? ||
  user_has_multiple_mfa_methods?

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.

2 participants