-
Notifications
You must be signed in to change notification settings - Fork 33
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
Mise à jour de dépendances mineures #4739
base: main
Are you sure you want to change the base?
Conversation
Associé à #4765 |
@@ -3,7 +3,7 @@ | |||
import { Express } from "express" | |||
|
|||
const moncompteproRoutes = function (api: Express) { | |||
api.get("/login", moncompteproController.login) | |||
api.get("/login", cookieParser(), moncompteproController.login) |
Check failure
Code scanning / CodeQL
Missing rate limiting High
authorization
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to introduce rate limiting to the login
route handler to prevent potential denial-of-service attacks. The best way to achieve this is by using the express-rate-limit
middleware. We will set up a rate limiter with a reasonable limit, such as 100 requests per 15 minutes, and apply it to the login
route.
We will need to:
- Import the
express-rate-limit
package. - Set up a rate limiter with the desired configuration.
- Apply the rate limiter to the
login
route.
-
Copy modified line R4 -
Copy modified lines R7-R12
@@ -3,5 +3,11 @@ | ||
import { Express } from "express" | ||
import rateLimit from "express-rate-limit" | ||
|
||
const moncompteproRoutes = function (api: Express) { | ||
api.get("/login", cookieParser(), moncompteproController.login) | ||
const loginRateLimiter = rateLimit({ | ||
windowMs: 15 * 60 * 1000, // 15 minutes | ||
max: 100, // limit each IP to 100 requests per windowMs | ||
}) | ||
|
||
api.get("/login", cookieParser(), loginRateLimiter, moncompteproController.login) | ||
api.get( |
-
Copy modified lines R103-R104
@@ -102,3 +102,4 @@ | ||
"webpack-cli": "^4.10.0", | ||
"webpack-dev-server": "^4.7.3" | ||
"webpack-dev-server": "^4.7.3", | ||
"express-rate-limit": "^7.4.1" | ||
}, |
Package | Version | Security advisories |
express-rate-limit (npm) | 7.4.1 | None |
JsonWebToken : https://github.com/auth0/node-jsonwebtoken/blob/master/CHANGELOG.md
OpenIdClient : https://github.com/panva/openid-client/blob/main/CHANGELOG.md
Tmp : https://github.com/raszi/node-tmp/blob/master/CHANGELOG.md
Validator : https://github.com/validatorjs/validator.js/blob/master/CHANGELOG.md