Skip to content

Potential fix for code scanning alert no. 23: Missing rate limiting #257

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

Merged
merged 2 commits into from
May 15, 2025

Conversation

vprusso
Copy link
Collaborator

@vprusso vprusso commented May 12, 2025

Potential fix for https://github.com/unitaryfoundation/metriq-api/security/code-scanning/23

To address the issue, we will implement rate limiting specifically for the login route using the express-rate-limit package. This will restrict the number of login attempts a client can make within a specified time window, mitigating the risk of brute-force attacks and DoS attacks. The rate limiter will be configured to allow a maximum of 5 login attempts per minute for each client IP address.

Steps to fix:

  1. Install the express-rate-limit package if it is not already installed.
  2. Import the express-rate-limit package in the api-routes.js file.
  3. Define a rate limiter specifically for the login route.
  4. Apply the rate limiter middleware to the login route.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@vprusso vprusso marked this pull request as ready for review May 12, 2025 18:03
@vprusso vprusso requested a review from cosenal May 12, 2025 18:04
Copy link
Contributor

@cosenal cosenal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@cosenal cosenal merged commit cef313d into main May 15, 2025
4 checks passed
@cosenal cosenal deleted the alert-autofix-23 branch May 15, 2025 14:20
cosenal pushed a commit that referenced this pull request May 15, 2025
…257)

* Potential fix for code scanning alert no. 23: Missing rate limiting

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* chore: update npm lock

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants