Skip to content

[Bug]: Security bypass via duplicate routes and missing Rate Limiters in server.js #2342

Description

@shan2003034

Bug Description

Several critical routing and security misconfigurations exist in server.js:

  1. Duplicate & Misplaced Routes: app.use() registrations for /api/books, /api/jobs, /api/courses, and /api/google-calendar are duplicated at the very bottom of the file, after app.listen() and error handlers.
  2. Rate Limit Bypass: The primary app.use("/api/google-calendar", ...) registration does not include the generalLimiter. Because Express matches the first defined route, the second registration (which has the limiter) is completely ignored. This creates a severe security vulnerability, allowing attackers or bots to bypass rate limits and send unlimited, unfiltered requests to this endpoint. The /api/roadmaps route is also entirely missing the generalLimiter.

Steps to Reproduce

  1. Start the backend server.
  2. Send repeated, rapid requests (e.g., refreshing a browser or using a script) to http://localhost:5000/api/google-calendar or /api/roadmaps.
  3. Observe that the server continues to process the requests indefinitely without returning a 429 Too Many Requests status, confirming the rate limit bypass.

Expected Behavior

All API routes should be registered before app.listen(). Sensitive and public-facing routes like /api/google-calendar and /api/roadmaps must enforce the generalLimiter to block spam requests and prevent DDoS attempts (returning a 429 status when limit is exceeded).

Actual Behavior

Missing limiters on initial route declarations and duplicated route registrations allow unrestricted access, completely bypassing the intended rate-limiting security mechanisms.

Severity

Critical

Screenshots / Screen Recording

No response

Browser

Not Applicable (Backend/Security Issue)

Operating System

Windows 11

Additional Context

I have already investigated this locally. By removing the duplicate routes at the bottom of the file, moving /api/google-calendar to the main route block, and attaching generalLimiter to all necessary endpoints, the rate limits are correctly enforced.

Activity

  1. github-actions commented on Sep 30, 2026

    @github-actions

    Thanks for creating this issue!

    If you'd like to work on it, simply comment:

    /claim

    The first person to claim the issue will be assigned automatically.

    Happy contributing!

  2. shan2003034 commented on Sep 30, 2026

    @shan2003034
    ContributorAuthor

    Hi maintainers, I have already refactored the routes and fixed this security issue locally. Could you please assign this to me? I will raise a Pull Request immediately.

  3. 28106 commented on Sep 30, 2026

    @28106

    Hi, @shan2003034 I’d like to work on this issue.

    I’ll clean up the duplicate route registrations in server.js, ensure all API routes are registered before app.listen(), and apply generalLimiter to the affected endpoints, including /api/google-calendar and /api/roadmaps.

    I’ll also verify the routing order and test that repeated requests are properly rate-limited with the expected 429 response, while preserving the existing route behavior.

  4. chetna123-ch commented on Oct 6, 2026

    @chetna123-ch

    Hi, I’d like to work on this issue.

    I’ve reviewed the routing and rate-limiting problems described here, including the duplicate route registrations, the missing generalLimiter on /api/google-calendar, and the missing limiter on /api/roadmaps.

    I can fix the route registration order, remove the duplicate registrations, apply the appropriate rate limiting, and verify that the affected endpoints correctly return 429 Too Many Requests when the limit is exceeded.

    Please assign this issue to me. Thank you! 🚀

  5. shrinivas-sn commented on Oct 16, 2026

    @shrinivas-sn

    /claim

  6. github-actions commented on Oct 16, 2026

    @github-actions

    ✅ @shrinivas-sn has successfully claimed this issue!

    You've been assigned. Happy coding!

    Tip: Please open a Pull Request linked to this issue when you're ready.
    Add Closes #2342 in your PR description.

  7. github-actions commented on Oct 31, 2026

    @github-actions

    This issue has had no activity for 14 days and has been marked as stale. If this is still relevant, please leave a comment or push an update within the next 7 days, otherwise it will be closed automatically to keep the tracker clean.

  8. shrinivas-sn commented on Oct 31, 2026

    @shrinivas-sn

    PR #2383 has been submitted and is currently awaiting maintainer review.

  9. github-actions commented on Nov 15, 2026

    @github-actions

    This issue has had no activity for 14 days and has been marked as stale. If this is still relevant, please leave a comment or push an update within the next 7 days, otherwise it will be closed automatically to keep the tracker clean.

  10. shrinivas-sn commented on Nov 16, 2026

    @shrinivas-sn

    Still active and relevant! The fix is implemented, verified, and submitted in PR #2383 (#2383), currently awaiting maintainer review.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingclaimedThis issue has been claimed by a contributorstale

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions