scidsg / hushline

Hush Line connects whistleblowers with organizations and people who can help.
https://hushline.app
GNU Affero General Public License v3.0
69 stars 21 forks source link

[Audit - Personal Server] - Implement Application-Level Rate Limiting #244

Closed glenn-sorrentino closed 7 months ago

glenn-sorrentino commented 7 months ago

Implement Application-Level Rate Limiting

Background

In our ongoing efforts to enhance security and ensure service availability, we have identified a need to implement application-level rate limiting. This approach focuses on monitoring and controlling user behavior directly within the application, rather than relying solely on IP-based rate limiting, which can be evaded or cause unintended access issues, especially with users coming from shared networks or using the Tor network.

Objective

The primary objective is to implement a rate limiting mechanism at the application level that effectively prevents abuse and ensures equitable resource usage without depending on the user's IP address. This mechanism should limit the number of messages (or any other specified actions) a user can send within a certain timeframe, thereby mitigating potential denial of service (DoS) attacks or misuse of the service.

Proposal

Action Items

Expected Impact

By implementing application-level rate limiting, we aim to enhance our application's security and availability by preventing abuse and ensuring that resources are used fairly among all users. This approach will help mitigate potential DoS attacks and other forms of abuse without relying on IP address-based restrictions, thereby supporting a more inclusive and accessible service for all users, including those using privacy-enhancing technologies like the Tor network.

glenn-sorrentino commented 7 months ago

Adding Flask-Limiter for application-side DOS mitigation

glenn-sorrentino commented 7 months ago

Limits page requests to 10 per minute per session

glenn-sorrentino commented 7 months ago

update to use Redis for storage.

glenn-sorrentino commented 7 months ago