Skip to content

LG-12292: Perform reCAPTCHA assessment at sign-in#10772

Merged
aduth merged 14 commits intomainfrom
aduth-lg-12292-recaptcha-sign-in
Jun 24, 2024
Merged

LG-12292: Perform reCAPTCHA assessment at sign-in#10772
aduth merged 14 commits intomainfrom
aduth-lg-12292-recaptcha-sign-in

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Jun 6, 2024

🎫 Ticket

LG-12292

🛠 Summary of changes

Implements reCAPTCHA validation at sign-in, behind a feature flag.

This builds upon code from the previous proof-of-concept at #10587.

📜 Testing Plan

Verify that you can pass and fail reCAPTCHA validation at sign-in from a new or existing device:

  1. Go to http://localhost:3000
  2. Enter email and password
  3. (Optional) Customize "reCAPTCHA score" in the mock debugger tool
  4. Click "Sign in"
  5. Observe:
    • If you have already signed in on this device, you are allowed to proceed regardless of the score entered in Step 3
    • If you haven't already signed in on this device and you enter a score at or above 0.3, you are allowed to proceed
    • Otherwise, you are presented with an error message

Verify that there is no validation when the feature flag is disabled:

  1. Add sign_in_recaptcha_score_threshold: 0.0 and phone_recaptcha_mock_validator: false (rename TBD) to config/application.yml
  2. Restart server
  3. Go to http://localhost:3000
  4. Observe no "reCAPTCHA score" field
  5. Sign in with email and password
  6. Observe no error message shown

👀 Screenshots

image

Comment on lines 39 to 35
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This revised lookup is intended to address previous comments from proof-of-concept #10587 (comment) and #10587 (comment) (cc @mitchellhenke @zachmargolis)

@aduth aduth force-pushed the aduth-lg-12292-recaptcha-sign-in branch from 82eb2cc to 807ca11 Compare June 7, 2024 14:30
@aduth aduth requested a review from a team June 7, 2024 14:31
@aduth aduth marked this pull request as ready for review June 7, 2024 14:31
aduth and others added 13 commits June 21, 2024 08:42
Previously needed since recaptcha_token wasn't a method on SignInRecaptchaForm, but the method was added in ede24b278b
Base classes manage exemption already using score threshold, so initialize score threshold based on expected sign-in exemption cases
changelog: Upcoming Features, Spam Mitigation, Add reCAPTCHA at sign-in behind feature flag
Not strictly necessary, but safer, and avoids loading extra resources while disabled
Move short-circuit to score_threshold logic
See: #10772 (comment)
Co-Authored-By: Malick Diarra <malick.diarra@gsa.gov>
@aduth aduth force-pushed the aduth-lg-12292-recaptcha-sign-in branch from dd0bdca to 112ea41 Compare June 21, 2024 12:52
Revert to behavior more similar to how it works on main
@aduth aduth requested review from mdiarra3 and zachmargolis June 21, 2024 13:40
Copy link
Contributor

@mdiarra3 mdiarra3 left a comment

Choose a reason for hiding this comment

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

LGTM tested locally and worked as expected.

@aduth aduth merged commit 38b0a90 into main Jun 24, 2024
@aduth aduth deleted the aduth-lg-12292-recaptcha-sign-in branch June 24, 2024 13: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.

3 participants