FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(login): rate limiter shouldn't count successful logins by jsjoeio · Pull Request #3141 · coder/code-server · GitHub

fix(login): rate limiter shouldn't count successful logins - #3141

Merged
repo-ranger[bot] merged 14 commits into
mainfrom
jsjoeio/fix-login-rate-limiter
Apr 19, 2021
Merged

fix(login): rate limiter shouldn't count successful logins#3141
repo-ranger[bot] merged 14 commits into
mainfrom
jsjoeio/fix-login-rate-limiter

Conversation

jsjoeio commented Apr 15, 2021
edited
Loading

Copy link
Copy Markdown
Contributor

This PR fixes the login rate limiter to not count successful logins. This is important because it was causing issues with the e2e tests hitting the rate limit even though the logins were successful.

Changes

  • adds unit test for RateLimiter
  • moves loginPage.test.ts into login.test.ts
  • adds e2e tests for missing password, wrong password (and rate limiter)
  • adds new method to RateLimiter.canTry() to check remaining tokens

Fixes #2647

jsjoeio self-assigned this Apr 15, 2021
jsjoeio changed the title jsjoeio/fix-login-rate-limiter fix(login): rate limiter shouldn't count successful logins Apr 15, 2021
jsjoeio added this to the v3.9.4 milestone Apr 15, 2021
Comment thread test/config.ts
Comment thread test/config.ts Outdated
Comment thread test/e2e/login.test.ts
Comment thread test/e2e/login.test.ts Outdated
jsjoeio marked this pull request as ready for review April 15, 2021 23:52
jsjoeio requested a review from a team as a code owner April 15, 2021 23:52

oxy left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Ratelimiter needs adjustment - see individual review comments.

Comment thread src/node/routes/login.ts
Comment thread src/node/routes/login.ts
Comment thread test/unit/routes/login.test.ts Outdated
jsjoeio force-pushed the jsjoeio/fix-login-rate-limiter branch from 0d5f223 to fc85bf1 Compare April 16, 2021 21:25
jsjoeio requested review from code-asher and oxy April 16, 2021 21:25
Comment thread src/node/routes/login.ts Outdated
Comment thread src/node/routes/login.ts Outdated
oxy previously requested changes Apr 19, 2021

oxy left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Just a few nits; looking in good shape otherwise!

Comment thread test/unit/routes/login.test.ts Outdated
jsjoeio added 10 commits April 19, 2021 10:40
Before, we weren't checking if a login was successful before counting it
against the rate limiter.

With this change, we only count unsuccessful logins against the rate limiter.

We did this because this was a bug but also because it caused problems with our
e2e tests hitting the rate limit.
This changes adds a new method called `.canTry` to the rate limiter to check if
there are tokens remaining in the bucket.

It also adds suggestions from @oxy to make sure the user can brute force past
the rate limiter.
jsjoeio force-pushed the jsjoeio/fix-login-rate-limiter branch from fc85bf1 to 7928dc2 Compare April 19, 2021 17:41
jsjoeio requested review from code-asher and oxy April 19, 2021 18:22
Comment thread test/e2e/login.test.ts
jsjoeio force-pushed the jsjoeio/fix-login-rate-limiter branch from d23c37c to f80d5c3 Compare April 19, 2021 20:14
jsjoeio dismissed oxy’s stale review April 19, 2021 20:14

I've made the requested changed and Asher has approved.

oxy left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

All looks good!

repo-ranger Bot merged commit 6d65680 into main Apr 19, 2021
repo-ranger Bot deleted the jsjoeio/fix-login-rate-limiter branch April 19, 2021 20:29
jsjoeio added the testing Anything related to testing label May 14, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Anything related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Login rate limiter should not count against successful logins

4 participants


Back | FazBrowse Home | New Git URL