Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add captcha to registration form #5698

Merged
merged 34 commits into from
Apr 23, 2024

Conversation

matusdrobuliak66
Copy link
Contributor

@matusdrobuliak66 matusdrobuliak66 commented Apr 19, 2024

What do these changes do?

  • ✨ Add captcha to registration form
  • ✨ Frontend:
    • Captcha image is requested when the users moves to the Request Account view
    • When tapping on it, a new captcha challenge will be requested to backend (sometimes it's not easy to guess it even for humans)
    • When failing, a new challenge will be requested

Captcha

Related issue/s

How to test

Dev-ops checklist

@matusdrobuliak66 matusdrobuliak66 self-assigned this Apr 19, 2024
@matusdrobuliak66 matusdrobuliak66 added this to the Enchanted Odyssey milestone Apr 19, 2024
Copy link

codecov bot commented Apr 19, 2024

Codecov Report

Attention: Patch coverage is 60.00000% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 84.0%. Comparing base (cafbf96) to head (ea3b87f).
Report is 140 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #5698      +/-   ##
=========================================
- Coverage    84.5%   84.0%    -0.6%     
=========================================
  Files          10    1127    +1117     
  Lines         214   49968   +49754     
  Branches       25     555     +530     
=========================================
+ Hits          181   41989   +41808     
- Misses         23    7858    +7835     
- Partials       10     121     +111     
Flag Coverage Δ
integrationtests 63.9% <44.8%> (?)
unittests 85.6% <60.0%> (+1.0%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...y/src/models_library/api_schemas_webserver/auth.py 100.0% <100.0%> (ø)
.../src/simcore_service_webserver/login/_constants.py 100.0% <100.0%> (ø)
..._service_webserver/login/_registration_handlers.py 93.1% <66.6%> (ø)
...mcore_service_webserver/login/_registration_api.py 71.1% <41.6%> (ø)

... and 1124 files with indirect coverage changes

@odeimaiz odeimaiz self-assigned this Apr 19, 2024
@matusdrobuliak66 matusdrobuliak66 marked this pull request as ready for review April 22, 2024 14:38
Copy link
Member

@odeimaiz odeimaiz left a comment

Choose a reason for hiding this comment

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

Very nice 👍

@odeimaiz odeimaiz added a:frontend issue affecting the front-end (area group) a:webserver issue related to the webserver service labels Apr 22, 2024
Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

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

Looks great! Added some suggestions on the backend

Regarding the front-end:

  1. UX: Add some instruction to indicate that clicking the image regenerates the code
  2. UI: is there a way to make more space and fit the entire form in a single page? e.g. reducing the fonts or increasing the width?

Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

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

So I guess the get_session is per user right? otherwise I was wondering how that would work multi-user.
2nd question, if I make a locust that runs the get /auth/captcha, can I break the webserver by making it use a shitload of memory?

Copy link
Contributor

@GitHK GitHK left a comment

Choose a reason for hiding this comment

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

looks nice to me. some minor things

Copy link
Contributor

@bisgaard-itis bisgaard-itis left a comment

Choose a reason for hiding this comment

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

Very cool! Thanks a lot

@matusdrobuliak66
Copy link
Contributor Author

matusdrobuliak66 commented Apr 23, 2024

So I guess the get_session is per user right? otherwise I was wondering how that would work multi-user. 2nd question, if I make a locust that runs the get /auth/captcha, can I break the webserver by making it use a shitload of memory?

  1. Yes, its per request session
  2. For now I reused the global_rate_limit_route therefore we have some additional level of protection. But you are right this GET captcha goes a bit against what it is trying to solve. But at least the bots would not spam us with emails now :)

@odeimaiz
Copy link
Member

odeimaiz commented Apr 23, 2024

  1. UX: Add some instruction to indicate that clicking the image regenerates the code
  2. UI: is there a way to make more space and fit the entire form in a single page? e.g. reducing the fonts or increasing the width?

I added a reload button, with that we avoid adding more text to an already busy form.

Regarding the single page, the font is already small, so the only solution I see is to go for a wider and 3 columns form... not a big fun of that solution. Also, this was "designed" by the people on the 3rd floor, so it might trigger more meetings...

Copy link
Contributor

@jsaq007 jsaq007 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 👍 I just wonder if the image is a little cut off could it cause issue for a user if their resolution is higher?

@matusdrobuliak66 matusdrobuliak66 enabled auto-merge (squash) April 23, 2024 12:38
Copy link

sonarcloud bot commented Apr 23, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@matusdrobuliak66 matusdrobuliak66 merged commit 8469942 into ITISFoundation:master Apr 23, 2024
56 checks passed
@matusdrobuliak66 matusdrobuliak66 deleted the add-captcha branch April 23, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:frontend issue affecting the front-end (area group) a:webserver issue related to the webserver service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2FA Improvements UI: add recaptcha challenge in the request account to avoid spam and abuse
7 participants