Skip to content

Fixed Unrestricted Authentication Endpoint#70

Merged
krishnapaljadeja merged 5 commits intogdg-charusat:mainfrom
Krish3017:fix/Unrestricted-Authentication-Endpoint
Feb 28, 2026
Merged

Fixed Unrestricted Authentication Endpoint#70
krishnapaljadeja merged 5 commits intogdg-charusat:mainfrom
Krish3017:fix/Unrestricted-Authentication-Endpoint

Conversation

@Krish3017
Copy link
Copy Markdown
Contributor

Team Number : Team 152

Description

Implemented comprehensive rate limiting on authentication endpoints to protect against brute-force attacks, account enumeration, and denial-of-service attacks. This security enhancement adds request throttling to login and registration endpoints, along with global API rate limiting.

Related Issue

Closes #67

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Style/UI improvement

Changes Made

  • Installed express-rate-limit package for implementing rate limiting
  • Created src/config/rateLimiter.js with three rate limiter configurations:
    • authLimiter: 5 requests per 15 minutes for login endpoint
    • registerLimiter: 3 requests per 60 minutes for registration endpoint
    • apiLimiter: 100 requests per 15 minutes for all API routes
  • Applied authLimiter to /api/auth/login endpoint in src/routes/auth.routes.js
  • Applied registerLimiter to /api/auth/register endpoint in src/routes/auth.routes.js
  • Applied global apiLimiter to all /api/* routes in src/app.js
  • Configured standard RateLimit headers and disabled legacy X-RateLimit headers

Testing

  • Tested on Desktop (Chrome/Firefox/Safari)
  • Tested on Mobile (iOS/Android)
  • Tested responsive design (different screen sizes)
  • No console errors or warnings
  • Code builds successfully (npm run build)
  • Verified rate limiting returns HTTP 429 when limits exceeded
  • Confirmed proper error messages are returned
  • Tested that RateLimit-* headers are present in responses

Checklist

  • My code follows the project's code style guidelines
  • I have performed a self-review of my code
  • I have commented my code where necessary
  • My changes generate no new warnings
  • I have tested my changes thoroughly
  • All TypeScript types are properly defined
  • Tailwind CSS classes are used appropriately (no inline styles)
  • Component is responsive across different screen sizes
  • I have read and followed the CONTRIBUTING.md guidelines

Additional Notes

This implementation follows OWASP security best practices for authentication rate limiting. The rate limits are configured conservatively:

  • Login: 5 attempts per 15 minutes (prevents brute force attacks)
  • Register: 3 attempts per 60 minutes (prevents spam account creation)
  • General API: 100 requests per 15 minutes (prevents DoS attacks)

These limits can be adjusted based on actual usage patterns and requirements. The implementation uses sliding window rate limiting for better accuracy and returns standardized RateLimit-* headers to inform clients of their current rate limit status.

@krishnapaljadeja krishnapaljadeja self-requested a review February 27, 2026 07:00
@krishnapaljadeja krishnapaljadeja added the needs-review Valid issue-linked PR awaiting review label Feb 27, 2026
@krishnapaljadeja
Copy link
Copy Markdown
Contributor

✅ PR Validation Passed

Hey @Krish3017! Your PR looks good. Here is what we found:

Field Value
Team Number Team 152
Linked Issue Closes #67

A maintainer will review your PR within 24–48 hours. Stay responsive to feedback!

GDG CHARUSAT Open Source Contri Sprintathon

@krishnapaljadeja krishnapaljadeja added needs-review Valid issue-linked PR awaiting review and removed needs-review Valid issue-linked PR awaiting review labels Feb 27, 2026
@krishnapaljadeja
Copy link
Copy Markdown
Contributor

@Krish3017 can you please remove package-lock.json from the commit and rebase it.thankyou

@krishnapaljadeja krishnapaljadeja added needs-review Valid issue-linked PR awaiting review and removed needs-review Valid issue-linked PR awaiting review labels Feb 28, 2026
@krishnapaljadeja krishnapaljadeja added needs-review Valid issue-linked PR awaiting review and removed needs-review Valid issue-linked PR awaiting review labels Feb 28, 2026
@krishnapaljadeja krishnapaljadeja added needs-review Valid issue-linked PR awaiting review and removed needs-review Valid issue-linked PR awaiting review labels Feb 28, 2026
@krishnapaljadeja krishnapaljadeja merged commit df51f8b into gdg-charusat:main Feb 28, 2026
1 check passed
@krishnapaljadeja
Copy link
Copy Markdown
Contributor

🎉 PR Merged — Points Awarded!

Congratulations @Krish3017! Your contribution has been merged.

Field Value
Repo Code_duel_backend
Team Team 152
Contributor @Krish3017
Level Level 1 — Beginner
Points Awarded 5 pts
Source Linked Issue #67

The central leaderboard has been updated. Keep contributing!

GDG CHARUSAT Open Source Contri Sprintathon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review Valid issue-linked PR awaiting review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unrestricted Authentication Endpoint Enabling Brute-Force Attacks - T152

2 participants