Skip to content

LG-7201 - Added attempt events - MFA submitted rate limited#6783

Merged
Rwolfe-Nava merged 9 commits intomainfrom
lg7200-mfa-phone-otp-send-rate-limited
Aug 19, 2022
Merged

LG-7201 - Added attempt events - MFA submitted rate limited#6783
Rwolfe-Nava merged 9 commits intomainfrom
lg7200-mfa-phone-otp-send-rate-limited

Conversation

@Rwolfe-Nava
Copy link
Contributor

@Rwolfe-Nava Rwolfe-Nava commented Aug 18, 2022

Summary of changes

  1. Added mfa_enroll_rate_limited attempt event.
  2. Added mfa_verify_rate_limited attempt event. EDIT: now mfa_login_rate_limited
  3. Added tests in various two_factor_authentication spec files for the above events.
  4. Modified several functions starting with handle_invalid_otp in order to support the above events.

changelog: Internal, Attempts API, Track additional events

@Rwolfe-Nava Rwolfe-Nava requested a review from a team August 18, 2022 15:04
@Rwolfe-Nava Rwolfe-Nava changed the title LG-7200 - Added attempt events - Phone OTP submitted rate limited LG-7109 - Added attempt events - Phone OTP submitted rate limited - Sign up AND Sign in Aug 18, 2022
@Rwolfe-Nava Rwolfe-Nava changed the title LG-7109 - Added attempt events - Phone OTP submitted rate limited - Sign up AND Sign in LG-7109a - Added attempt events - Phone OTP submitted rate limited - Sign up AND Sign in Aug 18, 2022
@Rwolfe-Nava Rwolfe-Nava changed the title LG-7109a - Added attempt events - Phone OTP submitted rate limited - Sign up AND Sign in LG-7200 - Added attempt events - Phone OTP submitted rate limited - Sign up AND Sign in Aug 18, 2022
@Rwolfe-Nava Rwolfe-Nava changed the title LG-7200 - Added attempt events - Phone OTP submitted rate limited - Sign up AND Sign in LG-7201 - Added attempt events - Phone OTP submitted rate limited Aug 18, 2022
Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

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

LGTM, small changes

@Rwolfe-Nava Rwolfe-Nava force-pushed the lg7200-mfa-phone-otp-send-rate-limited branch from 72e7701 to 440da0f Compare August 18, 2022 17:21
@Rwolfe-Nava Rwolfe-Nava changed the title LG-7201 - Added attempt events - Phone OTP submitted rate limited LG-7201 - Added attempt events - MFA submitted rate limited Aug 18, 2022
Copy link
Contributor

@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.

One minor suggestion, but overall this looks good.

I'm going to hold off on approving since I paired a bit on this, but LGTM.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it's worth calling out for others: the code previously passed in "otp" for both phone-based OTP and TOTP, but we wanted to distinguish between them as distinct events.

This way we pass in extra detail, but don't change the user experience.

@Rwolfe-Nava Rwolfe-Nava force-pushed the lg7200-mfa-phone-otp-send-rate-limited branch from 03aea3d to bc7effb Compare August 18, 2022 18:12
@Rwolfe-Nava Rwolfe-Nava force-pushed the lg7200-mfa-phone-otp-send-rate-limited branch from bc7effb to ad561de Compare August 19, 2022 16:31
Copy link
Contributor

@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.

Looks good to me!

The absolute nittiest of nits about a comment that got moved in the merge conflict; I'd ignore it unless you find yourself editing stuff anyway since it doesn't change anything.

# You can pass in any "type" with a corresponding I18n key in
# two_factor_authentication.invalid_#{type}
def handle_invalid_otp(type: 'otp')
def handle_invalid_otp(type:, context: nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

I am weirdly delighted that we're able to get rid of the hard-coded 'otp' default here. 👏

# Tracks when the user has attempted to log in with the piv cac MFA method to their account
# @param [String] subject_dn
# @param [Boolean] success
# @param [String] subject_dn
Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO I wouldn't fix this unless you need to edit something else in this PR anyway, but I think in the merge conflict this line got moved from above to below success.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, the merge conflict removed the top two lines entirely 😨. I put them back in a commit, but noticed that the params were out of order, so I moved subject_dn below success on purpose, to match the function definition. Was that the right thing to do?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, my bad! Yes, good catch. 👍

@Rwolfe-Nava Rwolfe-Nava merged commit 1e43e71 into main Aug 19, 2022
@Rwolfe-Nava Rwolfe-Nava deleted the lg7200-mfa-phone-otp-send-rate-limited branch August 19, 2022 17:23
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.

3 participants