-
Notifications
You must be signed in to change notification settings - Fork 0
security: fix VAPT vulnerabilities — WebSocket CSWSH, rate limiting, … #17
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
Changes from all commits
a6a2f02
f172297
d0cf4de
3d4a5c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| """Rate limiting configuration using slowapi.""" | ||
|
|
||
| from slowapi import Limiter | ||
| from slowapi.util import get_remote_address | ||
|
|
||
| limiter = Limiter(key_func=get_remote_address) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In-memory rate limiting broken under multiple workers The The app already has a Redis connection configured in Prompt To Fix With AIThis is a comment left during a code review.
Path: backend/app/rate_limit.py
Line: 6
Comment:
**In-memory rate limiting broken under multiple workers**
The `Limiter` is constructed here without a shared backing store, so it defaults to an in-process memory counter. In a production deployment with multiple uvicorn workers (e.g. `--workers 4`), each process holds its own independent counter. A client can therefore make `limit × worker_count` attempts per window — e.g. 5 register calls × 4 workers = 20 effective attempts per minute — defeating the purpose of the limit entirely.
The app already has a Redis connection configured in `Settings`. SlowAPI's `Limiter` can be pointed at Redis so that all workers share a single rate-limit bucket per client. Without a shared backing store, the rate limiting added in this PR will not function correctly in any multi-worker production environment.
How can I resolve this? If you propose a fix, please make it concise. |
||
Uh oh!
There was an error while loading. Please reload this page.