Skip to content
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

backend: added registration validation && added rate limitter #73

Merged
merged 1 commit into from
Jan 20, 2024
Merged

backend: added registration validation && added rate limitter #73

merged 1 commit into from
Jan 20, 2024

Conversation

kirtiraj22
Copy link
Contributor

Enhancements to User Registration Endpoint

Description

  • Added input validation middleware to validate user inputs during registration(using express-validator).
  • Implemented rate limiting using express-rate-limit (to solve the CodeQL Missing rate limiting error of the previous PR)
  • Fixed a minor typo in the login endpoint.

Changes Made

  1. Created validation.js middleware for input validation during user registration.
  2. Added express-rate-limit package to implement rate limiting.
  3. Created registerLimiter.js middleware. (allow a maximum of 20 requests per 15 minutes for the registration endpoint.)

Checklist

  • Input validation middleware added.
  • Rate limiting implemented for the registration endpoint.
  • Typo fixed in the login endpoint.

Screenshots

  • Manually tested the registration endpoint with various input scenarios to ensure proper validation.

Screenshot (293)

Screenshot (292)

Screenshot (291)

Screenshot (294)

Please review and let me know if you require any changes further.

Copy link

vercel bot commented Jan 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
doodle-collab ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 19, 2024 5:35pm

@kirtiraj22
Copy link
Contributor Author

also, currently the rate limiter allows 20 requests per 15 minutes, but if you want to increase or decrease the number of requests then you can modify the rateLimitter.js middleware, i.e :

const registerLimiter = rateLimit({
  windowMs: 15 * 60 * 1000,
  max: 20,        // change the number to increase/decrease the number of requests per 15 minutes 
});

@kirtiraj22
Copy link
Contributor Author

lastly, If the PR is good enough to get merged, then can you kindly put the IWOC2024 label?

@ItsRoy69 ItsRoy69 added bug Something isn't working enhancement New feature or request IWOC2024 medium labels Jan 20, 2024
@ItsRoy69
Copy link
Collaborator

LGTM

@ItsRoy69 ItsRoy69 merged commit 512885e into WikiPortal:main Jan 20, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request IWOC2024 medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants