From e5a2537aeeb2fb5727201cf3a27a1fba41662d88 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Feb 2023 13:12:57 -0600 Subject: [PATCH] chore: bump limiter from 1.1.5 to 2.1.0 (#6001) * chore: bump limiter from 1.1.5 to 2.1.0 Bumps [limiter](https://github.com/jhurliman/node-rate-limiter) from 1.1.5 to 2.1.0. - [Release notes](https://github.com/jhurliman/node-rate-limiter/releases) - [Commits](https://github.com/jhurliman/node-rate-limiter/commits) --- updated-dependencies: - dependency-name: limiter dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Update limiter usage --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Asher --- package.json | 2 +- src/node/routes/login.ts | 4 ++-- yarn.lock | 15 +++++++++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 8d2c70c0a..ea70fecc0 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "httpolyglot": "^0.1.2", "i18next": "^22.4.6", "js-yaml": "^4.0.0", - "limiter": "^1.1.5", + "limiter": "^2.1.0", "pem": "^1.14.2", "proxy-agent": "^5.0.0", "qs": "6.11.0", diff --git a/src/node/routes/login.ts b/src/node/routes/login.ts index 786b89c7f..b97b7647b 100644 --- a/src/node/routes/login.ts +++ b/src/node/routes/login.ts @@ -12,8 +12,8 @@ import i18n from "../i18n" // RateLimiter wraps around the limiter library for logins. // It allows 2 logins every minute plus 12 logins every hour. export class RateLimiter { - private readonly minuteLimiter = new Limiter(2, "minute") - private readonly hourLimiter = new Limiter(12, "hour") + private readonly minuteLimiter = new Limiter({ tokensPerInterval: 2, interval: "minute" }) + private readonly hourLimiter = new Limiter({ tokensPerInterval: 12, interval: "hour" }) public canTry(): boolean { // Note: we must check using >= 1 because technically when there are no tokens left diff --git a/yarn.lock b/yarn.lock index b7688074d..691302927 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2151,6 +2151,11 @@ jsonparse@^1.2.0: resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" integrity sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA= +just-performance@4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/just-performance/-/just-performance-4.3.0.tgz#cc2bc8c9227f09e97b6b1df4cd0de2df7ae16db1" + integrity sha512-L7RjvtJsL0QO8xFs5wEoDDzzJwoiowRw6Rn/GnvldlchS2JQr9wFYPiwZcDfrbbujEKqKN0tvENdbjXdYhDp5Q== + levn@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" @@ -2167,10 +2172,12 @@ levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -limiter@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/limiter/-/limiter-1.1.5.tgz#8f92a25b3b16c6131293a0cc834b4a838a2aa7c2" - integrity sha512-FWWMIEOxz3GwUI4Ts/IvgVy6LPvoMPgjMdQ185nN6psJyBJ4yOpzqm695/h5umdLJg2vW3GR5iG11MAkR2AzJA== +limiter@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/limiter/-/limiter-2.1.0.tgz#d38d7c5b63729bb84fb0c4d8594b7e955a5182a2" + integrity sha512-361TYz6iay6n+9KvUUImqdLuFigK+K79qrUtBsXhJTLdH4rIt/r1y8r1iozwh8KbZNpujbFTSh74mJ7bwbAMOw== + dependencies: + just-performance "4.3.0" locate-path@^6.0.0: version "6.0.0"