Skip to content
This repository has been archived by the owner on Jan 13, 2021. It is now read-only.

ReCAPTCHA + Rate Limit Refactor + Deduped Pin Cost Calculation Where Possible #474

Merged
merged 23 commits into from
Apr 20, 2020

Conversation

bonedaddy
Copy link
Contributor

@bonedaddy bonedaddy commented Apr 13, 2020

👷 Purpose

Enabling optional usage of reCAPTCHA v3, and refactor rate limiter, require verified emails to login. The release of this PR needs to be timed on several factors:

  • Update warp to include the same logic
  • Update database to set unverified limits to 0
  • ENS management app updated
    • This is the main coordination aspect. We need to time a deploy of our update with a deploy of the ens management app

Closes #476

🚀 Changes

  • Modify rate limiter to go by clientIP
  • Enable callbacks to reCAPTCHA v3
    • Note this doesn't mean you have to use reCAPTCHA/v3 with Temporal, if you don't want to enable captcha verification, don't supply a value either via the environment variable, or config file (default behavior)
  • Require verified emails to sign-in
  • When calculating pin cost, first attempt a deduplicated size analysis, falling back to traditional size analysis
    • Deduplicated size cost will only be possible with UnixFS objects, as arbitrary ipld types may not conform to the same specifications, and thus require traditional size calculation

⚠️ Breaking Changes

None

@codecov
Copy link

codecov bot commented Apr 13, 2020

Codecov Report

Merging #474 into master will decrease coverage by 0.22%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #474      +/-   ##
==========================================
- Coverage   52.88%   52.67%   -0.21%     
==========================================
  Files          43       43              
  Lines        4342     4371      +29     
==========================================
+ Hits         2296     2302       +6     
- Misses       1536     1557      +21     
- Partials      510      512       +2     
Impacted Files Coverage Δ
api/v2/routes_utils.go 45.60% <0.00%> (-1.44%) ⬇️
utils/utils.go 72.50% <36.37%> (-10.83%) ⬇️
api/v2/routes_ipns.go 45.30% <50.00%> (+0.68%) ⬆️
api/middleware/jwt.go 75.61% <60.00%> (-3.33%) ⬇️
api/v2/routes_rtfs.go 37.56% <60.00%> (+0.21%) ⬆️
api/v2/utils.go 53.90% <60.00%> (+0.52%) ⬆️
api/v2/api.go 85.11% <68.43%> (-0.92%) ⬇️
api/v2/routes_frontend.go 34.93% <100.00%> (ø)
queue/mail.go 65.91% <0.00%> (-15.90%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 137c749...3e6ff4f. Read the comment docs.

@bonedaddy bonedaddy changed the title ReCAPTCHA + Rate Limit Refactor ReCAPTCHA + Rate Limit Refactor (DO NOT MERGE) Apr 17, 2020
@bonedaddy bonedaddy requested a review from xiegeo April 17, 2020 20:06
@bonedaddy bonedaddy changed the title ReCAPTCHA + Rate Limit Refactor (DO NOT MERGE) ReCAPTCHA + Rate Limit Refactor Apr 17, 2020
@bonedaddy bonedaddy marked this pull request as ready for review April 18, 2020 00:13
@bonedaddy bonedaddy changed the title ReCAPTCHA + Rate Limit Refactor ReCAPTCHA + Rate Limit Refactor + Deduped Pin Cost Calculation Where Possible Apr 18, 2020
Comment on lines 65 to 68
if usr.EmailEnabled && usr.AccountEnabled {
return true
}
return false
Copy link
Contributor

Choose a reason for hiding this comment

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

return usr.EmailEnabled && usr.AccountEnabled

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch

@bonedaddy bonedaddy merged commit 6369551 into master Apr 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable Deduplicated Pin Size Calculation
2 participants