Upgrade express-rate-limit

This commit is contained in:
Chocobozzz 2020-02-04 10:52:05 +01:00
parent 7cd1b12c19
commit 9a11f73392
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
4 changed files with 6 additions and 10 deletions

View File

@ -95,7 +95,7 @@
"deep-object-diff": "^1.1.0", "deep-object-diff": "^1.1.0",
"express": "^4.12.4", "express": "^4.12.4",
"express-oauth-server": "^2.0.0", "express-oauth-server": "^2.0.0",
"express-rate-limit": "^4.0.4", "express-rate-limit": "^5.0.0",
"express-validator": "^6.4.0", "express-validator": "^6.4.0",
"flat": "^5.0.0", "flat": "^5.0.0",
"fluent-ffmpeg": "^2.1.0", "fluent-ffmpeg": "^2.1.0",

View File

@ -1,5 +1,4 @@
import * as express from 'express' import * as express from 'express'
import * as RateLimit from 'express-rate-limit'
import { configRouter } from './config' import { configRouter } from './config'
import { jobsRouter } from './jobs' import { jobsRouter } from './jobs'
import { oauthClientsRouter } from './oauth-clients' import { oauthClientsRouter } from './oauth-clients'
@ -15,6 +14,7 @@ import { overviewsRouter } from './overviews'
import { videoPlaylistRouter } from './video-playlist' import { videoPlaylistRouter } from './video-playlist'
import { CONFIG } from '../../initializers/config' import { CONFIG } from '../../initializers/config'
import { pluginRouter } from './plugins' import { pluginRouter } from './plugins'
import * as RateLimit from 'express-rate-limit'
const apiRouter = express.Router() const apiRouter = express.Router()
@ -24,8 +24,6 @@ apiRouter.use(cors({
credentials: true credentials: true
})) }))
// FIXME: https://github.com/nfriedly/express-rate-limit/issues/138
// @ts-ignore
const apiRateLimiter = RateLimit({ const apiRateLimiter = RateLimit({
windowMs: CONFIG.RATES_LIMIT.API.WINDOW_MS, windowMs: CONFIG.RATES_LIMIT.API.WINDOW_MS,
max: CONFIG.RATES_LIMIT.API.MAX max: CONFIG.RATES_LIMIT.API.MAX

View File

@ -53,8 +53,6 @@ import { Hooks } from '@server/lib/plugins/hooks'
const auditLogger = auditLoggerFactory('users') const auditLogger = auditLoggerFactory('users')
// FIXME: https://github.com/nfriedly/express-rate-limit/issues/138
// @ts-ignore
const loginRateLimiter = RateLimit({ const loginRateLimiter = RateLimit({
windowMs: CONFIG.RATES_LIMIT.LOGIN.WINDOW_MS, windowMs: CONFIG.RATES_LIMIT.LOGIN.WINDOW_MS,
max: CONFIG.RATES_LIMIT.LOGIN.MAX max: CONFIG.RATES_LIMIT.LOGIN.MAX

View File

@ -2282,10 +2282,10 @@ express-oauth-server@^2.0.0:
express "^4.13.3" express "^4.13.3"
oauth2-server "3.0.0" oauth2-server "3.0.0"
express-rate-limit@^4.0.4: express-rate-limit@^5.0.0:
version "4.0.4" version "5.0.0"
resolved "https://registry.yarnpkg.com/express-rate-limit/-/express-rate-limit-4.0.4.tgz#a495338ae9e58c856b66d1346ec0d86f43ba2e43" resolved "https://registry.yarnpkg.com/express-rate-limit/-/express-rate-limit-5.0.0.tgz#9a6f4cacc388c1a1da7ba2f65db69f7395e9b04e"
integrity sha512-DLRj2vMO7Xgai8qWKU9O6ZztF2bdDmfFNFi9k3G9BPzJ+7MG7eWaaBikbe0eBpNGSxU8JziwW0PQKG78aNWa6g== integrity sha512-dhT57wqxfqmkOi4HM7NuT4Gd7gbUgSK2ocG27Y6lwm8lbOAw9XQfeANawGq8wLDtlGPO1ZgDj0HmKsykTxfFAg==
express-validator@^6.4.0: express-validator@^6.4.0:
version "6.4.0" version "6.4.0"